1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-05 22:20:24 -08:00

More fixes to parallel Make

* cross/ndk-build/ndk-build.mk.in (NDK_BUILD_MODULES)
(NDK_BUILD_SHARED, NDK_BUILD_STATIC): Define group rule to build
all files so that they are built within one make process.
* java/Makefile.in: Reorganize cross compilation and make sure
there is only one make subprocess for each subdirectory of
cross.
This commit is contained in:
Po Lu 2023-02-19 21:52:21 +08:00
parent f319605207
commit 585ee91b21
2 changed files with 36 additions and 19 deletions

View file

@ -17,7 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
# This file is included all over the place to build prerequisites.
# This file is included all over the place to get and build
# prerequisites.
NDK_BUILD_MODULES = @NDK_BUILD_MODULES@
NDK_BUILD_CXX_SHARED = @NDK_BUILD_CXX_SHARED@
@ -33,6 +34,10 @@ endef
# imports a module and also declares it in LOCAL_SHARED_LIBRARIES.
NDK_BUILD_MODULES := $(call uniqify,$(NDK_BUILD_MODULES))
# Here are all of the files to build.
NDK_BUILD_ALL_FILES := $(foreach file,$(NDK_BUILD_MODULES), \
$(top_builddir)/cross/ndk-build/$(file))
# The C++ standard library must be extracted from the Android NDK
# directories and included in the application package, if any module
# requires the C++ standard library.
@ -42,10 +47,6 @@ NDK_BUILD_SHARED += $(NDK_BUILD_CXX_SHARED)
endif
define subr-1
$(top_builddir)/cross/ndk-build/$(1):
$(MAKE) -C $(top_builddir)/cross/ndk-build $(1)
ifeq ($(suffix $(1)),.so)
NDK_BUILD_SHARED += $(top_builddir)/cross/ndk-build/$(1)
else
@ -53,9 +54,15 @@ ifeq ($(suffix $(1)),.a)
NDK_BUILD_STATIC += $(top_builddir)/cross/ndk-build/$(1)
endif
endif
endef
# Generate rules for each module.
$(foreach module,$(NDK_BUILD_MODULES),$(eval $(call subr-1,$(module))))
# Generate rules to build everything now.
# Make sure to use the top_builddir currently defined.
NDK_TOP_BUILDDIR := $(top_builddir)
$(NDK_BUILD_ALL_FILES) &:
$(MAKE) -C $(NDK_TOP_BUILDDIR)/cross/ndk-build $(NDK_BUILD_MODULES)

View file

@ -113,33 +113,43 @@ APK_NAME := emacs-$(version)-$(ANDROID_MIN_SDK)-$(ANDROID_ABI).apk
all: $(APK_NAME)
# Binaries to cross-compile.
CROSS_BINS = ../cross/src/android-emacs ../cross/lib-src/ctags \
../cross/lib-src/hexl ../cross/lib-src/movemail \
../cross/lib-src/ebrowse ../cross/lib-src/emacsclient \
../cross/lib-src/etags
CROSS_SRC_BINS = $(top_builddir)/cross/src/android-emacs
CROSS_LIBSRC_BINS = $(top_builddir)/cross/lib-src/ctags \
$(top_builddir)/cross/lib-src/hexl \
$(top_builddir)/cross/lib-src/movemail \
$(top_builddir)/cross/lib-src/ebrowse \
$(top_builddir)/cross/lib-src/emacsclient \
$(top_builddir)/cross/lib-src/etags
CROSS_BINS = $(CROSS_SRC_BINS) $(CROSS_LIBSRC_BINS)
# Libraries to cross-compile.
CROSS_LIBS = ../cross/src/libemacs.so
CROSS_LIBS = $(top_builddir)/cross/src/libemacs.so
# Make sure gnulib is built first!
# If not, then the recursive invocations of make below will try to
# build gnulib at the same time.
CROSS_ARCHIVES = ../cross/lib/libgnu.a
CROSS_ARCHIVES = $(top_builddir)/cross/lib/libgnu.a
# Third party libraries to compile.
include $(top_builddir)/cross/ndk-build/ndk-build.mk
.PHONY: $(CROSS_BINS) $(CROSS_LIBS) $(CROSS_ARCHIVES)
../cross/src/android-emacs ../cross/src/libemacs.so: $(CROSS_ARCHIVES)
$(MAKE) -C ../cross src/$(notdir $@)
# There should only be a single invocation of $(MAKE) -C
# $(top_srcdir)/cross for each directory under $(top_srcdir)/cross.
$(CROSS_SRC_BINS) $(CROSS_LIBS) &: $(CROSS_ARCHIVES)
$(MAKE) -C $(top_builddir)/cross $(foreach file, \
$(CROSS_SRC_BINS) \
$(CROSS_LIBS), \
src/$(notdir $(file)))
../cross/lib-src/hexl ../cross/lib-src/movemail \
../cross/lib-src/ctags ../cross/lib-src/ebrowse &: $(CROSS_ARCHIVES)
$(MAKE) -C ../cross lib-src/$(notdir $@)
$(CROSS_LIBSRC_BINS) &: $(CROSS_ARCHIVES)
$(MAKE) -C $(top_builddir)/cross $(foreach file, \
$(CROSS_LIBSRC_BINS), \
lib-src/$(notdir $(file)))
../cross/lib/libgnu.a:
$(MAKE) -C ../cross lib/libgnu.a
$(CROSS_ARCHIVES):
$(MAKE) -C $(top_builddir)/cross lib/libgnu.a
# This is needed to generate the ``.directory-tree'' file used by the
# Android emulations of readdir and faccessat.