summaryrefslogtreecommitdiff
path: root/solenv/gbuild/Zip.mk
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2011-09-13 15:03:15 +0200
committerDavid Tardon <dtardon@redhat.com>2011-09-15 06:29:37 +0200
commit37356b7b2ae6ecdcef9908ae37c9b729c177f9d7 (patch)
tree474a7c94baadc270754dbe22e0ab68ca39473e13 /solenv/gbuild/Zip.mk
parent0510c98c5aaa04156981da48381d4a704ac55558 (diff)
allow to specify additional deps for zip target
Diffstat (limited to 'solenv/gbuild/Zip.mk')
-rw-r--r--solenv/gbuild/Zip.mk21
1 files changed, 21 insertions, 0 deletions
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: