2010-09-02 00:24:40 +00:00
|
|
|
# __________ __ ___.
|
|
|
|
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
# \/ \/ \/ \/ \/
|
|
|
|
# $Id$
|
|
|
|
#
|
|
|
|
|
2011-12-19 19:58:44 +00:00
|
|
|
PACKAGE=org.rockbox
|
|
|
|
PACKAGE_PATH=org/rockbox
|
|
|
|
BINLIB_DIR=$(BUILDDIR)/libs/armeabi
|
|
|
|
ANDROID_DIR=$(ROOTDIR)/android
|
|
|
|
|
2011-12-19 15:42:04 +00:00
|
|
|
# this is a glibc compatibility hack to provide a get_nprocs() replacement.
|
|
|
|
# The NDK ships cpu-features.c which has a compatible function android_getCpuCount()
|
2011-12-19 19:58:44 +00:00
|
|
|
CPUFEAT = $(ANDROID_DIR)/cpufeatures
|
|
|
|
CPUFEAT_BUILD = $(subst $(ANDROID_DIR),$(BUILDDIR),$(CPUFEAT))
|
2011-12-19 15:42:04 +00:00
|
|
|
INCLUDES += -I$(CPUFEAT)
|
|
|
|
OTHER_SRC += $(CPUFEAT)/cpu-features.c
|
2011-12-19 19:58:44 +00:00
|
|
|
CLEANOBJS += $(CPUFEAT_BUILD)/cpu-features.o
|
|
|
|
$(CPUFEAT_BUILD)/cpu-features.o: $(CPUFEAT)/cpu-features.c
|
|
|
|
$(SILENT)mkdir -p $(dir $@)
|
|
|
|
$(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) -o $@ -c $^ $(GCCOPTS) -Wno-unused
|
2011-12-19 15:42:04 +00:00
|
|
|
|
2010-09-02 03:40:02 +00:00
|
|
|
.SECONDEXPANSION: # $$(JAVA_OBJ) is not populated until after this
|
2010-09-02 00:24:40 +00:00
|
|
|
.SECONDEXPANSION: # $$(OBJ) is not populated until after this
|
2011-02-02 22:13:51 +00:00
|
|
|
.PHONY: apk classes clean dex dirs libs jar
|
2010-09-02 03:40:02 +00:00
|
|
|
|
2010-09-21 09:22:52 +00:00
|
|
|
# API version
|
2011-03-11 15:45:34 +00:00
|
|
|
ANDROID_PLATFORM_VERSION=11
|
2010-09-02 03:40:02 +00:00
|
|
|
ANDROID_PLATFORM=$(ANDROID_SDK_PATH)/platforms/android-$(ANDROID_PLATFORM_VERSION)
|
2010-09-21 09:22:52 +00:00
|
|
|
|
|
|
|
# android tools
|
2011-03-11 15:45:34 +00:00
|
|
|
AAPT=$(ANDROID_SDK_PATH)/platform-tools/aapt
|
|
|
|
DX=$(ANDROID_SDK_PATH)/platform-tools/dx
|
2010-09-02 03:40:02 +00:00
|
|
|
APKBUILDER=$(ANDROID_SDK_PATH)/tools/apkbuilder
|
|
|
|
ZIPALIGN=$(ANDROID_SDK_PATH)/tools/zipalign
|
2010-09-21 09:22:52 +00:00
|
|
|
KEYSTORE=$(HOME)/.android/debug.keystore
|
2011-01-24 17:06:04 +00:00
|
|
|
ADB=$(ANDROID_SDK_PATH)/platform-tools/adb
|
2010-09-02 03:40:02 +00:00
|
|
|
|
2012-01-03 21:15:21 +00:00
|
|
|
CLASSPATH := $(BUILDDIR)/bin/classes
|
|
|
|
|
2011-05-29 18:44:42 +00:00
|
|
|
MANIFEST := $(BUILDDIR)/bin/AndroidManifest.xml
|
2011-05-29 17:23:52 +00:00
|
|
|
MANIFEST_SRC := $(ANDROID_DIR)/AndroidManifest.xml
|
2010-09-02 03:40:02 +00:00
|
|
|
|
|
|
|
R_JAVA := $(BUILDDIR)/gen/$(PACKAGE_PATH)/R.java
|
2012-01-03 21:15:21 +00:00
|
|
|
R_OBJ := $(CLASSPATH)/$(PACKAGE_PATH)/R.class
|
2010-09-02 03:40:02 +00:00
|
|
|
|
2011-07-18 21:02:47 +00:00
|
|
|
JAVA_SRC := $(wildcard $(ANDROID_DIR)/src/$(PACKAGE_PATH)/*.java)
|
|
|
|
JAVA_SRC += $(wildcard $(ANDROID_DIR)/src/$(PACKAGE_PATH)/Helper/*.java)
|
2011-01-29 20:47:32 +00:00
|
|
|
JAVA_SRC += $(wildcard $(ANDROID_DIR)/src/$(PACKAGE_PATH)/widgets/*.java)
|
2011-07-18 21:02:47 +00:00
|
|
|
JAVA_SRC += $(wildcard $(ANDROID_DIR)/src/$(PACKAGE_PATH)/monitors/*.java)
|
2012-01-03 21:15:21 +00:00
|
|
|
|
|
|
|
java2class = $(addsuffix .class,$(basename $(subst $(ANDROID_DIR)/src,$(CLASSPATH),$(1))))
|
|
|
|
|
|
|
|
JAVA_OBJ := $(call java2class,$(JAVA_SRC))
|
2010-09-02 03:40:02 +00:00
|
|
|
|
2010-10-31 14:13:52 +00:00
|
|
|
|
2010-09-02 14:58:36 +00:00
|
|
|
LIBS := $(BINLIB_DIR)/$(BINARY) $(BINLIB_DIR)/libmisc.so
|
2011-05-31 21:26:18 +00:00
|
|
|
LIBS += $(addprefix $(BINLIB_DIR)/lib,$(patsubst %.codec,%.so,$(notdir $(CODECS))))
|
2012-01-03 21:15:21 +00:00
|
|
|
|
2010-09-24 12:03:15 +00:00
|
|
|
TEMP_APK := $(BUILDDIR)/bin/_rockbox.apk
|
|
|
|
TEMP_APK2 := $(BUILDDIR)/bin/__rockbox.apk
|
2010-09-12 16:35:02 +00:00
|
|
|
DEX := $(BUILDDIR)/bin/classes.dex
|
2011-02-02 22:13:51 +00:00
|
|
|
JAR := $(BUILDDIR)/bin/classes.jar
|
2010-09-12 16:35:02 +00:00
|
|
|
AP_ := $(BUILDDIR)/bin/resources.ap_
|
2010-09-24 12:03:15 +00:00
|
|
|
APK := $(BUILDDIR)/rockbox.apk
|
2010-09-02 03:40:02 +00:00
|
|
|
|
2010-09-02 14:58:36 +00:00
|
|
|
_DIRS := $(BUILDDIR)/___/$(PACKAGE_PATH)
|
|
|
|
DIRS += $(subst ___,gen,$(_DIRS))
|
|
|
|
DIRS += $(subst ___,data,$(_DIRS))
|
|
|
|
DIRS += $(BUILDDIR)/libs/armeabi
|
2011-12-19 19:58:44 +00:00
|
|
|
DIRS += $(CPUFEAT_BUILD)
|
2012-01-03 21:15:21 +00:00
|
|
|
DIRS += $(CLASSPATH)
|
2010-09-02 14:58:36 +00:00
|
|
|
|
2010-11-06 02:02:54 +00:00
|
|
|
RES := $(wildcard $(ANDROID_DIR)/res/*/*)
|
|
|
|
|
2010-09-24 12:03:15 +00:00
|
|
|
CLEANOBJS += bin gen libs data
|
|
|
|
|
2012-01-03 21:15:21 +00:00
|
|
|
JAVAC_OPTS += -implicit:none -classpath $(ANDROID_PLATFORM)/android.jar:$(CLASSPATH)
|
2011-02-02 13:57:01 +00:00
|
|
|
|
2011-05-29 17:23:52 +00:00
|
|
|
.PHONY:
|
2011-05-29 18:44:42 +00:00
|
|
|
$(MANIFEST): $(MANIFEST_SRC) $(DIRS)
|
2011-06-04 10:36:34 +00:00
|
|
|
$(call PRINTS,MANIFEST $(@F))sed -e 's/versionName="1.0"/versionName="$(SVNVERSION)"/;s/screenOrientation="portrait"/screenOrientation="$(LCDORIENTATION)"/' $(MANIFEST_SRC) > $(MANIFEST)
|
2011-05-29 17:23:52 +00:00
|
|
|
|
2011-02-02 23:10:51 +00:00
|
|
|
$(R_JAVA) $(AP_): $(MANIFEST) $(RES) | $(DIRS)
|
2010-09-21 09:22:52 +00:00
|
|
|
$(call PRINTS,AAPT $(subst $(BUILDDIR)/,,$@))$(AAPT) package -f -m \
|
|
|
|
-J $(BUILDDIR)/gen -M $(MANIFEST) -S $(ANDROID_DIR)/res \
|
|
|
|
-I $(ANDROID_PLATFORM)/android.jar -F $(AP_)
|
2010-09-02 03:40:02 +00:00
|
|
|
|
2012-01-03 21:15:21 +00:00
|
|
|
$(CLASSPATH)/$(PACKAGE_PATH)/R.class: $(R_JAVA)
|
2010-09-02 14:58:36 +00:00
|
|
|
$(call PRINTS,JAVAC $(subst $(ROOTDIR)/,,$<))javac -d $(BUILDDIR)/bin \
|
2012-01-03 21:15:21 +00:00
|
|
|
$(JAVAC_OPTS) -sourcepath $(ANDROID_DIR)/gen $<
|
2010-09-02 03:40:02 +00:00
|
|
|
|
2012-01-03 21:15:21 +00:00
|
|
|
$(CLASSPATH)/$(PACKAGE_PATH)/%.class: $(ANDROID_DIR)/src/$(PACKAGE_PATH)/%.java $(CLASSPATH)/$(PACKAGE_PATH)/R.class
|
|
|
|
$(call PRINTS,JAVAC $(subst $(ROOTDIR)/,,$<))javac -d $(CLASSPATH) \
|
|
|
|
$(JAVAC_OPTS) -sourcepath $(ANDROID_DIR)/src $<
|
2010-09-02 03:40:02 +00:00
|
|
|
|
2011-02-02 22:13:51 +00:00
|
|
|
$(JAR): $(JAVA_SRC) $(R_JAVA)
|
2012-01-03 21:15:21 +00:00
|
|
|
$(call PRINTS,JAVAC $(subst $(ROOTDIR)/,,$?))javac -d $(CLASSPATH) \
|
|
|
|
$(JAVAC_OPTS) -sourcepath $(ANDROID_DIR)/src:$(ANDROID_DIR)/gen $?
|
|
|
|
$(call PRINTS,JAR $(subst $(BUILDDIR)/,,$@))jar cf $(JAR) -C $(CLASSPATH) org
|
2010-09-02 03:40:02 +00:00
|
|
|
|
2011-02-02 22:13:51 +00:00
|
|
|
jar: $(JAR)
|
|
|
|
|
|
|
|
$(DEX): $(JAR)
|
|
|
|
@echo "Checking for deleted class files" && $(foreach obj,$(JAVA_OBJ) $(R_OBJ), \
|
|
|
|
(test -f $(obj) || (echo "$(obj) is missing. Run 'make classes' to fix." && false)) && ) true
|
|
|
|
$(call PRINTS,DX $(subst $(BUILDDIR)/,,$@))$(DX) --dex --output=$@ $<
|
2010-09-12 16:35:02 +00:00
|
|
|
|
|
|
|
dex: $(DEX)
|
2010-09-02 03:40:02 +00:00
|
|
|
|
2011-02-02 22:13:51 +00:00
|
|
|
classes: $(R_OBJ) $(JAVA_OBJ)
|
|
|
|
|
2011-12-19 15:42:04 +00:00
|
|
|
|
2012-03-18 12:37:49 +00:00
|
|
|
$(BUILDDIR)/$(BINARY): $$(OBJ) $(VOICESPEEXLIB) $(FIRMLIB) $(RBCODEC_LIB) $(SKINLIB) $(UNWARMINDER) $(CPUFEAT_BUILD)/cpu-features.o
|
2012-01-17 14:08:08 +00:00
|
|
|
$(call PRINTS,LD $(BINARY))$(CC) -o $@ $^ $(LDOPTS) $(GLOBAL_LDOPTS) -Wl,-Map,$(BUILDDIR)/rockbox.map
|
2012-01-03 21:15:11 +00:00
|
|
|
$(call PRINTS,OC $(@F))$(OC) -S -x $@
|
2011-12-19 15:42:04 +00:00
|
|
|
|
2010-09-02 14:58:36 +00:00
|
|
|
$(BINLIB_DIR)/$(BINARY): $(BUILDDIR)/$(BINARY)
|
2010-09-02 03:40:02 +00:00
|
|
|
$(call PRINTS,CP $(BINARY))cp $^ $@
|
|
|
|
|
2010-09-22 20:58:54 +00:00
|
|
|
$(BINLIB_DIR)/libmisc.so: $(BUILDDIR)/rockbox.zip
|
2010-09-02 03:40:02 +00:00
|
|
|
$(call PRINTS,CP rockbox.zip)cp $^ $@
|
|
|
|
|
2011-05-31 21:26:18 +00:00
|
|
|
$(BINLIB_DIR)/lib%.so: $(BUILDDIR)/apps/codecs/%.codec
|
|
|
|
$(call PRINTS,CP $(@F))cp $^ $@
|
|
|
|
|
2012-01-03 21:15:21 +00:00
|
|
|
libs: $(DIRS) $(LIBS)
|
2010-09-02 03:40:02 +00:00
|
|
|
|
2011-02-02 23:10:51 +00:00
|
|
|
$(TEMP_APK): $(AP_) $(LIBS) $(DEX) | $(DIRS)
|
2010-09-02 03:40:02 +00:00
|
|
|
$(call PRINTS,APK $(subst $(BUILDDIR)/,,$@))$(APKBUILDER) $@ \
|
2010-09-12 16:35:02 +00:00
|
|
|
-u -z $(AP_) -f $(DEX) -nf $(BUILDDIR)/libs
|
2010-09-02 03:40:02 +00:00
|
|
|
|
2010-09-21 09:22:52 +00:00
|
|
|
$(KEYSTORE):
|
2011-04-21 09:35:35 +00:00
|
|
|
$(SILENT)mkdir -p $(HOME)/.android
|
2010-09-21 09:22:52 +00:00
|
|
|
$(call PRINTS,KEYTOOL debug.keystore)keytool -genkey \
|
|
|
|
-alias androiddebugkey -keystore $@ \
|
|
|
|
-storepass android -keypass android -validity 365 \
|
|
|
|
-dname "CN=Android Debug,O=Android,C=US"
|
|
|
|
|
2011-06-22 14:14:49 +00:00
|
|
|
ifdef NODEPS
|
|
|
|
$(APK): $(TEMP_APK) $(KEYSTORE)
|
|
|
|
else
|
2010-09-21 09:22:52 +00:00
|
|
|
$(APK): $(TEMP_APK) $(BUILDDIR)/rockbox.zip $(KEYSTORE)
|
2011-06-22 14:14:49 +00:00
|
|
|
endif
|
2010-09-02 03:40:02 +00:00
|
|
|
$(SILENT)rm -f $@
|
|
|
|
$(call PRINTS,SIGN $(subst $(BUILDDIR)/,,$@))jarsigner \
|
2010-09-21 09:22:52 +00:00
|
|
|
-keystore "$(KEYSTORE)" -storepass "android" -keypass "android" \
|
|
|
|
-signedjar $(TEMP_APK2) $(TEMP_APK) "androiddebugkey"
|
2010-09-02 14:58:36 +00:00
|
|
|
$(SILENT)$(ZIPALIGN) -v 4 $(TEMP_APK2) $@ > /dev/null
|
|
|
|
|
2010-09-12 20:50:30 +00:00
|
|
|
$(DIRS):
|
|
|
|
$(SILENT)mkdir -p $@
|
2010-09-02 03:40:02 +00:00
|
|
|
|
2010-09-12 20:50:30 +00:00
|
|
|
dirs: $(DIRS)
|
|
|
|
|
2010-09-21 09:22:52 +00:00
|
|
|
apk: $(APK)
|
2011-01-24 17:06:04 +00:00
|
|
|
|
|
|
|
install: apk
|
2011-03-11 15:45:55 +00:00
|
|
|
$(SILENT)$(ADB) install -r $(APK)
|
2011-01-24 17:06:04 +00:00
|
|
|
|
2011-03-11 15:45:55 +00:00
|
|
|
launch:
|
|
|
|
$(SILENT)echo 'am start -a android.intent.action.MAIN -n org.rockbox/.RockboxActivity; exit' | $(ADB) shell >/dev/null
|