From 224e313d3bed309a304683c83afe58752cb97e1c Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 3 Sep 2013 23:45:44 -0700 Subject: [PATCH] Makefile improvements. * Makefile.in (lib): Depend on am--refresh, to avoid a race. (src): Remove duplicate dependency on FRC. Invoke just one submake, not two. Avoid the need for 'pwd'. * lwlib/Makefile.in (all): Put this first. Don't use double-colon rules, as they are not portable according to POSIX. Mark as phony. * oldXMenu/Makefile.in (all, tags): Don't use double-colon rules, as they are not portable according to POSIX. Mark as phony. * src/Makefile.in (config.status): Don't use double-colon rules, as they are not portable according to POSIX. Fix shell typo with `; I guess this rule has never been tested? (VCSWITNESS): New macro, to override any environment var. --- ChangeLog | 7 +++++++ Makefile.in | 27 ++++++++++++++------------- lwlib/ChangeLog | 6 ++++++ lwlib/Makefile.in | 5 +++-- oldXMenu/ChangeLog | 6 ++++++ oldXMenu/Makefile.in | 6 ++++-- src/ChangeLog | 8 ++++++++ src/Makefile.in | 14 ++++++-------- 8 files changed, 54 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index ba6c22c13b6..b25d30f42ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2013-09-04 Paul Eggert + + Makefile improvements. + * Makefile.in (lib): Depend on am--refresh, to avoid a race. + (src): Remove duplicate dependency on FRC. + Invoke just one submake, not two. Avoid the need for 'pwd'. + 2013-09-02 Jan Djärv * configure.ac: Add ns_check_file. diff --git a/Makefile.in b/Makefile.in index 8e3a846c8df..204099cc202 100644 --- a/Makefile.in +++ b/Makefile.in @@ -352,9 +352,13 @@ epaths-force-w32: FRC -e "/^.*#/s|@SRC@|$${w32srcdir}|g") && \ ${srcdir}/build-aux/move-if-change epaths.h.$$$$ src/epaths.h +# If lib/Makefile would build files in '.', then build them before +# building 'lib', to avoid races with parallel makes. +lib: am--refresh + lib-src src: $(NTDIR) lib -src: lib-src FRC +src: lib-src # We need to build `emacs' in `src' to compile the *.elc files in `lisp' # and `leim'. @@ -376,18 +380,15 @@ lib lib-src lisp leim nt: Makefile FRC # all preloaded elisp files, and only then dump the actual src/emacs, which # is not wrong, but is overkill in 99.99% of the cases. src: Makefile FRC - boot=bootstrap-emacs$(EXEEXT); \ - if [ ! -x "src/$$boot" ]; then \ - cd $@; $(MAKE) all $(MFLAGS) \ - CC='${CC}' CFLAGS='${CFLAGS}' CPPFLAGS='${CPPFLAGS}' \ - LDFLAGS='${LDFLAGS}' MAKE='${MAKE}' BOOTSTRAPEMACS="$$boot"; \ - fi; - if [ -r .bzr/checkout/dirstate ]; then \ - vcswitness="`pwd`/.bzr/checkout/dirstate"; \ - fi; \ - cd $@; $(MAKE) all $(MFLAGS) \ - CC='${CC}' CFLAGS='${CFLAGS}' CPPFLAGS='${CPPFLAGS}' \ - LDFLAGS='${LDFLAGS}' MAKE='${MAKE}' BOOTSTRAPEMACS="" \ + dirstate='.bzr/checkout/dirstate'; \ + vcswitness='$$(srcdir)/../'$$dirstate; \ + [ -r "$(srcdir)/$$dirstate" ] || vcswitness=''; \ + cd $@ || exit; \ + boot=bootstrap-emacs$(EXEEXT); \ + [ ! -x "$$boot" ] || boot=''; \ + $(MAKE) all $(MFLAGS) \ + CC='${CC}' CFLAGS='${CFLAGS}' CPPFLAGS='${CPPFLAGS}' \ + LDFLAGS='${LDFLAGS}' MAKE='${MAKE}' BOOTSTRAPEMACS="$$boot" \ VCSWITNESS="$$vcswitness" blessmail: Makefile src FRC diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog index a9e424ac4b3..5a1018f85e5 100644 --- a/lwlib/ChangeLog +++ b/lwlib/ChangeLog @@ -1,3 +1,9 @@ +2013-09-04 Paul Eggert + + Makefile improvements. + * Makefile.in (all): Put this first. Don't use double-colon + rules, as they are not portable according to POSIX. Mark as phony. + 2013-06-30 Paul Eggert Fix minor problems found by static checking. diff --git a/lwlib/Makefile.in b/lwlib/Makefile.in index f228221c45d..40f4a405e97 100644 --- a/lwlib/Makefile.in +++ b/lwlib/Makefile.in @@ -59,11 +59,12 @@ ALL_CFLAGS= $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \ -Demacs -I../src \ -I$(srcdir) -I$(srcdir)/../src -I../lib -I$(srcdir)/../lib +all: liblw.a +.PHONY: all + .c.o: $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< -all:: liblw.a - liblw.a: $(OBJS) rm -f $@ $(AR) $(ARFLAGS) $@ $(OBJS) diff --git a/oldXMenu/ChangeLog b/oldXMenu/ChangeLog index 8f2951700e8..21acbe83053 100644 --- a/oldXMenu/ChangeLog +++ b/oldXMenu/ChangeLog @@ -1,3 +1,9 @@ +2013-09-04 Paul Eggert + + Makefile improvements. + * Makefile.in (all, tags): Don't use double-colon rules, as they + are not portable according to POSIX. Mark as phony. + 2012-12-04 Paul Eggert Include uniformly in oldXMenu sources. diff --git a/oldXMenu/Makefile.in b/oldXMenu/Makefile.in index b08e6649cbd..394bfb3ab50 100644 --- a/oldXMenu/Makefile.in +++ b/oldXMenu/Makefile.in @@ -85,7 +85,8 @@ OBJS = Activate.o \ SetSel.o \ XDelAssoc.o XLookAssoc.o XCrAssoc.o XDestAssoc.o XMakeAssoc.o -all:: libXMenu11.a +all: libXMenu11.a +.PHONY: all ALL_CFLAGS=$(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \ $(C_SWITCH_X_SITE) \ @@ -139,5 +140,6 @@ distclean: clean rm -f Makefile maintainer-clean: distclean -tags:: +tags: $(TAGS) -t *.[ch] +.PHONY: tags diff --git a/src/ChangeLog b/src/ChangeLog index c355232482f..39d2f2f412a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2013-09-04 Paul Eggert + + Makefile improvements. + * Makefile.in (config.status): Don't use double-colon rules, as + they are not portable according to POSIX. Fix shell typo with `; + I guess this rule has never been tested? + (VCSWITNESS): New macro, to override any environment var. + 2013-09-04 Dmitry Antipov * xterm.h (struct x_display_info): Do not track X connection diff --git a/src/Makefile.in b/src/Makefile.in index 0e7ff9cbd33..fe8d2d13ce0 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -538,14 +538,9 @@ stamp-oldxmenu: $(OLDXMENU_DEPS) $(OLDXMENU): $(OLDXMENU_TARGET) -../config.status:: epaths.in - @echo "The file epaths.h needs to be set up from epaths.in." - @echo "Please run the `configure' script again." - exit 1 - -../config.status:: config.in - @echo "The file config.h needs to be set up from config.in." - @echo "Please run the `configure' script again." +../config.status: config.in epaths.in + @echo "The file ${?:.in=.h} needs to be set up from $?." + @echo "Please run the 'configure' script again." exit 1 doc.o: buildobj.h @@ -658,6 +653,9 @@ $(lisp): $(BOOTSTRAPEMACS) ## VCSWITNESS points to the file that holds info about the current checkout. ## We use it as a heuristic to decide when to rebuild loaddefs.el. +## If empty it is ignored; the parent makefile can set it to some other value. +VCSWITNESS = + $(lispsource)/loaddefs.el: $(BOOTSTRAPEMACS) $(VCSWITNESS) cd ../lisp; $(MAKE) $(MFLAGS) autoloads EMACS=$(bootstrap_exe) -- 2.11.4.GIT