fix tidycache command
[opengapps/opengapps.git] / Makefile
blob2286cfa1bbee2ca1322832702a3caac3ecf1cc9f
1 #This file is part of The Open GApps script of @mfonville.
3 # The Open GApps scripts are free software: you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation, either version 3 of the License, or
6 # (at your option) any later version.
8 # These scripts are distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 TOPDIR := .
14 BUILD_SYSTEM := $(TOPDIR)/scripts
15 BUILD_GAPPS := $(BUILD_SYSTEM)/build_gapps.sh
16 APIS := 19 21 22 23 24 25 26 27
17 PLATFORMS := arm arm64 x86 x86_64
18 LOWEST_API_arm := 19
19 LOWEST_API_arm64 := 21
20 LOWEST_API_x86 := 19
21 LOWEST_API_x86_64 := 21
22 VARIANTS := super stock full mini micro nano pico aroma tvstock
23 BUILDDIR := $(TOPDIR)/build
24 CACHEDIR := $(TOPDIR)/cache
25 OUTDIR := $(TOPDIR)/out
26 LOGDIR := $(TOPDIR)/log
28 define make-gapps
29 #We first define 'all' so that this is the primary make target
30 all:: $1
32 #With this you can always call e.g. 'make arm-22' or 'make arm-22-stock'
33 #to make the arm (stock) package for 5.1
34 #It will execute the build script with the platform, api (and variant) as parameter,
35 #meanwhile ensuring the minimum api for the platform that is selected
36 $1:
37 $(platform = $(firstword $(subst -, ,$1)))
38 $(api = $(word 2, $(subst -, ,$1)))
39 $(variant = $(word 3, $(subst -, ,$1)))
40 @if [ "$(api)" -ge "$(LOWEST_API_$(platform))" ] && [ -n "$(variant)" ] ; then\
41 $(BUILD_GAPPS) $(platform) $(api) $(variant) 2>&1;\
42 elif [ "$(api)" -ge "$(LOWEST_API_$(platform))" ] && [ -z "$(variant)" ] ; then\
43 for variant in $(VARIANTS);do\
44 $(BUILD_GAPPS) $(platform) $(api) $$$$variant 2>&1;\
45 done;\
46 else\
47 echo "Illegal combination of Platform and API";\
48 fi;\
49 exit 0
50 endef
52 $(foreach platform,$(PLATFORMS),\
53 $(foreach api,$(APIS),\
54 $(foreach variant,$(VARIANTS),\
55 $(eval $(call make-gapps,$(platform)-$(api)-$(variant)))\
56 )))
58 $(foreach platform,$(PLATFORMS),\
59 $(foreach api,$(APIS),\
60 $(eval $(call make-gapps,$(platform)-$(api)))\
63 tidycache:
64 @test -d "$(CACHEDIR)" && find "$(CACHEDIR)/" -type f -atime +7 -exec rm {} \; || echo "No cache found"
65 @echo "$(tput setaf 2)Cache cleaned, archives not used for 7 days removed!$(tput sgr 0)"
67 clean:
68 @rm -fr "$(BUILDDIR)"
69 @rm -fr "$(LOGDIR)"
70 @echo "$(tput setaf 2)Build & log directory removed!$(tput sgr 0)"
72 distclean: clean
73 @rm -fr "$(CACHEDIR)"
74 @echo "$(tput setaf 2)Cache directory removed!$(tput sgr 0)"