summaryrefslogtreecommitdiff
path: root/solenv
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2011-02-23 11:43:04 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2011-06-16 10:49:06 +0200
commita308b650377c0cf63e5fbd23bada11f12bc6c698 (patch)
tree885f116d8d75bc7c5901f40baf26821b4ef12f86 /solenv
parent47c2ec8355252c3a5d9cf4edb248faf99b556b7c (diff)
CWS gnumake4: use pattern rules for zip and jar
Diffstat (limited to 'solenv')
-rw-r--r--solenv/gbuild/Jar.mk20
-rwxr-xr-xsolenv/gbuild/TargetLocations.mk2
-rw-r--r--solenv/gbuild/Zip.mk26
3 files changed, 21 insertions, 27 deletions
diff --git a/solenv/gbuild/Jar.mk b/solenv/gbuild/Jar.mk
index 7404b39e0d3b..4cb7ecf15a77 100644
--- a/solenv/gbuild/Jar.mk
+++ b/solenv/gbuild/Jar.mk
@@ -60,33 +60,31 @@ $(call gb_Jar_get_clean_target,%) : $(call gb_JavaClassSet_get_clean_target,$(ca
rm -f $(call gb_Jar_get_final_target,$*) && \
rm -f $(call gb_Jar_get_outdir_target,$*))
+# the final target is a touch target; we use it as registered targets should be in workdir, not in outdir
+# the outdir target depends on the workdir target and is built by delivering the latter
+# the workdir target is created by cd'ing to the target directory and adding/updating the files
$(call gb_Jar_get_final_target,%) : $(call gb_Jar_get_outdir_target,%)
$(call gb_Helper_abbreviate_dirs,\
touch $@)
+# rule for creating the jar file using the command defined above
+$(call gb_Jar_get_target,%) : $(call gb_JavaClassSet_get_target,$(call gb_Jar_get_classsetname,%))
+ $(call gb_Jar__command,$*,$@,$*,$?)
+
# resets scoped variables (see explanations where they are set)
# creates a class set and a dependency to it
# registers target and clean target
# adds jar files to DeliverLogTarget
-# creates a deliver rule
+# adds dependency for outdir target to workdir target (pattern rule for delivery is in Package.mk)
define gb_Jar_Jar
-
$(call gb_Jar_get_target,$(1)) : CLASSPATH := $(value XCLASSPATH)
$(call gb_Jar_get_target,$(1)) : MANIFEST :=
$(call gb_Jar_get_target,$(1)) : JARCLASSPATH :=
$(call gb_Jar_get_target,$(1)) : PACKAGEROOTS :=
-
$(call gb_JavaClassSet_JavaClassSet,$(call gb_Jar_get_classsetname,$(1)))
-$(call gb_Jar_get_target,$(1)) : $(call gb_JavaClassSet_get_target,$(call gb_Jar_get_classsetname,$(1)))
- $$(call gb_Jar__command,$(1),$$@,$$*,$$?)
-
-$(call gb_Jar_get_outdir_target,$(1)) : $(call gb_Jar_get_target,$(1))
- $(call gb_Helper_abbreviate_dirs,\
- $$(call gb_Deliver_deliver,$$<,$$@))
-
$(eval $(call gb_Module_register_target,$(call gb_Jar_get_final_target,$(1)),$(call gb_Jar_get_clean_target,$(1))))
-
$(call gb_Deliver_add_deliverable,$(call gb_Jar_get_outdir_target,$(1)),$(call gb_Jar_get_target,$(1)))
+$(call gb_Jar_get_outdir_target,$(1)) : $(call gb_Jar_get_target,$(1))
endef
diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk
index 96937a62792b..2c84b7c83c89 100755
--- a/solenv/gbuild/TargetLocations.mk
+++ b/solenv/gbuild/TargetLocations.mk
@@ -29,7 +29,7 @@
gb_ComponentTarget_get_outdir_target = $(OUTDIR)/xml/component/$(1).component
gb_Executable_get_target = $(OUTDIR)/bin/$(1)$(gb_Executable_EXT)
-gb_PackagePart_get_destinations = $(OUTDIR)/xml $(OUTDIR)/inc $(OUTDIR)/bin
+gb_PackagePart_get_destinations = $(OUTDIR)/xml $(OUTDIR)/inc $(OUTDIR)/bin $(OUTDIR)/pck
gb_PackagePart_get_target = $(OUTDIR)/$(1)
gb_ResTarget_get_outdir_imagelist_target = $(OUTDIR)/res/img/$(1).ilst
gb_ResTarget_get_outdir_target = $(OUTDIR)/bin/$(1).res
diff --git a/solenv/gbuild/Zip.mk b/solenv/gbuild/Zip.mk
index d57e4d06d16c..4116c4fb8147 100644
--- a/solenv/gbuild/Zip.mk
+++ b/solenv/gbuild/Zip.mk
@@ -37,37 +37,33 @@ $(call gb_Zip_get_clean_target,%) :
rm -f $(call gb_Zip_get_final_target,$*) && \
rm -f $(call gb_Zip_get_outdir_target,$*))
+# rule to create zip package in workdir
+# -FS makes sure that all files in the zip package will be removed that no longer are in $(FILES)
+$(call gb_Zip_get_target,%) :
+ $(call gb_Helper_abbreviate_dirs_native,\
+ mkdir -p $(dir $(call gb_Zip_get_target,$*)) && \
+ cd $(LOCATION) && $(gb_Zip_ZIPCOMMAND) -rX -FS $(call gb_Zip_get_target,$*) $(FILES) )
+
# the final target is a touch target; we use it as registered targets should be in workdir, not in outdir
# the outdir target depends on the workdir target and is built by delivering the latter
# the workdir target is created by cd'ing to the target directory and adding/updating the files
-# -FS makes sure that all files in the zip package will be removed that no longer are in $(FILES)
$(call gb_Zip_get_final_target,%) : $(call gb_Zip_get_outdir_target,%)
touch $@
# clear file list, set location (zipping uses relative paths)
# register target and clean target
# add deliverable
-# this zip package target requires that all added files have a common root directory (package location)
+# add dependency for outdir target to workdir target (pattern rule for delivery is in Package.mk)
+# the zip package target requires that all added files have a common root directory (package location)
# names of added files are relative to it; the zip will store them with their complete relative path name
-# the location can't be stored in a scoped variable as it is needed in the add_file macro (see below)
+# the location can't be stored in a scoped variable as it is needed in the add_file macro (see rule above)
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_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)))
+$(call gb_Zip_get_outdir_target,$(1)) : $(call gb_Zip_get_target,$(1))
endef