From d82603747564063f908c9c877449c827a9808528 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 9 Apr 2019 15:42:10 -0700 Subject: [PATCH] Remove the need for temacs.in MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Instead of building a file temacs.in used only to compute a fingerprint, compute the fingerprint directly from the .o and .a files that go into temacs.in. This speeds up the build by avoiding the need to link temacs twice, once with a dummy fingerprint. * lib-src/make-fingerprint.c (main): No need to generate a fingerprint file that includes config.h, now that fingerprint.c depends on all the .o files. * src/Makefile.in ($(libsrc)/make-fingerprint$(EXEEXT)): Use the same rule as $(libsrc)/make-docfile$(EXEEXT). * src/fingerprint-dummy.c: Remove. * src/Makefile.in (${charsets}, $(libsrc)/make-docfile$(EXEEXT)) ($(LIBEGNU_ARCHIVE), $(lwlibdir)/liblw.a, $(oldXMenudir)/libXMenu11.a) (../config.status, ${ETAGS}, ../lisp/TAGS, $(lwlibdir)/TAGS) ($(lispsource)/loaddefs.el): Prefer ‘$(MAKE) -C $(dir $@)’ to ‘${MAKE} -C SOMESTRING’ when either will do, as the former is more regular and lets us coalesce rules better. (EMACS_DEPS_PRE, EMACS_DEPS_POST, BUILD_EMACS_PRE) (BUILD_EMACS_POST, temacs.in$(EXEEXT)): Remove. (FINGERPRINTED): New macro. (fingerprint.c): Use it instead of temacs.in$(EXEEXT), to avoid the need to build temacs.in at all. (temacs$(EXEEXT)): No need to depend on other .o files now; fingerprint.o is enough, since it depends on the rest. Spell out what used to be in BUILD_EMACS_PRE and BUILD_EMACS_POST. (mostlyclean): No need to remove temacs.in. --- .gitignore | 1 - lib-src/make-fingerprint.c | 6 ++--- src/Makefile.in | 53 ++++++++++++++------------------------ src/fingerprint-dummy.c | 25 ------------------ 4 files changed, 23 insertions(+), 62 deletions(-) delete mode 100644 src/fingerprint-dummy.c diff --git a/.gitignore b/.gitignore index bd5a8e79471..98b8222180b 100644 --- a/.gitignore +++ b/.gitignore @@ -185,7 +185,6 @@ src/bootstrap-emacs src/emacs src/emacs-[0-9]* src/temacs -src/temacs.in src/fingerprint.c src/*.pdmp diff --git a/lib-src/make-fingerprint.c b/lib-src/make-fingerprint.c index 4bfeaa0742c..35bb8b98a00 100644 --- a/lib-src/make-fingerprint.c +++ b/lib-src/make-fingerprint.c @@ -99,9 +99,9 @@ main (int argc, char **argv) } else { - puts ("#include \n" - "#include \"fingerprint.h\"\n" - "unsigned char const fingerprint[] = {"); + puts ("#include \"fingerprint.h\"\n" + "unsigned char const fingerprint[] =\n" + "{"); for (int i = 0; i < 32; ++i) printf ("\t0x%02X,\n", digest[i]); puts ("};"); diff --git a/src/Makefile.in b/src/Makefile.in index 0613a0dbed4..f8a2ffadc27 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -533,7 +533,7 @@ ${lispintdir}/cp51932.el ${lispintdir}/eucjp-ms.el: FORCE charsets = ${top_srcdir}/admin/charsets/charsets.stamp ${charsets}: FORCE - ${MAKE} -C ../admin/charsets all + $(MAKE) -C $(dir $@) all charscript = ${lispintdir}/charscript.el ${charscript}: FORCE @@ -584,8 +584,9 @@ $(etc)/DOC: lisp.mk $(libsrc)/make-docfile$(EXEEXT) $(obj) $(lisp) $(AM_V_at)$(libsrc)/make-docfile -a $(etc)/DOC -d $(lispsource) \ $(shortlisp) -$(libsrc)/make-docfile$(EXEEXT): $(lib)/libgnu.a - $(MAKE) -C $(libsrc) make-docfile$(EXEEXT) +$(libsrc)/make-docfile$(EXEEXT) $(libsrc)/make-fingerprint$(EXEEXT): \ + $(lib)/libgnu.a + $(MAKE) -C $(dir $@) $(notdir $@) buildobj.h: Makefile $(AM_V_GEN)for i in $(ALLOBJS); do \ @@ -613,32 +614,21 @@ $(ALLOBJS): globals.h LIBEGNU_ARCHIVE = $(lib)/lib$(if $(HYBRID_MALLOC),e)gnu.a $(LIBEGNU_ARCHIVE): $(config_h) - $(MAKE) -C $(lib) all + $(MAKE) -C $(dir $@) all -EMACS_DEPS_PRE=$(LIBXMENU) $(ALLOBJS) -EMACS_DEPS_POST=$(LIBEGNU_ARCHIVE) $(EMACSRES) ${charsets} ${charscript} -BUILD_EMACS_PRE=$(AM_V_CCLD)$(CC) $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(LDFLAGS) \ - -o $@ $(ALLOBJS) -BUILD_EMACS_POST=$(LIBEGNU_ARCHIVE) $(W32_RES_LINK) $(LIBES) - -## We hash this file to generate the build fingerprint -temacs.in$(EXEEXT): $(EMACS_DEPS_PRE) fingerprint-dummy.o $(EMACS_DEPS_POST) - $(BUILD_EMACS_PRE) fingerprint-dummy.o $(BUILD_EMACS_POST) - -$(libsrc)/make-fingerprint$(EXEEXT): $(libsrc)/make-fingerprint.c $(lib)/libgnu.a - $(MAKE) -C $(libsrc) make-fingerprint$(EXEEXT) - -fingerprint.c: temacs.in$(EXEEXT) $(libsrc)/make-fingerprint$(EXEEXT) - $(AM_V_GEN)$(libsrc)/make-fingerprint$(EXEEXT) temacs.in$(EXEEXT) \ - >$@.tmp +FINGERPRINTED = $(LIBXMENU) $(ALLOBJS) $(LIBEGNU_ARCHIVE) $(EMACSRES) +fingerprint.c: $(FINGERPRINTED) $(libsrc)/make-fingerprint$(EXEEXT) + $(AM_V_GEN)$(libsrc)/make-fingerprint$(EXEEXT) $(FINGERPRINTED) >$@.tmp $(AM_V_at)mv $@.tmp $@ ## We have to create $(etc) here because init_cmdargs tests its ## existence when setting Vinstallation_directory (FIXME?). ## This goes on to affect various things, and the emacs binary fails ## to start if Vinstallation_directory has the wrong value. -temacs$(EXEEXT): $(EMACS_DEPS_PRE) fingerprint.o $(EMACS_DEPS_POST) - $(BUILD_EMACS_PRE) fingerprint.o $(BUILD_EMACS_POST) +temacs$(EXEEXT): fingerprint.o $(charsets) $(charscript) + $(AM_V_CCLD)$(CC) -o $@ $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(LDFLAGS) \ + $(ALLOBJS) fingerprint.o \ + $(LIBEGNU_ARCHIVE) $(W32_RES_LINK) $(LIBES) $(MKDIR_P) $(etc) ifeq ($(DUMPING),unexec) ifneq ($(PAXCTL_notdumped),) @@ -649,15 +639,15 @@ endif ## The following oldxmenu-related rules are only (possibly) used if ## HAVE_X11 && !USE_GTK, but there is no harm in always defining them. $(lwlibdir)/liblw.a: $(config_h) globals.h lisp.h FORCE - $(MAKE) -C $(lwlibdir) liblw.a + $(MAKE) -C $(dir $@) $(notdir $@) $(oldXMenudir)/libXMenu11.a: FORCE - $(MAKE) -C $(oldXMenudir) libXMenu11.a + $(MAKE) -C $(dir $@) $(notdir $@) FORCE: .PHONY: FORCE .PRECIOUS: ../config.status Makefile ../config.status: $(top_srcdir)/configure.ac $(top_srcdir)/m4/*.m4 - $(MAKE) -C .. $(notdir $@) + $(MAKE) -C $(dir $@) $(notdir $@) Makefile: ../config.status $(srcdir)/Makefile.in $(MAKE) -C .. src/$@ @@ -675,7 +665,7 @@ ns-app: emacs$(EXEEXT) $(pdmp) mostlyclean: rm -f temacs$(EXEEXT) core ./*.core \#* ./*.o - rm -f temacs.in$(EXEEXT) fingerprint.c + rm -f fingerprint.c rm -f emacs.pdmp rm -f ../etc/DOC rm -f bootstrap-emacs$(EXEEXT) $(bootstrap_pdmp) @@ -713,7 +703,7 @@ extraclean: distclean ETAGS = ../lib-src/etags${EXEEXT} ${ETAGS}: FORCE - ${MAKE} -C ../lib-src $(notdir $@) + $(MAKE) -C $(dir $@) $(notdir $@) # Remove macuvs.h and fingerprint.c since they'd cause `src/emacs` # to be built before we can get TAGS. @@ -738,11 +728,8 @@ TAGS: ${ETAGS} $(ctagsfiles1) $(ctagsfiles2) ## Arrange to make tags tables for ../lisp and ../lwlib, ## which the above TAGS file for the C files includes by reference. -../lisp/TAGS: FORCE - $(MAKE) -C ../lisp TAGS ETAGS="$(ETAGS)" - -$(lwlibdir)/TAGS: FORCE - $(MAKE) -C $(lwlibdir) TAGS ETAGS="$(ETAGS)" +../lisp/TAGS $(lwlibdir)/TAGS: FORCE + $(MAKE) -C $(dir $@) $(notdir $@) ETAGS="$(ETAGS)" tags: TAGS ../lisp/TAGS $(lwlibdir)/TAGS .PHONY: tags @@ -778,7 +765,7 @@ VCSWITNESS = $(lispsource)/loaddefs.el: $(VCSWITNESS) | \ bootstrap-emacs$(EXEEXT) $(bootstrap_pdmp) - $(MAKE) -C ../lisp autoloads EMACS="$(bootstrap_exe)" + $(MAKE) -C $(dir $@) autoloads EMACS="$(bootstrap_exe)" ## Dump an Emacs executable named bootstrap-emacs containing the ## files from loadup.el in source form. diff --git a/src/fingerprint-dummy.c b/src/fingerprint-dummy.c deleted file mode 100644 index 04938bd1d08..00000000000 --- a/src/fingerprint-dummy.c +++ /dev/null @@ -1,25 +0,0 @@ -/* Dummy fingerprint - -Copyright (C) 2016, 2018-2019 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 . */ - -#include - -#include "fingerprint.h" - -/* Dummy fingerprint to use as hash input. */ -unsigned char const fingerprint[32] = { 0 }; -- 2.39.2