android-custom/Makefile

35 lines
1.0 KiB
Makefile

PRIVKEY = tools/testkey.pk8
PUBKEY = tools/testkey.x509.pem
ZIPS_DIRS = $(wildcard dist-*)
FILES_COMMON_ZIP = $(shell find META-INF -type f)
FILES_COMMON = $(FILES_COMMON_ZIP) $(wildcard common/*)
.SECONDEXPANSION:
.PHONY: $(ZIPS_DIRS:dist-%=clean-%)
#all: $(ZIPS_DIRS:dist-%=cm-custom-%-signed.zip)
all: $(ZIPS_DIRS:dist-%=cm-custom-%.zip)
clean: $(ZIPS_DIRS:dist-%=clean-%)
# clean targets
$(ZIPS_DIRS:dist-%=clean-%):
rm -rf $(@:clean-%=build-%) $(@:clean-%=cm-custom-%.zip) $(@:clean-%=cm-custom-%-signed.zip)
# signature targets
$(ZIPS_DIRS:dist-%=cm-custom-%-signed.zip): cm-custom-%-signed.zip : cm-custom-%.zip
java -jar tools/SignApk.jar -w -a 4 $(PUBKEY) $(PRIVKEY) $< $@
@echo "$@ is ready"
# build target
$(ZIPS_DIRS:dist-%=cm-custom-%.zip): cm-custom-%.zip : $(FILES_COMMON) $$(shell find dist-$$* -type f)
zip $@ $(FILES_COMMON_ZIP)
rm -rf build-$*
cp -a dist-$* build-$*
cd build-$* && \
sed -e '/__HEADER__/ {' -e 'r ../common/addon_head' -e 'd' -e '}' -i cm-data/*.addon && \
zip ../$@ $$(find . -type f)
rm -rf build-$*