2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 .SECONDEXPANSION
: # $$(JAVA_OBJ) is not populated until after this
11 .SECONDEXPANSION
: # $$(OBJ) is not populated until after this
12 .PHONY
: apk classes
clean dex dirs libs
14 $(BUILDDIR
)/$(BINARY
): $$(OBJ
) $(VOICESPEEXLIB
) $(FIRMLIB
) $(SKINLIB
)
15 $(call PRINTS
,LD
$(BINARY
))$(CC
) -o
$@
$^
$(LDOPTS
) $(GLOBAL_LDOPTS
)
18 PACKAGE_PATH
=org
/rockbox
19 ANDROID_DIR
=$(ROOTDIR
)/android
20 BINLIB_DIR
=$(BUILDDIR
)/libs
/armeabi
22 java2class
= $(addsuffix .class
,$(basename $(subst $(ANDROID_DIR
),$(BUILDDIR
),$(1))))
25 ANDROID_PLATFORM_VERSION
=8
26 ANDROID_PLATFORM
=$(ANDROID_SDK_PATH
)/platforms
/android-
$(ANDROID_PLATFORM_VERSION
)
29 AAPT
=$(ANDROID_PLATFORM
)/tools
/aapt
30 DX
=$(ANDROID_PLATFORM
)/tools
/dx
31 APKBUILDER
=$(ANDROID_SDK_PATH
)/tools
/apkbuilder
32 ZIPALIGN
=$(ANDROID_SDK_PATH
)/tools
/zipalign
33 KEYSTORE
=$(HOME
)/.android
/debug.keystore
35 MANIFEST
:= $(ANDROID_DIR
)/AndroidManifest.xml
37 R_JAVA
:= $(BUILDDIR
)/gen
/$(PACKAGE_PATH
)/R.java
38 R_OBJ
:= $(BUILDDIR
)/bin
/$(PACKAGE_PATH
)/R.class
40 JAVA_SRC
:= $(wildcard $(ANDROID_DIR
)/src
/$(PACKAGE_PATH
)/Helper
/*.java
)
41 JAVA_SRC
+= $(wildcard $(ANDROID_DIR
)/src
/$(PACKAGE_PATH
)/*.java
)
42 JAVA_OBJ
:= $(call java2class
,$(subst $(ANDROID
)/src
/$(PACKAGE_PATH
),$(ANDROID
)/bin
/$(PACKAGE_PATH
),$(JAVA_SRC
)))
45 LIBS
:= $(BINLIB_DIR
)/$(BINARY
) $(BINLIB_DIR
)/libmisc.so
46 TEMP_APK
:= $(BUILDDIR
)/bin
/_rockbox.apk
47 TEMP_APK2
:= $(BUILDDIR
)/bin
/__rockbox.apk
48 DEX
:= $(BUILDDIR
)/bin
/classes.dex
49 AP_
:= $(BUILDDIR
)/bin
/resources.ap_
50 APK
:= $(BUILDDIR
)/rockbox.apk
52 _DIRS
:= $(BUILDDIR
)/___
/$(PACKAGE_PATH
)
53 DIRS
:= $(subst ___
,bin
,$(_DIRS
))
54 DIRS
+= $(subst ___
,gen
,$(_DIRS
))
55 DIRS
+= $(subst ___
,data
,$(_DIRS
))
56 DIRS
+= $(BUILDDIR
)/libs
/armeabi
58 RES
:= $(wildcard $(ANDROID_DIR
)/res
/*/*)
60 CLEANOBJS
+= bin gen libs data
62 $(R_JAVA
) $(AP_
): $(MANIFEST
) $(DIRS
) $(RES
)
63 $(call PRINTS
,AAPT
$(subst $(BUILDDIR
)/,,$@
))$(AAPT
) package
-f
-m \
64 -J
$(BUILDDIR
)/gen
-M
$(MANIFEST
) -S
$(ANDROID_DIR
)/res \
65 -I
$(ANDROID_PLATFORM
)/android.jar
-F
$(AP_
)
67 $(BUILDDIR
)/bin
/$(PACKAGE_PATH
)/R.class
: $(R_JAVA
)
68 $(call PRINTS
,JAVAC
$(subst $(ROOTDIR
)/,,$<))javac
-d
$(BUILDDIR
)/bin \
69 -classpath
$(ANDROID_PLATFORM
)/android.jar
:$(BUILDDIR
)/bin \
70 -sourcepath
$(ANDROID_DIR
)/gen
:$(ANDROID_DIR
)/src
$<
72 $(BUILDDIR
)/bin
/$(PACKAGE_PATH
)/%.class
: $(ANDROID_DIR
)/src
/$(PACKAGE_PATH
)/%.java
73 $(call PRINTS
,JAVAC
$(subst $(ROOTDIR
)/,,$<))javac
-d
$(BUILDDIR
)/bin \
74 -classpath
$(ANDROID_PLATFORM
)/android.jar
:$(BUILDDIR
)/bin \
75 -sourcepath
$(ANDROID_DIR
)/gen
:$(ANDROID_DIR
)/src
$<
77 $(DEX
): $(R_OBJ
) $(JAVA_OBJ
)
78 $(call PRINTS
,DX
$(subst $(BUILDDIR
)/,,$@
))$(DX
) --dex
--output
=$@
$(BUILDDIR
)/bin
80 classes
: $(R_OBJ
) $(JAVA_OBJ
)
84 $(BINLIB_DIR
)/$(BINARY
): $(BUILDDIR
)/$(BINARY
)
85 $(call PRINTS
,CP
$(BINARY
))cp
$^
$@
87 $(BINLIB_DIR
)/libmisc.so
: $(BUILDDIR
)/rockbox.zip
88 $(call PRINTS
,CP rockbox.zip
)cp
$^
$@
92 $(TEMP_APK
): $(AP_
) $(DIRS
) $(LIBS
) $(DEX
)
93 $(call PRINTS
,APK
$(subst $(BUILDDIR
)/,,$@
))$(APKBUILDER
) $@ \
94 -u
-z
$(AP_
) -f
$(DEX
) -nf
$(BUILDDIR
)/libs
97 $(call PRINTS
,KEYTOOL debug.keystore
)keytool
-genkey \
98 -alias androiddebugkey
-keystore
$@ \
99 -storepass android
-keypass android
-validity
365 \
100 -dname
"CN=Android Debug,O=Android,C=US"
102 $(APK
): $(TEMP_APK
) $(BUILDDIR
)/rockbox.zip
$(KEYSTORE
)
104 $(call PRINTS
,SIGN
$(subst $(BUILDDIR
)/,,$@
))jarsigner \
105 -keystore
"$(KEYSTORE)" -storepass
"android" -keypass
"android" \
106 -signedjar
$(TEMP_APK2
) $(TEMP_APK
) "androiddebugkey"
107 $(SILENT
)$(ZIPALIGN
) -v
4 $(TEMP_APK2
) $@
> /dev
/null