aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/android/module.mk
blob: fdb0ed2ac4230d70c4c1abe37bb51cbc2cbd933a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
MODULE := backends/platform/android

MODULE_OBJS := \
	android.o asset-archive.o video.o

MODULE_DIRS += \
	backends/platform/android/

# We don't use the rules.mk here on purpose
OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS)

JAVA_SRC = \
	$(MODULE)/org/inodes/gus/scummvm/ScummVM.java \
	$(MODULE)/org/inodes/gus/scummvm/ScummVMApplication.java \
	$(MODULE)/org/inodes/gus/scummvm/ScummVMActivity.java \
	$(MODULE)/org/inodes/gus/scummvm/EditableSurfaceView.java \
	$(MODULE)/org/inodes/gus/scummvm/Unpacker.java \
	$(MODULE)/org/inodes/gus/scummvm/Manifest.java \
	$(MODULE)/org/inodes/gus/scummvm/R.java

JAVA_PLUGIN_SRC = \
	$(MODULE)/org/inodes/gus/scummvm/PluginProvider.java

RESOURCES = \
	$(srcdir)/dists/android/res/values/strings.xml \
	$(srcdir)/dists/android/res/layout/main.xml \
	$(srcdir)/dists/android/res/layout/splash.xml \
	$(srcdir)/dists/android/res/drawable/gradient.xml \
	$(srcdir)/dists/android/res/drawable/scummvm.png \
	$(srcdir)/dists/android/res/drawable/scummvm_big.png

ASSETS = $(DIST_FILES_ENGINEDATA) $(DIST_FILES_THEMES)

PLUGIN_RESOURCES = \
	$(srcdir)/dists/android/res/values/strings.xml \
	$(srcdir)/dists/android/res/drawable/scummvm.png

# These must be incremented for each market upload
#ANDROID_VERSIONCODE = 6  Specified in dists/android/AndroidManifest.xml.in
ANDROID_PLUGIN_VERSIONCODE = 6

# This library contains scummvm proper
build.tmp/libscummvm.so: $(OBJS)
	@$(MKDIR) -p $(@D)
	$(CXX) $(PLUGIN_LDFLAGS) -shared $(LDFLAGS) -Wl,-soname,$(@F) -Wl,--no-undefined -o $@ $(PRE_OBJS_FLAGS) $(OBJS) $(POST_OBJS_FLAGS) $(LIBS)


backends/platform/android/org/inodes/gus/scummvm/R.java backends/platform/android/org/inodes/gus/scummvm/Manifest.java: $(srcdir)/dists/android/AndroidManifest.xml $(filter %.xml,$(RESOURCES)) $(ANDROID_JAR)
	$(AAPT) package -m -J backends/platform/android -M $< -S $(srcdir)/dists/android/res -I $(ANDROID_JAR)

build.tmp/classes/%.class: $(srcdir)/backends/platform/android/%.java $(srcdir)/backends/platform/android/org/inodes/gus/scummvm/R.java
	@$(MKDIR) -p $(@D)
	$(JAVAC) $(JAVACFLAGS) -cp $(srcdir)/backends/platform/android -d build.tmp/classes -bootclasspath $(ANDROID_JAR) $<

build.tmp/classes.plugin/%.class: $(srcdir)/backends/platform/android/%.java
	@$(MKDIR) -p $(@D)
	$(JAVAC) $(JAVACFLAGS) -cp $(srcdir)/backends/platform/android -d build.tmp/classes.plugin -bootclasspath $(ANDROID_JAR) $<

classes.dex: $(JAVA_SRC:backends/platform/android/%.java=build.tmp/classes/%.class)
	$(DX) --dex --output=$@ build.tmp/classes

build.tmp/plugins/classes.dex: $(JAVA_PLUGIN_SRC:backends/platform/android/%.java=build.tmp/classes.plugin/%.class)
	@$(MKDIR) -p $(@D)
	$(DX) --dex --output=$@ build.tmp/classes.plugin

resources.ap_: $(srcdir)/dists/android/AndroidManifest.xml $(RESOURCES) $(ASSETS) $(ANDROID_JAR) $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA)
	$(INSTALL) -d build.tmp/assets/
	$(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA) build.tmp/assets/
	$(AAPT) package -f -M $< -S $(srcdir)/dists/android/res -A build.tmp/assets -I $(ANDROID_JAR) -F $@

build.tmp/%/resources.ap_: build.tmp/%/AndroidManifest.xml build.stage/%/res/values/strings.xml build.stage/%/res/drawable/scummvm.png $(ANDROID_JAR)
	$(AAPT) package -f -M $< -S build.stage/$*/res -I $(ANDROID_JAR) -F $@

build.tmp/%/AndroidManifest.xml build.stage/%/res/values/strings.xml: dists/android/mkmanifest.pl configure dists/android/AndroidManifest.xml
	dists/android/mkmanifest.pl --id=$* --configure=configure \
	  --version-name=$(VERSION) \
	  --version-code=$(ANDROID_PLUGIN_VERSIONCODE) \
	  --stringres=build.stage/$*/res/values/strings.xml \
	  --manifest=build.tmp/$*/AndroidManifest.xml \
	  --master-manifest=dists/android/AndroidManifest.xml \
	  --unpacklib=mylib/armeabi/lib$*.so

build.stage/%/res/drawable/scummvm.png: dists/android/res/drawable/scummvm.png
	@$(MKDIR) -p $(@D)
	$(CP) $< $@