move lineageos pixel stuff to the correct zib
[projets/cm-custom.git] / Makefile
1 PRIVKEY = tools/testkey.pk8
2 PUBKEY = tools/testkey.x509.pem
3
4 ZIPS_DIRS = $(wildcard dist-*)
5 FILES_COMMON_ZIP = $(shell find META-INF -type f)
6 FILES_COMMON = $(FILES_COMMON_ZIP) $(wildcard common/*)
7
8 .SECONDEXPANSION:
9 .PHONY: $(ZIPS_DIRS:dist-%=clean-%)
10
11 #all: $(ZIPS_DIRS:dist-%=cm-custom-%-signed.zip)
12 all: $(ZIPS_DIRS:dist-%=cm-custom-%.zip)
13
14 clean: $(ZIPS_DIRS:dist-%=clean-%)
15
16 # clean targets
17 $(ZIPS_DIRS:dist-%=clean-%):
18         rm -rf $(@:clean-%=build-%) $(@:clean-%=cm-custom-%.zip) $(@:clean-%=cm-custom-%-signed.zip)
19
20 # signature targets
21 $(ZIPS_DIRS:dist-%=cm-custom-%-signed.zip): cm-custom-%-signed.zip : cm-custom-%.zip
22         java -jar tools/SignApk.jar -w -a 4 $(PUBKEY) $(PRIVKEY) $< $@
23         @echo "$@ is ready"
24
25 # build target
26 $(ZIPS_DIRS:dist-%=cm-custom-%.zip): cm-custom-%.zip : $(FILES_COMMON) $$(shell find dist-$$* -type f)
27         zip $@ $(FILES_COMMON_ZIP)
28         rm -rf build-$*
29         cp -a dist-$* build-$*
30         cd build-$* && \
31                 sed -e '/__HEADER__/ {' -e 'r ../common/addon_head' -e 'd' -e '}' -i cm-data/*.addon && \
32                 zip ../$@ $$(find . -type f)
33         rm -rf build-$*
34