From afa6e26ab15a351d4ab6d379e72f48d498cfec9b Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Tue, 22 Feb 2011 09:33:11 +0100 Subject: CWS gnumake4: add support for zip and jar files --- solenv/gbuild/Zip.mk | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 solenv/gbuild/Zip.mk (limited to 'solenv/gbuild/Zip.mk') diff --git a/solenv/gbuild/Zip.mk b/solenv/gbuild/Zip.mk new file mode 100644 index 000000000000..6f677c181af1 --- /dev/null +++ b/solenv/gbuild/Zip.mk @@ -0,0 +1,77 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2011 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +# Zip class + +gb_Zip_ZIPCOMMAND := zip + +# remove zip file in workdir and outdir +$(call gb_Zip_get_clean_target,%) : + $(call gb_Output_announce,$*,$(false),ZIP,3) + $(call gb_Helper_abbreviate_dirs,\ + rm -f $(call gb_Zip_get_target,$*) && \ + rm -f $(call gb_Zip_get_final_target,$*) && \ + rm -f $(call gb_Zip_get_outdir_target,$*)) + +# clear file list, set location (zipping uses relative paths) +# register target and clean target +# add deliverable +define gb_Zip_Zip + +$(call gb_Zip_get_target,$(1)) : FILES := +$(call gb_Zip_get_target,$(1)) : LOCATION := $(2) +gb_Package_Location_$(1) := $(2) + +$(call gb_Zip_get_final_target,$(1)) : $(call gb_Zip_get_outdir_target,$(1)) + touch $$@ + +$(call gb_Zip_get_outdir_target,$(1)) : $(call gb_Zip_get_target,$(1)) + $(call gb_Helper_abbreviate_dirs,\ + $$(call gb_Deliver_deliver,$$<,$$@)) + +$(eval $(call gb_Module_register_target,$(call gb_Zip_get_final_target,$(1)),$(call gb_Zip_get_clean_target,$(1)))) + +$(call gb_Zip_get_target,$(1)) : + $(call gb_Helper_abbreviate_dirs_native,\ + mkdir -p $$(dir $$(call gb_Zip_get_target,$(1))) && \ + cd $$(LOCATION) && $$(gb_Zip_ZIPCOMMAND) -rX -FS $$(call gb_Zip_get_target,$(1)) $$(FILES) ) + +$(call gb_Deliver_add_deliverable,$(call gb_Zip_get_outdir_target,$(1)),$(call gb_Zip_get_target,$(1))) + +endef + +define gb_Zip_add_file +$(call gb_Zip_get_target,$(1)) : FILES += $(2) +$(call gb_Zip_get_target,$(1)) : $(gb_Package_Location_$(1))/$(2) + +endef + +define gb_Zip_add_files +$(foreach file,$(2),$(call gb_Zip_add_file,$(1),$(file))) +endef + +# vim: set noet sw=4 ts=4: -- cgit