aboutsummaryrefslogtreecommitdiffstats
path: root/java/Makefile.in
diff options
context:
space:
mode:
Diffstat (limited to 'java/Makefile.in')
-rw-r--r--java/Makefile.in104
1 files changed, 72 insertions, 32 deletions
diff --git a/java/Makefile.in b/java/Makefile.in
index 155754b59d2..fc0d23980e4 100644
--- a/java/Makefile.in
+++ b/java/Makefile.in
@@ -54,18 +54,33 @@ JARSIGNER_FLAGS =
54endif 54endif
55 55
56SIGN_EMACS = -keystore emacs.keystore -storepass emacs1 $(JARSIGNER_FLAGS) 56SIGN_EMACS = -keystore emacs.keystore -storepass emacs1 $(JARSIGNER_FLAGS)
57SIGN_EMACS_V2 = sign --v2-signing-enabled --ks emacs.keystore \ 57SIGN_EMACS_V2 = sign --v2-signing-enabled --ks emacs.keystore \
58 --debuggable-apk-permitted --ks-pass pass:emacs1 58 --debuggable-apk-permitted --ks-pass pass:emacs1
59 59
60JAVA_FILES = $(wildcard $(srcdir)/org/gnu/emacs/*.java) 60JAVA_FILES := $(wildcard $(srcdir)/org/gnu/emacs/*.java)
61RESOURCE_FILES = $(wildcard $(srcdir)/res/drawable/*) 61RESOURCE_FILES := $(foreach file,$(wildcard $(srcdir)/res/*), \
62CLASS_FILES = $(foreach file,$(JAVA_FILES),$(basename $(file)).class) 62 $(wildcard $(file)/*))
63
64# R.java is a file generated by the `aapt' utility containing
65# constants that can then be used to locate ``resource identifiers''.
66# It is not a regular file and should not be compiled as Java source
67# code. Instead, it is automatically included by the Java compiler.
68RESOURCE_FILE := $(srcdir)/org/gnu/emacs/R.java
69
70# CLASS_FILES is what should actually be built and included in the
71# resulting Emacs executable. The Java compiler might generate more
72# than one class file for each source file, so this only serves as a
73# list of dependencies for Make.
74CLASS_FILES := $(foreach file,$(JAVA_FILES),$(basename $(file)).class)
75
76# Remove RESOURCE_FILE from JAVA_FILES, if it is already present.
77JAVA_FILES := $(filter-out $(RESOURCE_FILE),$(JAVA_FILES))
63 78
64# Compute the name for the Emacs application package. This should be: 79# Compute the name for the Emacs application package. This should be:
65# emacs-<version>-<min-sdk>-<abi>.apk 80# emacs-<version>-<min-sdk>-<abi>.apk
66 81
67ANDROID_MIN_SDK = @ANDROID_MIN_SDK@ 82ANDROID_MIN_SDK := @ANDROID_MIN_SDK@
68APK_NAME = emacs-$(version)-$(ANDROID_MIN_SDK)-$(ANDROID_ABI).apk 83APK_NAME := emacs-$(version)-$(ANDROID_MIN_SDK)-$(ANDROID_ABI).apk
69 84
70# How this stuff works. 85# How this stuff works.
71 86
@@ -113,19 +128,25 @@ include $(top_builddir)/cross/ndk-build/ndk-build.mk
113$(libsrc)/asset-directory-tool: 128$(libsrc)/asset-directory-tool:
114 $(MAKE) -C $(libsrc) $(notdir $@) 129 $(MAKE) -C $(libsrc) $(notdir $@)
115 130
116emacs.apk-in: $(CROSS_BINS) $(CROSS_LIBS) $(libsrc)/asset-directory-tool \ 131# install_tmp is a directory used to generate emacs.apk-in.
117 AndroidManifest.xml $(NDK_BUILD_SHARED) $(RESOURCE_FILES) 132# That is then packaged into $(APK_NAME).
133
134.PHONY: install_temp install_temp/assets/directory-tree
135install_temp: $(CROSS_BINS) $(CROSS_LIBS) $(NDK_BUILD_SHARED) \
136 $(RESOURCE_FILES)
137 $(AM_V_GEN)
118# Make the working directory for this stuff 138# Make the working directory for this stuff
119 rm -rf install_temp 139 $(AM_V_SILENT) rm -rf install_temp
120 mkdir -p install_temp/lib/$(ANDROID_ABI) 140 $(AM_V_SILENT) mkdir -p install_temp/lib/$(ANDROID_ABI)
121 mkdir -p install_temp/assets/etc 141 $(AM_V_SILENT) mkdir -p install_temp/assets/etc
122 mkdir -p install_temp/assets/lisp 142 $(AM_V_SILENT) mkdir -p install_temp/assets/lisp
123 mkdir -p install_temp/assets/info 143 $(AM_V_SILENT) mkdir -p install_temp/assets/info
124# Install architecture independents to assets/etc and assets/lisp 144# Install architecture independents to assets/etc and assets/lisp
125 cp -r $(top_builddir)/lisp install_temp/assets 145 $(AM_V_SILENT) cp -r $(top_builddir)/lisp install_temp/assets
126 cp -r $(top_builddir)/etc install_temp/assets 146 $(AM_V_SILENT) cp -r $(top_builddir)/etc install_temp/assets
127 cp -r $(top_builddir)/info install_temp/assets 147 $(AM_V_SILENT) cp -r $(top_builddir)/info install_temp/assets
128# Remove undesirable files from those directories. 148# Remove undesirable files from those directories.
149 $(AM_V_SILENT) \
129 for subdir in `find install_temp -type d -print`; do \ 150 for subdir in `find install_temp -type d -print`; do \
130 chmod a+rx $${subdir} ; \ 151 chmod a+rx $${subdir} ; \
131 rm -rf $${subdir}/.gitignore ; \ 152 rm -rf $${subdir}/.gitignore ; \
@@ -139,34 +160,44 @@ emacs.apk-in: $(CROSS_BINS) $(CROSS_LIBS) $(libsrc)/asset-directory-tool \
139 rm -rf $${subdir}/Makefile; \ 160 rm -rf $${subdir}/Makefile; \
140 done 161 done
141# Generate the directory tree for those directories. 162# Generate the directory tree for those directories.
142 $(libsrc)/asset-directory-tool install_temp/assets \
143 install_temp/assets/directory-tree
144# Install architecture dependents to lib/$(ANDROID_ABI). This 163# Install architecture dependents to lib/$(ANDROID_ABI). This
145# perculiar naming scheme is required to make Android preserve these 164# perculiar naming scheme is required to make Android preserve these
146# binaries upon installation. 165# binaries upon installation.
166 $(AM_V_SILENT) \
147 for file in $(CROSS_BINS); do \ 167 for file in $(CROSS_BINS); do \
148 if [ -x $$file ]; then \ 168 if [ -x $$file ]; then \
149 filename=`basename $$file`; \ 169 filename=`basename $$file`; \
150 cp -f $$file install_temp/lib/$(ANDROID_ABI)/lib$${filename}.so; \ 170 cp -f $$file install_temp/lib/$(ANDROID_ABI)/lib$${filename}.so; \
151 fi \ 171 fi \
152 done 172 done
173 $(AM_V_SILENT) \
153 for file in $(CROSS_LIBS); do \ 174 for file in $(CROSS_LIBS); do \
154 if [ -x $$file ]; then \ 175 if [ -x $$file ]; then \
155 cp -f $$file install_temp/lib/$(ANDROID_ABI); \ 176 cp -f $$file install_temp/lib/$(ANDROID_ABI); \
156 fi \ 177 fi \
157 done 178 done
158ifneq ($(NDK_BUILD_SHARED),) 179ifneq ($(NDK_BUILD_SHARED),)
159 cp -f $(NDK_BUILD_SHARED) install_temp/lib/$(ANDROID_ABI) 180 $(AM_V_SILENT) cp -f $(NDK_BUILD_SHARED) \
181 install_temp/lib/$(ANDROID_ABI)
160endif 182endif
183
184install_temp/assets/directory-tree: $(libsrc)/asset-directory-tool install_temp
185 $(AM_V_GEN) $(libsrc)/asset-directory-tool install_temp/assets \
186 install_temp/assets/directory-tree
187
188emacs.apk-in: install_temp install_temp/assets/directory-tree \
189 AndroidManifest.xml
161# Package everything. Specifying the assets on this command line is 190# Package everything. Specifying the assets on this command line is
162# necessary for AAssetManager_getNextFileName to work on old versions 191# necessary for AAssetManager_getNextFileName to work on old versions
163# of Android. Make sure not to generate R.java, as it's not required 192# of Android. Make sure not to generate R.java, as it's already been
164# by Emacs. 193# generated.
165 $(AAPT) package -I "$(ANDROID_JAR)" -F $@ -f \ 194 $(AM_V_AAPT) $(AAPT) p -I "$(ANDROID_JAR)" -F $@ \
166 -M AndroidManifest.xml -A install_temp/assets \ 195 -f -M AndroidManifest.xml -A install_temp/assets \
167 -S res -J install_temp 196 -S res -J install_temp
168 pushd install_temp; $(AAPT) add ../$@ `find lib -type f`; popd 197 $(AM_V_SILENT) pushd install_temp &> /dev/null; \
169 rm -rf install_temp 198 $(AAPT) add ../$@ `find lib -type f`; \
199 popd &> /dev/null
200 $(AM_V_SILENT) rm -rf install_temp
170 201
171# Makefile itself. 202# Makefile itself.
172.PRECIOUS: ../config.status Makefile 203.PRECIOUS: ../config.status Makefile
@@ -180,6 +211,14 @@ AndroidManifest.xml: $(top_srcdir)/configure.ac $(top_srcdir)/m4/*.m4 \
180 AndroidManifest.xml.in 211 AndroidManifest.xml.in
181 pushd ..; ./config.status java/AndroidManifest.xml; popd 212 pushd ..; ./config.status java/AndroidManifest.xml; popd
182 213
214# R.java:
215$(RESOURCE_FILE): $(RESOURCE_FILES)
216 $(AM_V_GEN) $(AAPT) p -I "$(ANDROID_JAR)" -f \
217 -J $(dir $@) -M AndroidManifest.xml -S res
218
219# Make all class files depend on R.java being built.
220$(CLASS_FILES): $(RESOURCE_FILE)
221
183.SUFFIXES: .java .class 222.SUFFIXES: .java .class
184.java.class &: 223.java.class &:
185 $(AM_V_JAVAC) $(JAVAC) $(JAVAFLAGS) $< 224 $(AM_V_JAVAC) $(JAVAC) $(JAVAFLAGS) $<
@@ -199,17 +238,18 @@ classes.dex: $(CLASS_FILES)
199.PHONY: clean maintainer-clean 238.PHONY: clean maintainer-clean
200 239
201$(APK_NAME): classes.dex emacs.apk-in emacs.keystore 240$(APK_NAME): classes.dex emacs.apk-in emacs.keystore
202 cp -f emacs.apk-in $@.unaligned 241 $(AM_V_GEN)
203 $(AAPT) add $@.unaligned classes.dex 242 $(AM_V_SILENT) cp -f emacs.apk-in $@.unaligned
204 $(JARSIGNER) $(SIGN_EMACS) $@.unaligned "Emacs keystore" 243 $(AM_V_SILENT) $(AAPT) add $@.unaligned classes.dex
205 $(ZIPALIGN) -f 4 $@.unaligned $@ 244 $(AM_V_SILENT) $(JARSIGNER) $(SIGN_EMACS) $@.unaligned "Emacs keystore"
245 $(AM_V_SILENT) $(ZIPALIGN) -f 4 $@.unaligned $@
206# Signing must happen after alignment! 246# Signing must happen after alignment!
207 $(APKSIGNER) $(SIGN_EMACS_V2) $@ 247 $(AM_V_SILENT) $(APKSIGNER) $(SIGN_EMACS_V2) $@
208 rm -f $@.unaligned *.idsig 248 $(AM_V_SILENT) rm -f $@.unaligned *.idsig
209 249
210clean: 250clean:
211 rm -f *.apk emacs.apk-in *.dex *.unaligned *.class *.idsig 251 rm -f *.apk emacs.apk-in *.dex *.unaligned *.class *.idsig
212 rm -rf install-temp 252 rm -rf install-temp $(RESOURCE_FILE)
213 find . -name '*.class' -delete 253 find . -name '*.class' -delete
214 254
215maintainer-clean distclean bootstrap-clean: clean 255maintainer-clean distclean bootstrap-clean: clean