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
)/*.java
)
41 JAVA_OBJ
:= $(call java2class
,$(subst $(ANDROID
)/src
/$(PACKAGE_PATH
),$(ANDROID
)/bin
/$(PACKAGE_PATH
),$(JAVA_SRC
)))
43 LIBS
:= $(BINLIB_DIR
)/$(BINARY
) $(BINLIB_DIR
)/libmisc.so
44 TEMP_APK
:= $(BUILDDIR
)/bin
/_rockbox.apk
45 TEMP_APK2
:= $(BUILDDIR
)/bin
/__rockbox.apk
46 DEX
:= $(BUILDDIR
)/bin
/classes.dex
47 AP_
:= $(BUILDDIR
)/bin
/resources.ap_
48 APK
:= $(BUILDDIR
)/rockbox.apk
50 _DIRS
:= $(BUILDDIR
)/___
/$(PACKAGE_PATH
)
51 DIRS
:= $(subst ___
,bin
,$(_DIRS
))
52 DIRS
+= $(subst ___
,gen
,$(_DIRS
))
53 DIRS
+= $(subst ___
,data
,$(_DIRS
))
54 DIRS
+= $(BUILDDIR
)/libs
/armeabi
56 CLEANOBJS
+= bin gen libs data
58 $(R_JAVA
) $(AP_
): $(MANIFEST
)
59 $(call PRINTS
,AAPT
$(subst $(BUILDDIR
)/,,$@
))$(AAPT
) package
-f
-m \
60 -J
$(BUILDDIR
)/gen
-M
$(MANIFEST
) -S
$(ANDROID_DIR
)/res \
61 -I
$(ANDROID_PLATFORM
)/android.jar
-F
$(AP_
)
63 $(BUILDDIR
)/bin
/$(PACKAGE_PATH
)/R.class
: $(R_JAVA
)
64 $(call PRINTS
,JAVAC
$(subst $(ROOTDIR
)/,,$<))javac
-d
$(BUILDDIR
)/bin \
65 -classpath
$(ANDROID_PLATFORM
)/android.jar
:$(BUILDDIR
)/bin \
66 -sourcepath
$(ANDROID_DIR
)/gen
:$(ANDROID_DIR
)/src
$<
68 $(BUILDDIR
)/bin
/$(PACKAGE_PATH
)/%.class
: $(ANDROID_DIR
)/src
/$(PACKAGE_PATH
)/%.java
69 $(call PRINTS
,JAVAC
$(subst $(ROOTDIR
)/,,$<))javac
-d
$(BUILDDIR
)/bin \
70 -classpath
$(ANDROID_PLATFORM
)/android.jar
:$(BUILDDIR
)/bin \
71 -sourcepath
$(ANDROID_DIR
)/gen
:$(ANDROID_DIR
)/src
$<
73 $(DEX
): $(R_OBJ
) $(JAVA_OBJ
)
74 $(call PRINTS
,DX
$(subst $(BUILDDIR
)/,,$@
))$(DX
) --dex
--output
=$@
$(BUILDDIR
)/bin
76 classes
: $(R_OBJ
) $(JAVA_OBJ
)
80 $(BINLIB_DIR
)/$(BINARY
): $(BUILDDIR
)/$(BINARY
)
81 $(call PRINTS
,CP
$(BINARY
))cp
$^
$@
83 $(BINLIB_DIR
)/libmisc.so
: $(BUILDDIR
)/rockbox.zip
84 $(call PRINTS
,CP rockbox.zip
)cp
$^
$@
88 $(TEMP_APK
): $(DIRS
) $(LIBS
) $(DEX
)
89 $(call PRINTS
,APK
$(subst $(BUILDDIR
)/,,$@
))$(APKBUILDER
) $@ \
90 -u
-z
$(AP_
) -f
$(DEX
) -nf
$(BUILDDIR
)/libs
93 $(call PRINTS
,KEYTOOL debug.keystore
)keytool
-genkey \
94 -alias androiddebugkey
-keystore
$@ \
95 -storepass android
-keypass android
-validity
365 \
96 -dname
"CN=Android Debug,O=Android,C=US"
98 $(APK
): $(TEMP_APK
) $(BUILDDIR
)/rockbox.zip
$(KEYSTORE
)
100 $(call PRINTS
,SIGN
$(subst $(BUILDDIR
)/,,$@
))jarsigner \
101 -keystore
"$(KEYSTORE)" -storepass
"android" -keypass
"android" \
102 -signedjar
$(TEMP_APK2
) $(TEMP_APK
) "androiddebugkey"
103 $(SILENT
)$(ZIPALIGN
) -v
4 $(TEMP_APK2
) $@
> /dev
/null