summaryrefslogtreecommitdiff
path: root/cross
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2023-03-01 19:34:45 +0800
committerPo Lu <luangruo@yahoo.com>2023-03-01 19:35:19 +0800
commitdaf9c62871af8539044da15028a078905bb9ba06 (patch)
tree3482cb2d04d137180f369644cbcaf9b858fba580 /cross
parenta0c3643abde85567eaf21c0695a7c042be33af11 (diff)
downloademacs-daf9c62871af8539044da15028a078905bb9ba06.tar.gz
Fix out-of-tree Android builds
* configure.ac (JAVA_PUSH_LINT): Push to WARN_JAVAFLAGS instead of JAVAFLAGS. (cross/lib): Always AS_MKDIR_P. * cross/Makefile.in (srcdir): New variable. (LIB_SRCDIR): Take realpath relative to srcdir, not .:(src/verbose.mk): Depend on verbose.mk.android in srcdir. (lib/Makefile): Edit srcdir and VPATH to LIB_SRCDIR. (src/Makefile): Edit -I$$(top_srcdir) to -I../$(srcdir)/lib, instead of ommitting it. (clean): Allow ndk-build clean to fail. * java/Makefile.in (builddir): New variable. (WARN_JAVAFLAGS): Likewise. (JAVAFLAGS): Define in terms of WARN_JAVAFLAGS. (SIGN_EMACS, SIGN_EMACS_V2): Use emacs.keystore relative to srcdir. Allow inclusion of ndk-build.mk to fail. (install_temp, emacs.apk-in) (../config.status): Depend relative to top_srcdir. (AndroidManifest.xml, $(APK_NAME)): Likewise. (RESOURCE_FILE, CLASS_FILES, classes.dex): Output class files to $(srcdir); these are arch independents, so this is okay.
Diffstat (limited to 'cross')
-rw-r--r--cross/Makefile.in34
1 files changed, 22 insertions, 12 deletions
diff --git a/cross/Makefile.in b/cross/Makefile.in
index 217a08f3b52..897e2333400 100644
--- a/cross/Makefile.in
+++ b/cross/Makefile.in
@@ -18,6 +18,7 @@
# 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
@@ -34,7 +35,7 @@ top_builddir = @top_builddir@
# 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)
@@ -61,9 +62,10 @@ all: lib/libgnu.a src/libemacs.so src/android-emacs $(LIBSRC_BINARIES)
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
@@ -86,21 +88,25 @@ PRE_BUILD_DEPS=$(top_builddir)/lib/libgnu.a \
$(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.
@@ -137,10 +143,10 @@ src/Makefile src/config.h &: $(top_builddir)/src/config.h.android \
# 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
@@ -167,6 +173,9 @@ lib-src/Makefile: $(top_builddir)/lib-src/Makefile.android
# 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 \
@@ -181,7 +190,8 @@ clean:
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 \