2023-01-24 02:24:13 +00:00
|
|
|
### @configure_input@
|
|
|
|
|
|
|
|
# Copyright (C) 2023 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
# This file is part of GNU Emacs.
|
|
|
|
|
|
|
|
# GNU Emacs is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
|
|
|
|
# GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
top_srcdir = @top_srcdir@
|
2023-03-01 11:34:45 +00:00
|
|
|
srcdir = @srcdir@
|
2023-01-24 02:24:13 +00:00
|
|
|
top_builddir = @top_builddir@
|
2023-03-05 02:42:41 +00:00
|
|
|
builddir = @builddir@
|
2023-01-24 02:24:13 +00:00
|
|
|
|
2023-02-10 15:03:43 +00:00
|
|
|
-include $(top_builddir)/src/verbose.mk
|
|
|
|
|
2023-01-24 02:24:13 +00:00
|
|
|
# Cross-compiling Emacs for Android.
|
|
|
|
|
|
|
|
# The cross compiled binaries are built by having ``variant''
|
|
|
|
# Makefiles generated at configure-time. First,
|
|
|
|
# $(top_builddir)/src/Makefile.android,
|
|
|
|
# $(top_builddir)/lib/Makefile.android,
|
|
|
|
# $(top_builddir)/lib/gnulib.mk.android and
|
|
|
|
# $(top_builddir)/lib-src/Makefile.android are copied to their usual
|
|
|
|
# locations in this directory.
|
|
|
|
|
2023-03-05 02:18:28 +00:00
|
|
|
# N.B. that LIB_SRCDIR is actually relative to builddir, because that
|
|
|
|
# is where the gnulib files get linked.
|
2023-01-24 02:24:13 +00:00
|
|
|
|
2023-03-05 02:18:28 +00:00
|
|
|
LIB_SRCDIR = $(realpath $(builddir)/lib)
|
2023-01-24 02:24:13 +00:00
|
|
|
LIB_TOP_SRCDIR = $(realpath $(top_srcdir))
|
|
|
|
|
|
|
|
SRC_SRCDIR = $(realpath $(top_srcdir)/src)
|
|
|
|
SRC_TOP_SRCDIR = $(realpath $(top_srcdir))
|
|
|
|
|
|
|
|
LIB_SRC_SRCDIR = $(realpath $(top_srcdir)/lib-src)
|
|
|
|
LIB_SRC_TOP_SRCDIR = $(realpath $(top_src))
|
|
|
|
|
|
|
|
# This is a list of binaries to build and install in lib-src.
|
|
|
|
|
|
|
|
LIBSRC_BINARIES = lib-src/etags lib-src/ctags lib-src/emacsclient \
|
|
|
|
lib-src/ebrowse lib-src/hexl lib-src/movemail
|
|
|
|
|
2023-03-05 02:18:28 +00:00
|
|
|
CLEAN_SUBDIRS=src lib-src lib
|
2023-01-24 02:24:13 +00:00
|
|
|
|
|
|
|
.PHONY: all
|
|
|
|
all: lib/libgnu.a src/libemacs.so src/android-emacs $(LIBSRC_BINARIES)
|
|
|
|
|
|
|
|
# This Makefile relies on builddir and top_builddir being relative
|
|
|
|
# paths in *.android.
|
|
|
|
|
2023-01-26 14:11:04 +00:00
|
|
|
# This file is used to tell lib/gnulib.mk when
|
2023-03-05 03:04:06 +00:00
|
|
|
# $(top_builddir)/config.status changes.
|
|
|
|
config.status: $(top_builddir)/config.status
|
2023-02-10 15:03:43 +00:00
|
|
|
$(AM_V_GEN) touch config.status
|
2023-01-24 02:24:13 +00:00
|
|
|
|
2023-03-01 11:34:45 +00:00
|
|
|
src/verbose.mk: $(srcdir)/verbose.mk.android
|
|
|
|
$(AM_V_SILENT) cp -f $(srcdir)/verbose.mk.android \
|
|
|
|
src/verbose.mk
|
2023-01-24 02:24:13 +00:00
|
|
|
|
|
|
|
# Gnulib, make-fingerprint and make-docfile must be built before
|
|
|
|
# entering any of the rules below, or they will get the Android
|
|
|
|
# versions of many headers.
|
|
|
|
|
|
|
|
.PHONY: $(top_builddir)/lib/libgnu.a
|
|
|
|
$(top_builddir)/lib/libgnu.a:
|
2023-02-10 15:03:43 +00:00
|
|
|
$(MAKE) -C $(top_builddir)/lib libgnu.a
|
2023-01-24 02:24:13 +00:00
|
|
|
|
|
|
|
.PHONY: $(top_builddir)/lib-src/make-fingerprint
|
2023-02-19 12:45:32 +00:00
|
|
|
$(top_builddir)/lib-src/make-fingerprint: $(top_builddir)/lib/libgnu.a
|
2023-02-10 15:03:43 +00:00
|
|
|
$(MAKE) -C $(top_builddir)/lib-src make-fingerprint
|
2023-01-24 02:24:13 +00:00
|
|
|
|
|
|
|
.PHONY: $(top_builddir)/lib-src/make-docfile
|
2023-02-19 12:45:32 +00:00
|
|
|
$(top_builddir)/lib-src/make-docfile: $(top_builddir)/lib/libgnu.a
|
2023-02-10 15:03:43 +00:00
|
|
|
$(MAKE) -C $(top_builddir)/lib-src make-docfile
|
2023-01-24 02:24:13 +00:00
|
|
|
|
|
|
|
PRE_BUILD_DEPS=$(top_builddir)/lib/libgnu.a \
|
|
|
|
$(top_builddir)/lib-src/make-fingerprint \
|
|
|
|
$(top_builddir)/lib-src/make-docfile
|
|
|
|
|
|
|
|
lib/config.h: $(top_builddir)/src/config.h.android
|
2023-03-01 11:34:45 +00:00
|
|
|
$(AM_V_GEN) cp -f -p $(top_builddir)/src/config.h.android \
|
2023-02-10 15:03:43 +00:00
|
|
|
lib/config.h
|
2023-01-24 02:24:13 +00:00
|
|
|
|
2023-03-02 07:59:33 +00:00
|
|
|
lib-src/config.h: $(top_builddir)/src/config.h.android
|
|
|
|
$(AM_V_GEN) cp -f -p $(top_builddir)/src/config.h.android \
|
|
|
|
lib-src/config.h
|
|
|
|
|
2023-01-24 02:24:13 +00:00
|
|
|
lib/gnulib.mk: $(top_builddir)/lib/gnulib.mk.android
|
2023-03-15 07:07:29 +00:00
|
|
|
$(AM_V_GEN) \
|
|
|
|
sed -e 's/^srcdir =.*$$/srcdir = $(subst /,\/,$(LIB_SRCDIR))/g' \
|
|
|
|
< $(top_builddir)/lib/gnulib.mk.android > $@
|
2023-01-24 02:24:13 +00:00
|
|
|
|
|
|
|
lib/Makefile: $(top_builddir)/lib/Makefile.android
|
2023-03-15 07:07:29 +00:00
|
|
|
$(AM_V_GEN) \
|
|
|
|
sed -e 's/^top_srcdir =.*$$/top_srcdir = $(subst /,\/,$(LIB_TOP_SRCDIR))/g' \
|
|
|
|
-e 's/^srcdir =.*$$/srcdir = $(subst /,\/,$(LIB_SRCDIR))/g' \
|
|
|
|
-e 's/^VPATH =.*$$/VPATH = $(subst /,\/,$(LIB_SRCDIR))/g' \
|
|
|
|
< $(top_builddir)/lib/Makefile.android > $@
|
2023-01-24 02:24:13 +00:00
|
|
|
|
|
|
|
# What is needed to build gnulib.
|
|
|
|
LIB_DEPS = lib/config.h lib/gnulib.mk lib/Makefile
|
|
|
|
|
|
|
|
.PHONY: lib/libgnu.a
|
|
|
|
lib/libgnu.a: src/verbose.mk config.status $(LIB_DEPS) $(PRE_BUILD_DEPS)
|
2023-02-10 15:03:43 +00:00
|
|
|
$(MAKE) -C lib libgnu.a
|
2023-01-24 02:24:13 +00:00
|
|
|
|
2023-03-15 07:07:29 +00:00
|
|
|
# Edit srcdir and top_srcdir to the right locations.
|
2023-01-24 02:24:13 +00:00
|
|
|
# Edit references to ../admin/unidata to read ../../admin/unidata.
|
|
|
|
# Next, edit libsrc to the location at top_srcdir! It is important
|
|
|
|
# that src/Makefile uses the binaries there, instead of any
|
|
|
|
# cross-compiled binaries at ./lib-src.
|
2023-03-01 11:34:45 +00:00
|
|
|
# Edit out anything saying -I($(top_srcdir)/lib) into
|
|
|
|
# -I$../(srcdir)/lib; that should be covered by -I$(lib)
|
2023-03-15 07:07:29 +00:00
|
|
|
|
|
|
|
src/Makefile: $(top_builddir)/src/Makefile.android
|
|
|
|
$(AM_V_GEN) \
|
|
|
|
sed -e 's/^srcdir =.*$$/srcdir = $(subst /,\/,$(SRC_SRCDIR))/g' \
|
|
|
|
-e 's/^top_srcdir =.*$$/top_srcdir = $(subst /,\/,$(LIB_TOP_SRCDIR))/g' \
|
|
|
|
-e 's/\.\.\/admin\/unidata/..\/..\/admin\/unidata/g' \
|
|
|
|
-e 's/\.\.\/admin\/charsets/..\/..\/admin\/charsets/g' \
|
|
|
|
-e 's/^libsrc =.*$$/libsrc = \.\.\/\.\.\/lib-src/g' \
|
|
|
|
-e 's/libsrc =.*$$/libsrc = \.\.\/\.\.\/lib-src/g' \
|
|
|
|
-e 's/-I\$$(top_srcdir)\/lib/-I..\/$(subst /,\/,$(srcdir))\/lib/g' \
|
|
|
|
< $(top_builddir)/src/Makefile.android > $@
|
|
|
|
|
|
|
|
src/config.h: $(top_builddir)/src/config.h.android
|
|
|
|
$(AM_V_GEN) cp -f -p $< $@
|
2023-01-24 02:24:13 +00:00
|
|
|
|
|
|
|
.PHONY: src/android-emacs src/libemacs.so
|
2023-02-19 13:25:37 +00:00
|
|
|
|
|
|
|
src/libemacs.so: src/Makefile src/config.h src/verbose.mk \
|
|
|
|
lib/libgnu.a $(PRE_BUILD_DEPS)
|
|
|
|
$(MAKE) -C src libemacs.so
|
|
|
|
|
2023-02-19 13:57:17 +00:00
|
|
|
src/android-emacs: src/Makefile src/config.h lib/libgnu.a \
|
|
|
|
$(PRE_BUILD_DEPS)
|
2023-02-19 13:25:37 +00:00
|
|
|
$(MAKE) -C src android-emacs
|
2023-01-24 02:24:13 +00:00
|
|
|
|
|
|
|
# Edit out SCRIPTS, it interferes with the build.
|
2023-03-01 11:34:45 +00:00
|
|
|
# Make BASE_CFLAGS also include cross/lib as well as ../lib.
|
2023-03-15 07:07:29 +00:00
|
|
|
|
|
|
|
lib-src/Makefile: $(top_builddir)/lib-src/Makefile.android
|
|
|
|
$(AM_V_GEN) \
|
|
|
|
sed -e 's/-I\$${srcdir}\/\.\.\/lib//g' \
|
|
|
|
-e 's/^srcdir=.*$$/srcdir = $(subst /,\/,$(LIB_SRC_SRCDIR))/g' \
|
|
|
|
-e 's/^top_srcdir=.*$$/top_srcdir = $(subst /,\/,$(LIB_SRC_TOP_SRCDIR))/g' \
|
|
|
|
-e 's/^SCRIPTS=.*$$/SCRIPTS=/g' \
|
|
|
|
-e 's/-I\.\.\/lib/-I..\/lib -I..\/$(subst /,\/,$(srcdir))\/lib/g' \
|
|
|
|
< $(top_builddir)/lib-src/Makefile.android > $@
|
2023-02-10 15:03:43 +00:00
|
|
|
|
|
|
|
.PHONY: $(LIBSRC_BINARIES)
|
2023-03-02 07:59:33 +00:00
|
|
|
$(LIBSRC_BINARIES) &: src/verbose.mk $(top_builddir)/$@ lib/libgnu.a \
|
|
|
|
lib-src/config.h lib-src/Makefile $(PRE_BUILD_DEPS)
|
2023-01-24 02:24:13 +00:00
|
|
|
# Finally, go into lib-src and make everything being built
|
2023-02-10 15:03:43 +00:00
|
|
|
$(MAKE) -C lib-src $(foreach bin,$(LIBSRC_BINARIES),$(notdir $(bin)))
|
2023-01-24 02:24:13 +00:00
|
|
|
|
|
|
|
.PHONY: clean maintainer-clean distclean
|
|
|
|
clean:
|
2023-03-02 07:59:33 +00:00
|
|
|
for dir in $(CLEAN_SUBDIRS); do \
|
|
|
|
find $$dir -type f -delete; \
|
2023-03-05 02:18:28 +00:00
|
|
|
done
|
2023-03-02 07:59:33 +00:00
|
|
|
rm -rf lib/config.h lib-src/config.h
|
2023-03-01 11:34:45 +00:00
|
|
|
# ndk-build won't have been generated in a non-Android build.
|
|
|
|
-make -C ndk-build clean
|
2023-01-24 02:24:13 +00:00
|
|
|
|
2023-03-05 02:18:28 +00:00
|
|
|
maintainer-clean distclean bootstrap-clean: clean
|
|
|
|
# Remove links created by configure.
|
|
|
|
for dir in $(CLEAN_SUBDIRS); do \
|
|
|
|
find $$dir -type l -delete; \
|
|
|
|
done
|
2023-01-24 02:24:13 +00:00
|
|
|
rm -rf lib/Makefile lib/gnulib.mk ndk-build/Makefile
|
2023-01-24 02:37:26 +00:00
|
|
|
rm -rf ndk-build/ndk-build.mk Makefile
|