Created
August 27, 2015 09:04
-
-
Save rkachowski/25ffe7bff3c494fa5096 to your computer and use it in GitHub Desktop.
java/android makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JAR_PKG = JarName.jar | |
CP = cp | |
#change this to fit the version of installed android sdk on build system | |
API_LEVEL=22 | |
#unity expects jdk 1.6 | |
JFLAGS = -cp ${jar_file} -g -source 1.6 -target 1.6 | |
JC = javac | |
JAR = jar | |
JARFLAGS = cvf | |
OUTPUT = bin | |
.SUFFIXES: .java .class .jar | |
.PHONY: clean copy-jar-to-resources check-android-home | |
.DEFAULT_GOAL := default | |
SOURCES=$(wildcard **/*.java) | |
CLASSES=$(patsubst %.java,%.class,$(SOURCES)) | |
.java.class: | |
$(JC) $(JFLAGS) $*.java | |
default: output-jar | |
compile-java: check-android-home $(CLASSES) | |
compile-jar: compile-java | |
$(JAR) $(JARFLAGS) $(JAR_PKG) $(CLASSES) | |
output-jar: compile-jar | |
cp ${JAR_PKG} ${OUTPUT} | |
clean: | |
$(RM) *.class *.jar | |
check-android-home: | |
ifndef ANDROID_HOME | |
$(error ANDROID_HOME env var is not set, android sdk is expected at this location) | |
endif | |
jar_file := $(ANDROID_HOME)/platforms/android-${API_LEVEL}/android.jar | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment