From 37356b7b2ae6ecdcef9908ae37c9b729c177f9d7 Mon Sep 17 00:00:00 2001 From: David Tardon Date: Tue, 13 Sep 2011 15:03:15 +0200 Subject: allow to specify additional deps for zip target --- solenv/gbuild/Zip.mk | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/solenv/gbuild/Zip.mk b/solenv/gbuild/Zip.mk index 6961140b5558..f411ce775fe0 100644 --- a/solenv/gbuild/Zip.mk +++ b/solenv/gbuild/Zip.mk @@ -28,6 +28,8 @@ # Zip class +gb_Zip__get_preparation_target = $(WORKDIR)/Zip/$(1).prepare + gb_Zip_ZIPCOMMAND := zip # remove zip file in workdir and outdir @@ -35,6 +37,7 @@ $(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__preparation_target,$*) && \ rm -f $(call gb_Zip_get_final_target,$*) && \ rm -f $(call gb_Zip_get_outdir_target,$*)) @@ -52,6 +55,12 @@ $(call gb_Zip_get_target,%) : $(call gb_Zip_get_final_target,%) : $(call gb_Zip_get_outdir_target,%) touch $@ +# the preparation target is here to ensure proper ordering of actions in cases +# when we want to, e.g., create a zip from files created by a custom target +$(call gb_Zip__get_preparation_target,%) : + $(call gb_Helper_abbreviate_dirs_native,\ + mkdir -p $(dir $@) && touch $@) + # clear file list, set location (zipping uses relative paths) # register target and clean target # add deliverable @@ -75,6 +84,13 @@ 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) +$(gb_Package_Location_$(1))/$(2) :| $(call gb_Zip__get_preparation_target,$(1)) + +endef + +# add additional dependency that must exist before the archive can be created +define gb_Zip_add_dependency +$(call gb_Zip__get_preparation_target,$(1)) :| $(2) endef @@ -82,4 +98,9 @@ define gb_Zip_add_files $(foreach file,$(2),$(call gb_Zip_add_file,$(1),$(file))) endef +define gb_Zip_add_dependencies +$(foreach dependency,$(2),$(call gb_Zip_add_dependency,$(1),$(dependency))) + +endef + # vim: set noet sw=4 ts=4: -- cgit