Polished the makefile a bit.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28138 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Björn Stenberg 2010-09-21 09:22:52 +00:00
parent 2dde958478
commit 40e61a70e3
2 changed files with 25 additions and 24 deletions

View file

@ -20,16 +20,10 @@ Use this as your build folder, using '../tools/configure' etc.
$ ../tools/configure # type 200, then chose A for android and your screen resolution $ ../tools/configure # type 200, then chose A for android and your screen resolution
$ make $ make
After the build finished, build the zip file: After the build finished, build the apk file:
$ make zip
Create a debug signing key:
$ keytool -genkey -alias androiddebugkey -keystore $HOME/.android/debug.keystore -storepass android -keypass android -validity 365 -dname "CN=Android Debug,O=Android,C=US"
Then, you can create a Rockbox.apk which ends up in bin/
$ make apk $ make apk
You can install that on the device: You can install that on your device or emulator with the following command:
$ $ANDROID_SDK_PATH/tools/adb install -r bin/Rockbox.apk $ $ANDROID_SDK_PATH/tools/adb install -r bin/Rockbox.apk

View file

@ -19,17 +19,18 @@ PACKAGE_PATH=org/rockbox
ANDROID_DIR=$(ROOTDIR)/android ANDROID_DIR=$(ROOTDIR)/android
BINLIB_DIR=$(BUILDDIR)/libs/armeabi BINLIB_DIR=$(BUILDDIR)/libs/armeabi
java2class = $(addsuffix .class,$(basename $(subst $(ANDROID_DIR),$(BUILDDIR),$(1)))) java2class = $(addsuffix .class,$(basename $(subst $(ANDROID_DIR),$(BUILDDIR),$(1))))
# API version
ANDROID_PLATFORM_VERSION=8 ANDROID_PLATFORM_VERSION=8
ANDROID_PLATFORM=$(ANDROID_SDK_PATH)/platforms/android-$(ANDROID_PLATFORM_VERSION) ANDROID_PLATFORM=$(ANDROID_SDK_PATH)/platforms/android-$(ANDROID_PLATFORM_VERSION)
# android tools
AAPT=$(ANDROID_PLATFORM)/tools/aapt AAPT=$(ANDROID_PLATFORM)/tools/aapt
DX=$(ANDROID_PLATFORM)/tools/dx DX=$(ANDROID_PLATFORM)/tools/dx
APKBUILDER=$(ANDROID_SDK_PATH)/tools/apkbuilder APKBUILDER=$(ANDROID_SDK_PATH)/tools/apkbuilder
ZIPALIGN=$(ANDROID_SDK_PATH)/tools/zipalign ZIPALIGN=$(ANDROID_SDK_PATH)/tools/zipalign
KEYSTORE=$(HOME)/.android/debug.keystore
MANIFEST := $(ANDROID_DIR)/AndroidManifest.xml MANIFEST := $(ANDROID_DIR)/AndroidManifest.xml
@ -53,17 +54,19 @@ DIRS += $(subst ___,data,$(_DIRS))
DIRS += $(BUILDDIR)/libs/armeabi DIRS += $(BUILDDIR)/libs/armeabi
$(R_JAVA) $(AP_): $(MANIFEST) $(R_JAVA) $(AP_): $(MANIFEST)
$(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_) $(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_)
$(BUILDDIR)/bin/$(PACKAGE_PATH)/R.class: $(R_JAVA) $(BUILDDIR)/bin/$(PACKAGE_PATH)/R.class: $(R_JAVA)
$(call PRINTS,JAVAC $(subst $(ROOTDIR)/,,$<))javac -d $(BUILDDIR)/bin \ $(call PRINTS,JAVAC $(subst $(ROOTDIR)/,,$<))javac -d $(BUILDDIR)/bin \
-classpath $(ANDROID_PLATFORM)/android.jar:$(BUILDDIR)/bin -sourcepath \ -classpath $(ANDROID_PLATFORM)/android.jar:$(BUILDDIR)/bin \
$(ANDROID_DIR)/gen:$(ANDROID_DIR)/src $< -sourcepath $(ANDROID_DIR)/gen:$(ANDROID_DIR)/src $<
$(BUILDDIR)/bin/$(PACKAGE_PATH)/%.class: $(ANDROID_DIR)/src/$(PACKAGE_PATH)/%.java $(BUILDDIR)/bin/$(PACKAGE_PATH)/%.class: $(ANDROID_DIR)/src/$(PACKAGE_PATH)/%.java
$(call PRINTS,JAVAC $(subst $(ROOTDIR)/,,$<))javac -d $(BUILDDIR)/bin \ $(call PRINTS,JAVAC $(subst $(ROOTDIR)/,,$<))javac -d $(BUILDDIR)/bin \
-classpath $(ANDROID_PLATFORM)/android.jar:$(BUILDDIR)/bin -sourcepath \ -classpath $(ANDROID_PLATFORM)/android.jar:$(BUILDDIR)/bin \
$(ANDROID_DIR)/gen:$(ANDROID_DIR)/src $< -sourcepath $(ANDROID_DIR)/gen:$(ANDROID_DIR)/src $<
$(DEX): $(R_OBJ) $(JAVA_OBJ) $(DEX): $(R_OBJ) $(JAVA_OBJ)
$(call PRINTS,DX $(subst $(BUILDDIR)/,,$@))$(DX) --dex --output=$@ $(BUILDDIR)/bin $(call PRINTS,DX $(subst $(BUILDDIR)/,,$@))$(DX) --dex --output=$@ $(BUILDDIR)/bin
@ -75,32 +78,36 @@ dex: $(DEX)
$(BINLIB_DIR)/$(BINARY): $(BUILDDIR)/$(BINARY) $(BINLIB_DIR)/$(BINARY): $(BUILDDIR)/$(BINARY)
$(call PRINTS,CP $(BINARY))cp $^ $@ $(call PRINTS,CP $(BINARY))cp $^ $@
$(BUILDDIR)/rockbox.zip: $(BUILDDIR)/rockbox.zip: zip
$(BINLIB_DIR)/libmisc.so: $(BUILDDIR)/rockbox.zip $(BINLIB_DIR)/libmisc.so: $(BUILDDIR)/rockbox.zip
$(call PRINTS,CP rockbox.zip)cp $^ $@ $(call PRINTS,CP rockbox.zip)cp $^ $@
libs: $(LIBS) libs: $(LIBS)
$(TEMP_APK): $(LIBS) $(DEX) $(TEMP_APK): $(DIRS) $(LIBS) $(DEX)
$(call PRINTS,APK $(subst $(BUILDDIR)/,,$@))$(APKBUILDER) $@ \ $(call PRINTS,APK $(subst $(BUILDDIR)/,,$@))$(APKBUILDER) $@ \
-u -z $(AP_) -f $(DEX) -nf $(BUILDDIR)/libs -u -z $(AP_) -f $(DEX) -nf $(BUILDDIR)/libs
$(APK): $(TEMP_APK) $(KEYSTORE):
$(call PRINTS,KEYTOOL debug.keystore)keytool -genkey \
-alias androiddebugkey -keystore $@ \
-storepass android -keypass android -validity 365 \
-dname "CN=Android Debug,O=Android,C=US"
$(APK): $(TEMP_APK) $(BUILDDIR)/rockbox.zip $(KEYSTORE)
$(SILENT)rm -f $@ $(SILENT)rm -f $@
$(call PRINTS,SIGN $(subst $(BUILDDIR)/,,$@))jarsigner \ $(call PRINTS,SIGN $(subst $(BUILDDIR)/,,$@))jarsigner \
-keystore "$(HOME)/.android/debug.keystore" -storepass "android" \ -keystore "$(KEYSTORE)" -storepass "android" -keypass "android" \
-keypass "android" -signedjar $(TEMP_APK2) $^ "androiddebugkey" -signedjar $(TEMP_APK2) $(TEMP_APK) "androiddebugkey"
$(SILENT)$(ZIPALIGN) -v 4 $(TEMP_APK2) $@ > /dev/null $(SILENT)$(ZIPALIGN) -v 4 $(TEMP_APK2) $@ > /dev/null
$(SILENT)rm $(TEMP_APK) $(TEMP_APK2)
$(DIRS): $(DIRS):
$(SILENT)mkdir -p $@ $(SILENT)mkdir -p $@
dirs: $(DIRS) dirs: $(DIRS)
apk: $(DIRS) $(APK) apk: $(APK)
clean:: clean::
$(SILENT)rm -f $(BUILDDIR)/bin/$(PACKAGE_PATH)/*.class $(R_JAVA) $(TEMP_APK) $(TEMP_APK2) $(APK) $(DEX) $(BUILDDIR)/_rockbox.zip $(AP_) $(LIBS) $(SILENT)rm -f $(BUILDDIR)/bin/$(PACKAGE_PATH)/*.class $(R_JAVA) $(TEMP_APK) $(TEMP_APK2) $(APK) $(DEX) $(BUILDDIR)/_rockbox.zip $(AP_) $(LIBS)