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