2010-09-02 00:24:40 +00:00
|
|
|
# __________ __ ___.
|
|
|
|
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
# \/ \/ \/ \/ \/
|
|
|
|
# $Id$
|
|
|
|
#
|
|
|
|
|
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()
|
|
|
|
CPUFEAT = /home/kugel/share/android-ndk-r6/sources/android/cpufeatures
|
|
|
|
INCLUDES += -I$(CPUFEAT)
|
|
|
|
OTHER_SRC += $(CPUFEAT)/cpu-features.c
|
|
|
|
$(BUILDDIR)/cpu-features.o: $(CPUFEAT)/cpu-features.c
|
|
|
|
$(call PRINTS,CC $(subst $(ANDROID_NDK_PATH)/,,$<))$(CC) -o $@ -c $^ \
|
|
|
|
$(GCCOPTS) -Wno-unused
|
|
|
|
|
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
|
|
|
|
|
|
|
PACKAGE=org.rockbox
|
|
|
|
PACKAGE_PATH=org/rockbox
|
|
|
|
ANDROID_DIR=$(ROOTDIR)/android
|
2010-09-02 14:58:36 +00:00
|
|
|
BINLIB_DIR=$(BUILDDIR)/libs/armeabi
|
2010-09-02 03:40:02 +00:00
|
|
|
|
|
|
|
java2class = $(addsuffix .class,$(basename $(subst $(ANDROID_DIR),$(BUILDDIR),$(1))))
|
|
|
|
|
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
|
|
|
|
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
|
|
|
|
R_OBJ := $(BUILDDIR)/bin/$(PACKAGE_PATH)/R.class
|
|
|
|
|
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)
|
2010-09-20 22:04:32 +00:00
|
|
|
JAVA_OBJ := $(call java2class,$(subst $(ANDROID)/src/$(PACKAGE_PATH),$(ANDROID)/bin/$(PACKAGE_PATH),$(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))))
|
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 ___,bin,$(_DIRS))
|
|
|
|
DIRS += $(subst ___,gen,$(_DIRS))
|
|
|
|
DIRS += $(subst ___,data,$(_DIRS))
|
|
|
|
DIRS += $(BUILDDIR)/libs/armeabi
|
|
|
|
|
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
|
|
|
|
|
2011-02-02 13:57:01 +00:00
|
|
|
JAVAC_OPTS += -implicit:none -classpath $(ANDROID_PLATFORM)/android.jar:$(BUILDDIR)/bin
|
|
|
|
|
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
|
|
|
|
|
|
|
$(BUILDDIR)/bin/$(PACKAGE_PATH)/R.class: $(R_JAVA)
|
2010-09-02 14:58:36 +00:00
|
|
|
$(call PRINTS,JAVAC $(subst $(ROOTDIR)/,,$<))javac -d $(BUILDDIR)/bin \
|
2011-02-02 13:57:01 +00:00
|
|
|
$(JAVAC_OPTS) \
|
|
|
|
-sourcepath $(ANDROID_DIR)/gen $<
|
2010-09-02 03:40:02 +00:00
|
|
|
|
2011-01-24 17:06:04 +00:00
|
|
|
$(BUILDDIR)/bin/$(PACKAGE_PATH)/%.class: $(ANDROID_DIR)/src/$(PACKAGE_PATH)/%.java $(BUILDDIR)/bin/$(PACKAGE_PATH)/R.class
|
2010-09-02 14:58:36 +00:00
|
|
|
$(call PRINTS,JAVAC $(subst $(ROOTDIR)/,,$<))javac -d $(BUILDDIR)/bin \
|
2011-02-02 13:57:01 +00:00
|
|
|
$(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)
|
|
|
|
$(call PRINTS,JAVAC $(subst $(ROOTDIR)/,,$?))javac -d $(BUILDDIR)/bin \
|
|
|
|
$(JAVAC_OPTS) \
|
|
|
|
-sourcepath $(ANDROID_DIR)/src:$(ANDROID_DIR)/gen $?
|
|
|
|
$(call PRINTS,JAR $(subst $(BUILDDIR)/,,$@))jar cf $(JAR) -C $(BUILDDIR)/bin 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
|
|
|
|
|
|
|
$(BUILDDIR)/$(BINARY): $$(OBJ) $(VOICESPEEXLIB) $(FIRMLIB) $(SKINLIB) $(BUILDDIR)/cpu-features.o
|
|
|
|
$(call PRINTS,LD $(BINARY))$(CC) -o $@ $^ $(LDOPTS) $(GLOBAL_LDOPTS)
|
|
|
|
|
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 $^ $@
|
|
|
|
|
2010-09-02 03:40:02 +00:00
|
|
|
libs: $(LIBS)
|
|
|
|
|
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
|