# JAVA_PUSH_LINT(OPT)
# -------------------
# Check if javac supports the diagnostic flag -Xlint:OPT.
-# If it does, add it to JAVAFLAGS.
+# If it does, add it to WARN_JAVAFLAGS.
AC_DEFUN([JAVA_PUSH_LINT],
[
[emacs_cv_javac_knows_lint_$1=no]))
AS_IF([test "$emacs_cv_javac_knows_lint_$1" = "yes"],
- [JAVAFLAGS="$JAVAFLAGS -Xlint:$1"])
+ [WARN_JAVAFLAGS="$WARN_JAVAFLAGS -Xlint:$1"])
])
# Start Android configuration. This is done in three steps:
DX=
ANDROID_JAR=
ANDROID_ABI=
-JAVAFLAGS=
+WARN_JAVAFLAGS=
# This is a list of Makefiles that have alternative versions for
# Android.
[emacs_cv_javac_release_7=no]))
if test "$emacs_cv_javac_release_7" = "yes"; then
- JAVAFLAGS="$JAVAFLAGS --release 7"
+ WARN_JAVAFLAGS="$WARN_JAVAFLAGS --release 7"
else
dnl If not, just make sure the generated bytecode is correct.
- JAVAFLAGS="$JAVAFLAGS -target 1.7 -source 1.7"
+ WARN_JAVAFLAGS="$WARN_JAVAFLAGS -target 1.7 -source 1.7"
fi
dnl Enable some useful Java linting options.
# Get the name of the android.jar file.
ANDROID_JAR="$with_android"
- dnl Set up the class path to include android.jar, along with the cwd
- dnl (which is $(top_builddir)/java.)
- JAVAFLAGS="$JAVAFLAGS -classpath \"$ANDROID_JAR:.\""
- AC_SUBST([JAVAFLAGS])
+ # Substitute this into java/Makefile.
+ AC_SUBST([WARN_JAVAFLAGS])
AC_PATH_PROGS([AAPT], [aapt], [], "${SDK_BUILD_TOOLS}:$PATH")
if test "$AAPT" = ""; then
AS_MKDIR_P([lib/deps/malloc])
fi
fi
+
+ dnl Make cross/lib, which various Makefiles in cross expect to
+ dnl always exist.
+ AS_MKDIR_P([cross/lib])
fi
# Make java/Makefile
# along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
top_srcdir = @top_srcdir@
+srcdir = @srcdir@
top_builddir = @top_builddir@
-include $(top_builddir)/src/verbose.mk
# This is possibly the ugliest Makefile ever written!
-LIB_SRCDIR = $(realpath ./lib)
+LIB_SRCDIR = $(realpath $(srcdir)/lib)
LIB_TOP_SRCDIR = $(realpath $(top_srcdir))
SRC_SRCDIR = $(realpath $(top_srcdir)/src)
config.status: $(top_srcdir)/config.status
$(AM_V_GEN) touch config.status
-src/verbose.mk: verbose.mk.android
+src/verbose.mk: $(srcdir)/verbose.mk.android
$(AM_V_GEN) mkdir -p src
- $(AM_V_SILENT) cp -f verbose.mk.android src/verbose.mk
+ $(AM_V_SILENT) cp -f $(srcdir)/verbose.mk.android \
+ src/verbose.mk
# Gnulib, make-fingerprint and make-docfile must be built before
# entering any of the rules below, or they will get the Android
$(top_builddir)/lib-src/make-docfile
lib/config.h: $(top_builddir)/src/config.h.android
- $(AM_V_GEN) cp -f -p $(top_builddir)/src/config.h.android \
+ $(AM_V_GEN) cp -f -p $(top_builddir)/src/config.h.android \
lib/config.h
lib/gnulib.mk: $(top_builddir)/lib/gnulib.mk.android
- $(AM_V_GEN) cp -f -p $(top_builddir)/lib/gnulib.mk.android \
+ $(AM_V_GEN) cp -f -p $(top_builddir)/lib/gnulib.mk.android \
lib/gnulib.mk
$(AM_V_SILENT) \
- sed -i 's/srcdir =.*$$/srcdir = $(subst /,\/,$(LIB_SRCDIR))/g' \
+ sed -i 's/srcdir =.*$$/srcdir = $(subst /,\/,$(LIB_SRCDIR))/g' \
lib/gnulib.mk
lib/Makefile: $(top_builddir)/lib/Makefile.android
- $(AM_V_GEN) cp -f -p $(top_builddir)/lib/Makefile.android \
- lib/Makefile
+ $(AM_V_GEN) cp -f -p $(top_builddir)/lib/Makefile.android \
+ lib/Makefile
$(AM_V_SILENT) \
sed -i 's/top_srcdir =.*$$/top_srcdir = $(subst /,\/,$(LIB_TOP_SRCDIR))/g' \
+ lib/Makefile \
+ && sed -i 's/^srcdir =.*$$/srcdir = $(subst /,\/,$(LIB_SRCDIR))/g' \
+ lib/Makefile \
+ && sed -i 's/VPATH =.*$$/VPATH = $(subst /,\/,$(LIB_SRCDIR))/g' \
lib/Makefile
# What is needed to build gnulib.
# cross-compiled binaries at ./lib-src.
$(AM_V_SILENT) \
sed -i 's/libsrc =.*$$/libsrc = \.\.\/\.\.\/lib-src/g' src/Makefile
-# Edit out anything saying -I($(top_srcdir)/lib); that should be
-# covered by -I$(lib)
+# Edit out anything saying -I($(top_srcdir)/lib) into
+# -I$../(srcdir)/lib; that should be covered by -I$(lib)
$(AM_V_SILENT) \
- sed -i 's/-I\$$(top_srcdir)\/lib//g' src/Makefile
+ sed -i 's/-I\$$(top_srcdir)\/lib/-I..\/$(subst /,\/,$(srcdir))\/lib/g' src/Makefile
.PHONY: src/android-emacs src/libemacs.so
# Edit out SCRIPTS, it interferes with the build.
$(AM_V_SILENT) \
sed -i 's/^SCRIPTS=.*$$/SCRIPTS=/g' lib-src/Makefile
+# Make BASE_CFLAGS also include cross/lib as well as ../lib.
+ $(AM_V_SILENT) \
+ sed -i 's/-I\.\.\/lib/-I..\/lib -I..\/$(subst /,\/,$(srcdir))\/lib/g' lib-src/Makefile
.PHONY: $(LIBSRC_BINARIES)
$(LIBSRC_BINARIES) &: src/verbose.mk $(top_builddir)/$@ lib/libgnu.a \
make -C lib clean; \
fi
rm -rf lib/config.h
- make -C ndk-build clean
+# ndk-build won't have been generated in a non-Android build.
+ -make -C ndk-build clean
distclean bootstrap-clean: clean
if [ -e lib/Makefile ]; then \
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
srcdir = @srcdir@
+builddir = @builddir@
version = @version@
# This is the host lib-src and lib, not the cross compiler's lib-src.
ANDROID_ABI = @ANDROID_ABI@
ANDROID_SDK_18_OR_EARLIER = @ANDROID_SDK_18_OR_EARLIER@
ANDROID_SDK_8_OR_EARLIER = @ANDROID_SDK_8_OR_EARLIER@
-JAVAFLAGS = @JAVAFLAGS@
+WARN_JAVAFLAGS = @WARN_JAVAFLAGS@
+JAVAFLAGS = $(WARN_JAVAFLAGS) -classpath "$(ANDROID_JAR):$(srcdir)"
# Android 4.3 and earlier require Emacs to be signed with a different
# digital signature algorithm.
AAPT_ASSET_ARGS =
endif
-SIGN_EMACS = -keystore emacs.keystore -storepass emacs1 $(JARSIGNER_FLAGS)
-SIGN_EMACS_V2 = sign --v2-signing-enabled --ks emacs.keystore \
- --debuggable-apk-permitted --ks-pass pass:emacs1
+SIGN_EMACS = -keystore $(srcdir)/emacs.keystore -storepass \
+ emacs1 $(JARSIGNER_FLAGS)
+SIGN_EMACS_V2 = sign --v2-signing-enabled --ks \
+ $(srcdir)/emacs.keystore -debuggable-apk-permitted \
+ --ks-pass pass:emacs1
JAVA_FILES := $(wildcard $(srcdir)/org/gnu/emacs/*.java)
RESOURCE_FILES := $(foreach file,$(wildcard $(srcdir)/res/*), \
CROSS_ARCHIVES = $(top_builddir)/cross/lib/libgnu.a
# Third party libraries to compile.
-include $(top_builddir)/cross/ndk-build/ndk-build.mk
+-include $(top_builddir)/cross/ndk-build/ndk-build.mk
.PHONY: $(CROSS_BINS) $(CROSS_LIBS) $(CROSS_ARCHIVES)
$(AM_V_SILENT) mkdir -p install_temp/assets/lisp
$(AM_V_SILENT) mkdir -p install_temp/assets/info
# Install architecture independents to assets/etc and assets/lisp
- $(AM_V_SILENT) cp -r $(top_builddir)/lisp install_temp/assets
- $(AM_V_SILENT) cp -r $(top_builddir)/etc install_temp/assets
- $(AM_V_SILENT) cp -r $(top_builddir)/info install_temp/assets
+ $(AM_V_SILENT) cp -r $(top_srcdir)/lisp install_temp/assets
+ $(AM_V_SILENT) cp -r $(top_srcdir)/etc install_temp/assets
+ $(AM_V_SILENT) cp -r $(top_srcdir)/info install_temp/assets
# Remove undesirable files from those directories.
$(AM_V_SILENT) \
for subdir in `find install_temp -type d -print`; do \
$(AM_V_AAPT) $(AAPT) p -I "$(ANDROID_JAR)" -F $@ \
-f -M AndroidManifest.xml $(AAPT_ASSET_ARGS) \
-A install_temp/assets \
- -S res -J install_temp
+ -S $(top_srcdir)/java/res -J install_temp
$(AM_V_SILENT) pushd install_temp &> /dev/null; \
$(AAPT) add ../$@ `find lib -type f`; \
popd &> /dev/null
$(AM_V_SILENT) rm -rf install_temp
# Makefile itself.
-.PRECIOUS: ../config.status Makefile
-../config.status: $(top_srcdir)/configure.ac $(top_srcdir)/m4/*.m4
+.PRECIOUS: $(top_srcdir)/config.status Makefile
+$(top_srcdir)/config.status: $(top_srcdir)/configure.ac $(top_srcdir)/m4/*.m4
$(MAKE) -C $(dir $@) $(notdir $@)
-Makefile: ../config.status $(top_builddir)/java/Makefile.in
+Makefile: $(top_srcdir)/config.status $(top_srcdir)/java/Makefile.in
$(MAKE) -C .. java/$@
# AndroidManifest.xml:
AndroidManifest.xml: $(top_srcdir)/configure.ac $(top_srcdir)/m4/*.m4 \
- AndroidManifest.xml.in
+ $(srcdir)/AndroidManifest.xml.in
pushd ..; ./config.status java/AndroidManifest.xml; popd
# R.java:
$(RESOURCE_FILE): $(RESOURCE_FILES)
- $(AM_V_GEN) $(AAPT) p -I "$(ANDROID_JAR)" -f \
- -J $(dir $@) -M AndroidManifest.xml -S res
+ $(AM_V_GEN) $(AAPT) p -I "$(ANDROID_JAR)" -f \
+ -J $(dir $@) -M AndroidManifest.xml \
+ -S $(top_srcdir)/java/res
# Make all class files depend on R.java being built.
$(CLASS_FILES): $(RESOURCE_FILE)
# nested classes.
classes.dex: $(CLASS_FILES)
- $(AM_V_D8) $(D8) --classpath $(ANDROID_JAR) \
- $(subst $$,\$$,$(shell find . -type f -name *.class))
+ $(AM_V_D8) $(D8) --classpath $(ANDROID_JAR) \
+ $(subst $$,\$$,$(shell find $(srcdir) -type f \
+ -name *.class)) --output $(builddir)
# When emacs.keystore expires, regenerate it with:
#
.PHONY: clean maintainer-clean
-$(APK_NAME): classes.dex emacs.apk-in emacs.keystore
+$(APK_NAME): classes.dex emacs.apk-in $(srcdir)/emacs.keystore
$(AM_V_GEN)
$(AM_V_SILENT) cp -f emacs.apk-in $@.unaligned
$(AM_V_SILENT) $(AAPT) add $@.unaligned classes.dex