emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/android 585ee91b21f 8/9: More fixes to parallel Make


From: Po Lu
Subject: feature/android 585ee91b21f 8/9: More fixes to parallel Make
Date: Sun, 19 Feb 2023 09:14:48 -0500 (EST)

branch: feature/android
commit 585ee91b21fb6f1889226b5861333410275dc017
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    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.
---
 cross/ndk-build/ndk-build.mk.in | 19 +++++++++++++------
 java/Makefile.in                | 40 +++++++++++++++++++++++++---------------
 2 files changed, 38 insertions(+), 21 deletions(-)

diff --git a/cross/ndk-build/ndk-build.mk.in b/cross/ndk-build/ndk-build.mk.in
index 5b0aa82856d..57006901721 100644
--- a/cross/ndk-build/ndk-build.mk.in
+++ b/cross/ndk-build/ndk-build.mk.in
@@ -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)
diff --git a/java/Makefile.in b/java/Makefile.in
index 52e0a7a75f1..482419f07fa 100644
--- a/java/Makefile.in
+++ b/java/Makefile.in
@@ -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 $@)
-
-../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/lib/libgnu.a:
-       $(MAKE) -C ../cross lib/libgnu.a
+# 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_LIBSRC_BINS) &: $(CROSS_ARCHIVES)
+       $(MAKE) -C $(top_builddir)/cross $(foreach file,                \
+                                          $(CROSS_LIBSRC_BINS),        \
+                                          lib-src/$(notdir $(file)))
+
+$(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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]