aboutsummaryrefslogtreecommitdiffstats
path: root/java/Makefile.in
diff options
context:
space:
mode:
Diffstat (limited to 'java/Makefile.in')
-rw-r--r--java/Makefile.in150
1 files changed, 150 insertions, 0 deletions
diff --git a/java/Makefile.in b/java/Makefile.in
new file mode 100644
index 00000000000..e9fcc625cb2
--- /dev/null
+++ b/java/Makefile.in
@@ -0,0 +1,150 @@
1### @configure_input@
2
3# Copyright (C) 2023 Free Software Foundation, Inc.
4
5# This file is part of GNU Emacs.
6
7# GNU Emacs is free software: you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11
12# GNU Emacs is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16
17# You should have received a copy of the GNU General Public License
18# along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
19
20top_builddir = @top_builddir@
21
22-include ${top_builddir}/src/verbose.mk
23
24SHELL = @SHELL@
25JAVAC = @JAVAC@
26AAPT = @AAPT@
27DX = @DX@
28ZIPALIGN = @ZIPALIGN@
29JARSIGNER = @JARSIGNER@
30ANDROID_JAR = @ANDROID_JAR@
31ANDROID_ABI = @ANDROID_ABI@
32
33WARN_JAVAFLAGS = -Xlint:deprecation
34JAVAFLAGS = -classpath "$(ANDROID_JAR):." -target 1.7 -source 1.7 \
35 $(WARN_JAVAFLAGS)
36
37SIGN_EMACS = -keystore emacs.keystore -storepass emacs1
38
39JAVA_FILES = $(shell find . -type f -name *.java)
40CLASS_FILES = $(foreach file,$(JAVA_FILES),$(basename $(file)).class)
41
42# How this stuff works.
43
44# emacs.apk depends on emacs.apk-in, which is simply a ZIP archive
45# containing the following files:
46# lib/$(ANDROID_ABI)/libemacs.so
47# lib/$(ANDROID_ABI)/libandroid-emacs.so
48# lib/$(ANDROID_ABI)/libctags.so
49# lib/$(ANDROID_ABI)/libhexl.so
50# lib/$(ANDROID_ABI)/libmovemail.so
51# lib/$(ANDROID_ABI)/librcs2log.so
52# lib/$(ANDROID_ABI)/libebrowse.so
53# assets/info/
54# assets/etc/
55# assets/lisp/
56
57.PHONY: emacs.apk-in all
58all: emacs.apk
59
60# Binaries to cross-compile.
61CROSS_BINS = ../xcompile/src/android-emacs ../xcompile/lib-src/ctags \
62 ../xcompile/lib-src/hexl ../xcompile/lib-src/movemail \
63 ../xcompile/lib-src/ebrowse
64
65# Libraries to cross-compile.
66CROSS_LIBS = ../xcompile/src/libemacs.so
67
68.PHONY: $(CROSS_BINS) $(CROSS_LIBS)
69
70../xcompile/src/android-emacs ../xcompile/src/libemacs.so:
71 make -C ../xcompile src/$(notdir $@)
72
73../xcompile/lib-src/hexl ../xcompile/lib-src/movemail \
74../xcompile/lib-src/ctags ../xcompile/lib-src/ebrowse &:
75 make -C ../xcompile lib-src/$(notdir $@)
76
77emacs.apk-in: $(CROSS_BINS) $(CROSS_LIBS) AndroidManifest.xml
78# Make the working directory for this stuff
79 rm -rf install_temp
80 mkdir -p install_temp/lib/$(ANDROID_ABI)
81 mkdir -p install_temp/assets/etc
82 mkdir -p install_temp/assets/lisp
83 mkdir -p install_temp/assets/info
84# Install architecture independents to assets/etc and assets/lisp
85 cp -r $(top_builddir)/lisp install_temp/assets
86 cp -r $(top_builddir)/etc install_temp/assets
87# Remove undesirable files from those directories.
88 for subdir in `find install_temp -type d -print`; do \
89 chmod a+rx $${subdir} ; \
90 rm -rf $${subdir}/.gitignore ; \
91 rm -rf $${subdir}/.DS_Store ; \
92 rm -rf $${subdir}/#* ; \
93 rm -rf $${subdir}/.#* ; \
94 rm -rf $${subdir}/*~ ; \
95 rm -rf $${subdir}/*.orig ; \
96 rm -rf $${subdir}/ChangeLog* ; \
97 rm -rf $${subdir}/[mM]akefile*[.-]in ; \
98 rm -rf $${subdir}/Makefile; \
99 done
100# Install architecture dependents to lib/$(ANDROID_ABI). This
101# perculiar naming scheme is required to make Android preserve these
102# binaries upon installation.
103 for file in $(CROSS_BINS); do \
104 if [ -x $$file ]; then \
105 filename=`basename $$file`; \
106 cp -f $$file install_temp/lib/$(ANDROID_ABI)/lib$${filename}.so; \
107 fi \
108 done
109 for file in $(CROSS_LIBS); do \
110 if [ -x $$file ]; then \
111 cp -f $$file install_temp/lib/$(ANDROID_ABI); \
112 fi \
113 done
114# Package everything.
115 $(AAPT) package -I "$(ANDROID_JAR)" -F $@ -f -M AndroidManifest.xml
116 pushd install_temp; $(AAPT) add ../$@ `find lib -type f`; popd
117 pushd install_temp; $(AAPT) add ../$@ `find assets -type f`; popd
118 rm -rf install_temp
119
120.SUFFIXES: .java .class
121.java.class &:
122 $(AM_V_JAVAC) $(JAVAC) $(JAVAFLAGS) $<
123
124# N.B. that find must be called all over again in case javac generated
125# nested classes.
126
127classes.dex: $(CLASS_FILES)
128 $(AM_V_DX) $(DX) --classpath $(ANDROID_JAR) \
129 $(subst $$,\$$,$(shell find . -type f -name *.class))
130
131# When emacs.keystore expires, regenerate it with:
132#
133# keytool -genkey -v -keystore emacs.keystore -alias "Emacs keystore" \
134# -keyalg RSA -sigalg SHA1withRSA -keysize 2048 -validity 100000
135
136.PHONY: clean maintainer-clean
137
138emacs.apk: classes.dex emacs.apk-in emacs.keystore
139 cp -f emacs.apk-in $@.unaligned
140 $(AAPT) add $@.unaligned classes.dex
141 $(JARSIGNER) $(SIGN_EMACS) $@.unaligned "Emacs keystore"
142 $(ZIPALIGN) -f 4 $@.unaligned $@
143 rm -f $@.unaligned
144
145clean:
146 rm -f emacs.apk emacs.apk-in *.dex *.unaligned *.class
147 rm -rf install-temp
148 find . -name '*.class' -delete
149
150maintainer-clean: clean