2014-05-06 01:46:52 +02:00
|
|
|
# Package up modules to a zip file.
|
|
|
|
# It preserves the install path of the modules' installed files.
|
|
|
|
#
|
|
|
|
# Input variables:
|
|
|
|
# my_modules: a list of module names
|
|
|
|
# my_package_name: the name of the output zip file.
|
|
|
|
# Output variables:
|
|
|
|
# my_package_zip: the path to the output zip file.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
|
|
|
my_staging_dir := $(call intermediates-dir-for,PACKAGING,$(my_package_name))
|
|
|
|
my_built_modules :=
|
|
|
|
my_copy_pairs :=
|
|
|
|
my_pickup_files :=
|
|
|
|
|
2014-05-19 22:03:36 +02:00
|
|
|
# Iterate over modules' built files and installed files;
|
2014-05-06 01:46:52 +02:00
|
|
|
# Calculate the dest files in the output zip file.
|
2014-05-19 22:03:36 +02:00
|
|
|
|
2014-05-06 01:46:52 +02:00
|
|
|
$(foreach m,$(my_modules),\
|
2014-05-19 22:03:36 +02:00
|
|
|
$(if $(ALL_MODULES.$(m).BUILT_INSTALLED),,\
|
2014-05-08 01:39:21 +02:00
|
|
|
$(warning Unknown installed file for module '$(m)'))\
|
2014-05-06 01:46:52 +02:00
|
|
|
$(eval my_pickup_files += $(ALL_MODULES.$(m).PICKUP_FILES))\
|
2014-05-19 22:03:36 +02:00
|
|
|
$(foreach i, $(ALL_MODULES.$(m).BUILT_INSTALLED),\
|
|
|
|
$(eval bui_ins := $(subst :,$(space),$(i)))\
|
|
|
|
$(eval ins := $(word 2,$(bui_ins)))\
|
|
|
|
$(if $(filter $(TARGET_OUT_ROOT)/%,$(ins)),\
|
|
|
|
$(eval bui := $(word 1,$(bui_ins)))\
|
|
|
|
$(eval my_built_modules += $(bui))\
|
2014-05-08 01:39:21 +02:00
|
|
|
$(eval my_copy_dest := $(patsubst data/%,DATA/%,\
|
2014-05-16 05:45:39 +02:00
|
|
|
$(patsubst system/%,DATA/%,\
|
2014-05-19 22:03:36 +02:00
|
|
|
$(patsubst $(PRODUCT_OUT)/%,%,$(ins)))))\
|
|
|
|
$(eval my_copy_pairs += $(bui):$(my_staging_dir)/$(my_copy_dest)))\
|
2014-05-06 01:46:52 +02:00
|
|
|
))
|
|
|
|
|
|
|
|
my_package_zip := $(my_staging_dir)/$(my_package_name).zip
|
|
|
|
$(my_package_zip): PRIVATE_COPY_PAIRS := $(my_copy_pairs)
|
|
|
|
$(my_package_zip): PRIVATE_PICKUP_FILES := $(my_pickup_files)
|
|
|
|
$(my_package_zip) : $(my_built_modules)
|
|
|
|
@echo "Package $@"
|
|
|
|
@rm -rf $(dir $@) && mkdir -p $(dir $@)
|
|
|
|
$(hide) $(foreach p, $(PRIVATE_COPY_PAIRS), \
|
|
|
|
$(eval pair := $(subst :,$(space),$(p)))\
|
|
|
|
mkdir -p $(dir $(word 2,$(pair))); \
|
|
|
|
cp -rf $(word 1,$(pair)) $(word 2,$(pair));)
|
|
|
|
$(hide) $(foreach f, $(PRIVATE_PICKUP_FILES), \
|
|
|
|
cp -rf $(f) $(dir $@);)
|
|
|
|
$(hide) cd $(dir $@) && zip -rq $(notdir $@) *
|