aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2017-03-21 09:59:10 -0700
committerPaul Eggert2017-03-21 09:59:31 -0700
commitbf8cf95d7d13ebc5d351cc2a8048f6695ab9faca (patch)
tree1aa66a743bb6b542c2764e4c77979ede678d6881
parent14d8b6858a49e97f9b69593df5a8a7886430d43f (diff)
downloademacs-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.ac13
-rw-r--r--lib/Makefile.in10
-rw-r--r--lwlib/Makefile.in28
-rw-r--r--oldXMenu/Makefile.in22
-rw-r--r--src/Makefile.in25
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.
1730dnl check for Make feature 1730dnl check for Make feature
1731 1731
1732AUTO_DEPEND=no 1732AUTO_DEPEND=no
1733AUTODEPEND_PARENTS='lib src'
1733dnl check if we have GCC and autodepend is on. 1734dnl check if we have GCC and autodepend is on.
1734if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then 1735if 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
1749fi 1747fi
1750AC_SUBST(AUTO_DEPEND) 1748AC_SUBST(AUTO_DEPEND)
@@ -5016,8 +5014,10 @@ if test "$HAVE_GTK" = yes || test "$HAVE_X11" != yes; then
5016 LIBXMENU= 5014 LIBXMENU=
5017elif test "$USE_X_TOOLKIT" = none; then 5015elif test "$USE_X_TOOLKIT" = none; then
5018 LIBXMENU='$(oldXMenudir)/libXMenu11.a' 5016 LIBXMENU='$(oldXMenudir)/libXMenu11.a'
5017 AUTODEPEND_PARENTS="$AUTODEPEND_PARENTS oldXMenu"
5019else 5018else
5020 LIBXMENU='$(lwlibdir)/liblw.a' 5019 LIBXMENU='$(lwlibdir)/liblw.a'
5020 AUTODEPEND_PARENTS="$AUTODEPEND_PARENTS lwlib"
5021fi 5021fi
5022AC_SUBST(LIBXMENU) 5022AC_SUBST(LIBXMENU)
5023 5023
@@ -5473,6 +5473,13 @@ ${MAKE-make} -s MAKEFILE_NAME=do-not-make-Makefile etc-emacsver || \
5473AC_MSG_ERROR(['etc/refcards/emacsver.tex' could not be made.]) 5473AC_MSG_ERROR(['etc/refcards/emacsver.tex' could not be made.])
5474]) 5474])
5475 5475
5476if 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
5481fi
5482
5476AC_OUTPUT 5483AC_OUTPUT
5477 5484
5478if test ! "$with_mailutils"; then 5485if 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
66endif 66endif
67 67
68# Dependencies. When !AUTO_DEPEND, don't bother with a dependencies file,
69# as the default dependencies are often adequate.
70DEPDIR = deps 68DEPDIR = deps
71ifeq ($(AUTO_DEPEND),yes) 69ifeq ($(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)
75else 72else
76 DEPFLAGS = 73 DEPFLAGS =
77 MKDEPDIR = :
78endif 74endif
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) $<
95e-%.o: %.c 90e-%.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
99all: libgnu.a $(if $(HYBRID_MALLOC),libegnu.a) 93all: libgnu.a $(if $(HYBRID_MALLOC),libegnu.a)
@@ -118,10 +112,10 @@ TAGS: $(ETAGS) $(tagsfiles)
118.PHONY: $(ETAGS) tags 112.PHONY: $(ETAGS) tags
119 113
120clean mostlyclean: 114clean mostlyclean:
121 rm -f *.[ao] \#* 115 rm -f *.[ao] \#* $(DEPDIR)/*
122 -rm -rf $(DEPDIR)
123distclean: clean 116distclean: clean
124 rm -f Makefile $(BUILT_SOURCES) 117 rm -f Makefile $(BUILT_SOURCES)
118 rm -fr $(DEPDIR)
125bootstrap-clean: distclean 119bootstrap-clean: distclean
126 rm -f TAGS 120 rm -f TAGS
127maintainer-clean: bootstrap-clean 121maintainer-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
25all: liblw.a
26.PHONY: all
27
25srcdir=@srcdir@ 28srcdir=@srcdir@
26# MinGW CPPFLAGS may use this. 29# MinGW CPPFLAGS may use this.
27abs_top_srcdir=@abs_top_srcdir@ 30abs_top_srcdir=@abs_top_srcdir@
@@ -71,15 +74,14 @@ am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
71am__v_at_0 = @ 74am__v_at_0 = @
72am__v_at_1 = 75am__v_at_1 =
73 76
74DEPDIR = deps
75AUTO_DEPEND = @AUTO_DEPEND@ 77AUTO_DEPEND = @AUTO_DEPEND@
76 78DEPDIR = deps
77ifeq ($(AUTO_DEPEND),yes) 79ifeq ($(AUTO_DEPEND),yes)
78DEPFLAGS = -MMD -MF ${DEPDIR}/$*.d -MP 80 DEPFLAGS = -MMD -MF $(DEPDIR)/$*.d -MP
79MKDEPDIR = ${MKDIR_P} ${DEPDIR} 81 -include $(ALLOBJS:%.o=$(DEPDIR)/%.d)
80else 82else
81DEPFLAGS = 83 DEPFLAGS =
82MKDEPDIR = : 84 include $(srcdir)/deps.mk
83endif 85endif
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
97all: 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
104liblw.a: $(OBJS) 102liblw.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
113ifeq ($(AUTO_DEPEND),yes)
114-include $(ALLOBJS:%.o=${DEPDIR}/%.d)
115else
116include $(srcdir)/deps.mk
117endif
118
119.PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean 111.PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean
120 112
121clean mostlyclean: 113clean mostlyclean:
122 rm -f *.o liblw.a \#* 114 rm -f *.o liblw.a \#* $(DEPDIR)/*
123 -rm -rf ${DEPDIR}
124 115
125distclean: clean 116distclean: clean
126 rm -f Makefile 117 rm -f Makefile
118 rm -fr $(DEPDIR)
127 119
128bootstrap-clean maintainer-clean: distclean 120bootstrap-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@)
111am__v_at_0 = @ 111am__v_at_0 = @
112am__v_at_1 = 112am__v_at_1 =
113 113
114DEPDIR = deps
115AUTO_DEPEND = @AUTO_DEPEND@ 114AUTO_DEPEND = @AUTO_DEPEND@
116 115DEPDIR = deps
117ifeq ($(AUTO_DEPEND),yes) 116ifeq ($(AUTO_DEPEND),yes)
118DEPFLAGS = -MMD -MF ${DEPDIR}/$*.d -MP 117 DEPFLAGS = -MMD -MF $(DEPDIR)/$*.d -MP
119MKDEPDIR = ${MKDIR_P} ${DEPDIR} 118 -include $(ALLOBJS:%.o=$(DEPDIR)/%.d)
120else 119else
121DEPFLAGS = 120 DEPFLAGS =
122MKDEPDIR = : 121 include $(srcdir)/deps.mk
123endif 122endif
124 123
125ALL_CFLAGS=$(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \ 124ALL_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
135libXMenu11.a: $(OBJS) $(EXTRA) 133libXMenu11.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
140ifeq ($(AUTO_DEPEND),yes)
141-include $(ALLOBJS:%.o=${DEPDIR}/%.d)
142else
143include $(srcdir)/deps.mk
144endif
145
146.PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean 138.PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean
147 139
148clean mostlyclean: 140clean mostlyclean:
149 rm -f libXMenu11.a *.o 141 rm -f libXMenu11.a *.o $(DEPDIR)/*
150 -rm -rf ${DEPDIR}
151 142
152bootstrap-clean maintainer-clean distclean: clean 143bootstrap-clean maintainer-clean distclean: clean
153 rm -f Makefile 144 rm -f Makefile
145 rm -fr $(DEPDIR)
154 146
155ETAGS = ../lib-src/etags${EXEEXT} 147ETAGS = ../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@)
347am__v_at_0 = @ 347am__v_at_0 = @
348am__v_at_1 = 348am__v_at_1 =
349 349
350DEPDIR=deps
351AUTO_DEPEND = @AUTO_DEPEND@ 350AUTO_DEPEND = @AUTO_DEPEND@
352 351DEPDIR = deps
353ifeq ($(AUTO_DEPEND),yes) 352ifeq ($(AUTO_DEPEND),yes)
354DEPFLAGS = -MMD -MF ${DEPDIR}/$*.d -MP 353 DEPFLAGS = -MMD -MF $(DEPDIR)/$*.d -MP
355MKDEPDIR = ${MKDIR_P} ${DEPDIR} 354 -include $(ALLOBJS:%.o=$(DEPDIR)/%.d)
356else 355else
357DEPFLAGS = 356 DEPFLAGS =
358MKDEPDIR = : 357 include $(srcdir)/deps.mk
359endif 358endif
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
652clean: mostlyclean 649clean: 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
667distclean: bootstrap-clean 663distclean: bootstrap-clean
668 rm -f Makefile lisp.mk 664 rm -f Makefile lisp.mk
665 rm -fr $(DEPDIR)
669 666
670maintainer-clean: distclean 667maintainer-clean: distclean
671 rm -f TAGS 668 rm -f TAGS
@@ -755,11 +752,3 @@ else
755endif 752endif
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
759ifeq ($(AUTO_DEPEND),yes)
760-include $(ALLOBJS:%.o=${DEPDIR}/%.d)
761else
762include $(srcdir)/deps.mk
763endif
764
765### Makefile.in ends here