diff options
| author | Paul Eggert | 2017-03-21 09:59:10 -0700 |
|---|---|---|
| committer | Paul Eggert | 2017-03-21 09:59:31 -0700 |
| commit | bf8cf95d7d13ebc5d351cc2a8048f6695ab9faca (patch) | |
| tree | 1aa66a743bb6b542c2764e4c77979ede678d6881 | |
| parent | 14d8b6858a49e97f9b69593df5a8a7886430d43f (diff) | |
| download | emacs-bf8cf95d7d13ebc5d351cc2a8048f6695ab9faca.tar.gz emacs-bf8cf95d7d13ebc5d351cc2a8048f6695ab9faca.zip | |
Streamline dependency-file generation
* configure.ac (AUTODEPEND_PARENTS): New var.
mkdir the dependency directories here, to simplify ‘make’.
Remove dependency files just before outputting Makefiles, so that
they are preserved if ‘configure’ exits early due to some other problem.
* lib/Makefile.in, lwlib/Makefile.in, oldXMenu/Makefile.in:
* src/Makefile.in: Adjust deps strategies to be similar, as follows:
(MKDEPDIR): Remove. All uses removed. This cuts down on the
number of processes spun off by ‘make’.
(clean mostlyclean): Remove $(DEPDIR) contents, not $(DEPDIR) itself.
(distclean): Remove $(DEPDIR) itself.
* lwlib/Makefile.in (all): Move to front, so that depdir includes
do not alter default action.
| -rw-r--r-- | configure.ac | 13 | ||||
| -rw-r--r-- | lib/Makefile.in | 10 | ||||
| -rw-r--r-- | lwlib/Makefile.in | 28 | ||||
| -rw-r--r-- | oldXMenu/Makefile.in | 22 | ||||
| -rw-r--r-- | src/Makefile.in | 25 |
5 files changed, 36 insertions, 62 deletions
diff --git a/configure.ac b/configure.ac index 48fcb3f33aa..833aaa5eb27 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -1730,6 +1730,7 @@ dnl AC_C_BIGENDIAN is done by gnulib. | |||
| 1730 | dnl check for Make feature | 1730 | dnl check for Make feature |
| 1731 | 1731 | ||
| 1732 | AUTO_DEPEND=no | 1732 | AUTO_DEPEND=no |
| 1733 | AUTODEPEND_PARENTS='lib src' | ||
| 1733 | dnl check if we have GCC and autodepend is on. | 1734 | dnl check if we have GCC and autodepend is on. |
| 1734 | if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then | 1735 | if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then |
| 1735 | AC_MSG_CHECKING([whether gcc understands -MMD -MF]) | 1736 | AC_MSG_CHECKING([whether gcc understands -MMD -MF]) |
| @@ -1742,9 +1743,6 @@ if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then | |||
| 1742 | AC_MSG_RESULT([$ac_enable_autodepend]) | 1743 | AC_MSG_RESULT([$ac_enable_autodepend]) |
| 1743 | if test $ac_enable_autodepend = yes; then | 1744 | if test $ac_enable_autodepend = yes; then |
| 1744 | AUTO_DEPEND=yes | 1745 | AUTO_DEPEND=yes |
| 1745 | for depdir in */deps; do | ||
| 1746 | test ! -d "$depdir" || rm -fr "$depdir"/../*.o "$depdir" || exit | ||
| 1747 | done | ||
| 1748 | fi | 1746 | fi |
| 1749 | fi | 1747 | fi |
| 1750 | AC_SUBST(AUTO_DEPEND) | 1748 | AC_SUBST(AUTO_DEPEND) |
| @@ -5016,8 +5014,10 @@ if test "$HAVE_GTK" = yes || test "$HAVE_X11" != yes; then | |||
| 5016 | LIBXMENU= | 5014 | LIBXMENU= |
| 5017 | elif test "$USE_X_TOOLKIT" = none; then | 5015 | elif test "$USE_X_TOOLKIT" = none; then |
| 5018 | LIBXMENU='$(oldXMenudir)/libXMenu11.a' | 5016 | LIBXMENU='$(oldXMenudir)/libXMenu11.a' |
| 5017 | AUTODEPEND_PARENTS="$AUTODEPEND_PARENTS oldXMenu" | ||
| 5019 | else | 5018 | else |
| 5020 | LIBXMENU='$(lwlibdir)/liblw.a' | 5019 | LIBXMENU='$(lwlibdir)/liblw.a' |
| 5020 | AUTODEPEND_PARENTS="$AUTODEPEND_PARENTS lwlib" | ||
| 5021 | fi | 5021 | fi |
| 5022 | AC_SUBST(LIBXMENU) | 5022 | AC_SUBST(LIBXMENU) |
| 5023 | 5023 | ||
| @@ -5473,6 +5473,13 @@ ${MAKE-make} -s MAKEFILE_NAME=do-not-make-Makefile etc-emacsver || \ | |||
| 5473 | AC_MSG_ERROR(['etc/refcards/emacsver.tex' could not be made.]) | 5473 | AC_MSG_ERROR(['etc/refcards/emacsver.tex' could not be made.]) |
| 5474 | ]) | 5474 | ]) |
| 5475 | 5475 | ||
| 5476 | if test $AUTO_DEPEND = yes; then | ||
| 5477 | for dir in $AUTODEPEND_PARENTS; do | ||
| 5478 | rm -f $dir/*.o $dir/deps/* | ||
| 5479 | AS_MKDIR_P([$dir/deps]) | ||
| 5480 | done | ||
| 5481 | fi | ||
| 5482 | |||
| 5476 | AC_OUTPUT | 5483 | AC_OUTPUT |
| 5477 | 5484 | ||
| 5478 | if test ! "$with_mailutils"; then | 5485 | if test ! "$with_mailutils"; then |
diff --git a/lib/Makefile.in b/lib/Makefile.in index 4e51ac6b029..832704f3a8d 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in | |||
| @@ -65,16 +65,12 @@ ifneq ($(SYSTEM_TYPE),windows-nt) | |||
| 65 | libgnu_a_SOURCES += openat-die.c save-cwd.c | 65 | libgnu_a_SOURCES += openat-die.c save-cwd.c |
| 66 | endif | 66 | endif |
| 67 | 67 | ||
| 68 | # Dependencies. When !AUTO_DEPEND, don't bother with a dependencies file, | ||
| 69 | # as the default dependencies are often adequate. | ||
| 70 | DEPDIR = deps | 68 | DEPDIR = deps |
| 71 | ifeq ($(AUTO_DEPEND),yes) | 69 | ifeq ($(AUTO_DEPEND),yes) |
| 72 | DEPFLAGS = -MMD -MF $(DEPDIR)/$*.d -MP | 70 | DEPFLAGS = -MMD -MF $(DEPDIR)/$*.d -MP |
| 73 | MKDEPDIR = $(MKDIR_P) $(DEPDIR) | ||
| 74 | -include $(ALLOBJS:%.o=$(DEPDIR)/%.d) | 71 | -include $(ALLOBJS:%.o=$(DEPDIR)/%.d) |
| 75 | else | 72 | else |
| 76 | DEPFLAGS = | 73 | DEPFLAGS = |
| 77 | MKDEPDIR = : | ||
| 78 | endif | 74 | endif |
| 79 | 75 | ||
| 80 | .PRECIOUS: ../config.status Makefile | 76 | .PRECIOUS: ../config.status Makefile |
| @@ -90,10 +86,8 @@ libegnu_a_OBJECTS = $(patsubst %.o,e-%.o,$(libgnu_a_OBJECTS)) | |||
| 90 | $(libegnu_a_OBJECTS) $(libgnu_a_OBJECTS): $(BUILT_SOURCES) | 86 | $(libegnu_a_OBJECTS) $(libgnu_a_OBJECTS): $(BUILT_SOURCES) |
| 91 | 87 | ||
| 92 | .c.o: | 88 | .c.o: |
| 93 | @$(MKDEPDIR) | ||
| 94 | $(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< | 89 | $(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< |
| 95 | e-%.o: %.c | 90 | e-%.o: %.c |
| 96 | @$(MKDEPDIR) | ||
| 97 | $(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -Demacs -o $@ $< | 91 | $(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -Demacs -o $@ $< |
| 98 | 92 | ||
| 99 | all: libgnu.a $(if $(HYBRID_MALLOC),libegnu.a) | 93 | all: libgnu.a $(if $(HYBRID_MALLOC),libegnu.a) |
| @@ -118,10 +112,10 @@ TAGS: $(ETAGS) $(tagsfiles) | |||
| 118 | .PHONY: $(ETAGS) tags | 112 | .PHONY: $(ETAGS) tags |
| 119 | 113 | ||
| 120 | clean mostlyclean: | 114 | clean mostlyclean: |
| 121 | rm -f *.[ao] \#* | 115 | rm -f *.[ao] \#* $(DEPDIR)/* |
| 122 | -rm -rf $(DEPDIR) | ||
| 123 | distclean: clean | 116 | distclean: clean |
| 124 | rm -f Makefile $(BUILT_SOURCES) | 117 | rm -f Makefile $(BUILT_SOURCES) |
| 118 | rm -fr $(DEPDIR) | ||
| 125 | bootstrap-clean: distclean | 119 | bootstrap-clean: distclean |
| 126 | rm -f TAGS | 120 | rm -f TAGS |
| 127 | maintainer-clean: bootstrap-clean | 121 | maintainer-clean: bootstrap-clean |
diff --git a/lwlib/Makefile.in b/lwlib/Makefile.in index d6a8f50ce74..ee7a2040e89 100644 --- a/lwlib/Makefile.in +++ b/lwlib/Makefile.in | |||
| @@ -22,6 +22,9 @@ | |||
| 22 | # This was taken from the output of Imake using Lucid's Imakefile. | 22 | # This was taken from the output of Imake using Lucid's Imakefile. |
| 23 | # and set up to be configured by ../configure. | 23 | # and set up to be configured by ../configure. |
| 24 | 24 | ||
| 25 | all: liblw.a | ||
| 26 | .PHONY: all | ||
| 27 | |||
| 25 | srcdir=@srcdir@ | 28 | srcdir=@srcdir@ |
| 26 | # MinGW CPPFLAGS may use this. | 29 | # MinGW CPPFLAGS may use this. |
| 27 | abs_top_srcdir=@abs_top_srcdir@ | 30 | abs_top_srcdir=@abs_top_srcdir@ |
| @@ -71,15 +74,14 @@ am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) | |||
| 71 | am__v_at_0 = @ | 74 | am__v_at_0 = @ |
| 72 | am__v_at_1 = | 75 | am__v_at_1 = |
| 73 | 76 | ||
| 74 | DEPDIR = deps | ||
| 75 | AUTO_DEPEND = @AUTO_DEPEND@ | 77 | AUTO_DEPEND = @AUTO_DEPEND@ |
| 76 | 78 | DEPDIR = deps | |
| 77 | ifeq ($(AUTO_DEPEND),yes) | 79 | ifeq ($(AUTO_DEPEND),yes) |
| 78 | DEPFLAGS = -MMD -MF ${DEPDIR}/$*.d -MP | 80 | DEPFLAGS = -MMD -MF $(DEPDIR)/$*.d -MP |
| 79 | MKDEPDIR = ${MKDIR_P} ${DEPDIR} | 81 | -include $(ALLOBJS:%.o=$(DEPDIR)/%.d) |
| 80 | else | 82 | else |
| 81 | DEPFLAGS = | 83 | DEPFLAGS = |
| 82 | MKDEPDIR = : | 84 | include $(srcdir)/deps.mk |
| 83 | endif | 85 | endif |
| 84 | 86 | ||
| 85 | ## ../src is where the generated file (config.h, globals.h) are. | 87 | ## ../src is where the generated file (config.h, globals.h) are. |
| @@ -94,11 +96,7 @@ ALL_CFLAGS= $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \ | |||
| 94 | -Demacs -I../src \ | 96 | -Demacs -I../src \ |
| 95 | -I$(srcdir) -I$(srcdir)/../src -I../lib -I$(srcdir)/../lib | 97 | -I$(srcdir) -I$(srcdir)/../src -I../lib -I$(srcdir)/../lib |
| 96 | 98 | ||
| 97 | all: liblw.a | ||
| 98 | .PHONY: all | ||
| 99 | |||
| 100 | .c.o: | 99 | .c.o: |
| 101 | @$(MKDEPDIR) | ||
| 102 | $(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< | 100 | $(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< |
| 103 | 101 | ||
| 104 | liblw.a: $(OBJS) | 102 | liblw.a: $(OBJS) |
| @@ -110,20 +108,14 @@ globals_h = ../src/globals.h | |||
| 110 | $(globals_h): | 108 | $(globals_h): |
| 111 | $(MAKE) -C ../src globals.h | 109 | $(MAKE) -C ../src globals.h |
| 112 | 110 | ||
| 113 | ifeq ($(AUTO_DEPEND),yes) | ||
| 114 | -include $(ALLOBJS:%.o=${DEPDIR}/%.d) | ||
| 115 | else | ||
| 116 | include $(srcdir)/deps.mk | ||
| 117 | endif | ||
| 118 | |||
| 119 | .PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean | 111 | .PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean |
| 120 | 112 | ||
| 121 | clean mostlyclean: | 113 | clean mostlyclean: |
| 122 | rm -f *.o liblw.a \#* | 114 | rm -f *.o liblw.a \#* $(DEPDIR)/* |
| 123 | -rm -rf ${DEPDIR} | ||
| 124 | 115 | ||
| 125 | distclean: clean | 116 | distclean: clean |
| 126 | rm -f Makefile | 117 | rm -f Makefile |
| 118 | rm -fr $(DEPDIR) | ||
| 127 | 119 | ||
| 128 | bootstrap-clean maintainer-clean: distclean | 120 | bootstrap-clean maintainer-clean: distclean |
| 129 | rm -f TAGS | 121 | rm -f TAGS |
diff --git a/oldXMenu/Makefile.in b/oldXMenu/Makefile.in index 46061ab7ae4..7a5c9985920 100644 --- a/oldXMenu/Makefile.in +++ b/oldXMenu/Makefile.in | |||
| @@ -111,15 +111,14 @@ am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) | |||
| 111 | am__v_at_0 = @ | 111 | am__v_at_0 = @ |
| 112 | am__v_at_1 = | 112 | am__v_at_1 = |
| 113 | 113 | ||
| 114 | DEPDIR = deps | ||
| 115 | AUTO_DEPEND = @AUTO_DEPEND@ | 114 | AUTO_DEPEND = @AUTO_DEPEND@ |
| 116 | 115 | DEPDIR = deps | |
| 117 | ifeq ($(AUTO_DEPEND),yes) | 116 | ifeq ($(AUTO_DEPEND),yes) |
| 118 | DEPFLAGS = -MMD -MF ${DEPDIR}/$*.d -MP | 117 | DEPFLAGS = -MMD -MF $(DEPDIR)/$*.d -MP |
| 119 | MKDEPDIR = ${MKDIR_P} ${DEPDIR} | 118 | -include $(ALLOBJS:%.o=$(DEPDIR)/%.d) |
| 120 | else | 119 | else |
| 121 | DEPFLAGS = | 120 | DEPFLAGS = |
| 122 | MKDEPDIR = : | 121 | include $(srcdir)/deps.mk |
| 123 | endif | 122 | endif |
| 124 | 123 | ||
| 125 | ALL_CFLAGS=$(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \ | 124 | ALL_CFLAGS=$(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \ |
| @@ -129,7 +128,6 @@ ALL_CFLAGS=$(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \ | |||
| 129 | -I../src -I../lib -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib | 128 | -I../src -I../lib -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib |
| 130 | 129 | ||
| 131 | .c.o: | 130 | .c.o: |
| 132 | @$(MKDEPDIR) | ||
| 133 | $(AM_V_CC)$(CC) -c ${ALL_CFLAGS} $< | 131 | $(AM_V_CC)$(CC) -c ${ALL_CFLAGS} $< |
| 134 | 132 | ||
| 135 | libXMenu11.a: $(OBJS) $(EXTRA) | 133 | libXMenu11.a: $(OBJS) $(EXTRA) |
| @@ -137,20 +135,14 @@ libXMenu11.a: $(OBJS) $(EXTRA) | |||
| 137 | $(AM_V_at)$(AR) $(ARFLAGS) $@ $(OBJS) $(EXTRA) | 135 | $(AM_V_at)$(AR) $(ARFLAGS) $@ $(OBJS) $(EXTRA) |
| 138 | $(AM_V_at)$(RANLIB) $@ | 136 | $(AM_V_at)$(RANLIB) $@ |
| 139 | 137 | ||
| 140 | ifeq ($(AUTO_DEPEND),yes) | ||
| 141 | -include $(ALLOBJS:%.o=${DEPDIR}/%.d) | ||
| 142 | else | ||
| 143 | include $(srcdir)/deps.mk | ||
| 144 | endif | ||
| 145 | |||
| 146 | .PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean | 138 | .PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean |
| 147 | 139 | ||
| 148 | clean mostlyclean: | 140 | clean mostlyclean: |
| 149 | rm -f libXMenu11.a *.o | 141 | rm -f libXMenu11.a *.o $(DEPDIR)/* |
| 150 | -rm -rf ${DEPDIR} | ||
| 151 | 142 | ||
| 152 | bootstrap-clean maintainer-clean distclean: clean | 143 | bootstrap-clean maintainer-clean distclean: clean |
| 153 | rm -f Makefile | 144 | rm -f Makefile |
| 145 | rm -fr $(DEPDIR) | ||
| 154 | 146 | ||
| 155 | ETAGS = ../lib-src/etags${EXEEXT} | 147 | ETAGS = ../lib-src/etags${EXEEXT} |
| 156 | 148 | ||
diff --git a/src/Makefile.in b/src/Makefile.in index 60aa6866718..5a3d0bd0445 100644 --- a/src/Makefile.in +++ b/src/Makefile.in | |||
| @@ -347,15 +347,14 @@ am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) | |||
| 347 | am__v_at_0 = @ | 347 | am__v_at_0 = @ |
| 348 | am__v_at_1 = | 348 | am__v_at_1 = |
| 349 | 349 | ||
| 350 | DEPDIR=deps | ||
| 351 | AUTO_DEPEND = @AUTO_DEPEND@ | 350 | AUTO_DEPEND = @AUTO_DEPEND@ |
| 352 | 351 | DEPDIR = deps | |
| 353 | ifeq ($(AUTO_DEPEND),yes) | 352 | ifeq ($(AUTO_DEPEND),yes) |
| 354 | DEPFLAGS = -MMD -MF ${DEPDIR}/$*.d -MP | 353 | DEPFLAGS = -MMD -MF $(DEPDIR)/$*.d -MP |
| 355 | MKDEPDIR = ${MKDIR_P} ${DEPDIR} | 354 | -include $(ALLOBJS:%.o=$(DEPDIR)/%.d) |
| 356 | else | 355 | else |
| 357 | DEPFLAGS = | 356 | DEPFLAGS = |
| 358 | MKDEPDIR = : | 357 | include $(srcdir)/deps.mk |
| 359 | endif | 358 | endif |
| 360 | 359 | ||
| 361 | # Flags that might be in WARN_CFLAGS but are not valid for Objective C. | 360 | # Flags that might be in WARN_CFLAGS but are not valid for Objective C. |
| @@ -383,10 +382,8 @@ ALL_OBJC_CFLAGS = $(EMACS_CFLAGS) \ | |||
| 383 | 382 | ||
| 384 | .SUFFIXES: .m | 383 | .SUFFIXES: .m |
| 385 | .c.o: | 384 | .c.o: |
| 386 | @$(MKDEPDIR) | ||
| 387 | $(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $(PROFILING_CFLAGS) $< | 385 | $(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $(PROFILING_CFLAGS) $< |
| 388 | .m.o: | 386 | .m.o: |
| 389 | @$(MKDEPDIR) | ||
| 390 | $(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_OBJC_CFLAGS) $(PROFILING_CFLAGS) $< | 387 | $(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_OBJC_CFLAGS) $(PROFILING_CFLAGS) $< |
| 391 | 388 | ||
| 392 | ## lastfile must follow all files whose initialized data areas should | 389 | ## lastfile must follow all files whose initialized data areas should |
| @@ -650,8 +647,7 @@ mostlyclean: | |||
| 650 | rm -f globals.h gl-stamp | 647 | rm -f globals.h gl-stamp |
| 651 | rm -f *.res *.tmp | 648 | rm -f *.res *.tmp |
| 652 | clean: mostlyclean | 649 | clean: mostlyclean |
| 653 | rm -f emacs-*.*.*$(EXEEXT) emacs$(EXEEXT) | 650 | rm -f emacs-*.*.*$(EXEEXT) emacs$(EXEEXT) $(DEPDIR)/* |
| 654 | -rm -rf $(DEPDIR) | ||
| 655 | 651 | ||
| 656 | ## bootstrap-clean is used to clean up just before a bootstrap. | 652 | ## bootstrap-clean is used to clean up just before a bootstrap. |
| 657 | ## It should remove all files generated during a compilation/bootstrap, | 653 | ## It should remove all files generated during a compilation/bootstrap, |
| @@ -666,6 +662,7 @@ bootstrap-clean: clean | |||
| 666 | 662 | ||
| 667 | distclean: bootstrap-clean | 663 | distclean: bootstrap-clean |
| 668 | rm -f Makefile lisp.mk | 664 | rm -f Makefile lisp.mk |
| 665 | rm -fr $(DEPDIR) | ||
| 669 | 666 | ||
| 670 | maintainer-clean: distclean | 667 | maintainer-clean: distclean |
| 671 | rm -f TAGS | 668 | rm -f TAGS |
| @@ -755,11 +752,3 @@ else | |||
| 755 | endif | 752 | endif |
| 756 | @: Compile some files earlier to speed up further compilation. | 753 | @: Compile some files earlier to speed up further compilation. |
| 757 | $(MAKE) -C ../lisp compile-first EMACS="$(bootstrap_exe)" | 754 | $(MAKE) -C ../lisp compile-first EMACS="$(bootstrap_exe)" |
| 758 | |||
| 759 | ifeq ($(AUTO_DEPEND),yes) | ||
| 760 | -include $(ALLOBJS:%.o=${DEPDIR}/%.d) | ||
| 761 | else | ||
| 762 | include $(srcdir)/deps.mk | ||
| 763 | endif | ||
| 764 | |||
| 765 | ### Makefile.in ends here | ||