Commit bf8cf95d authored by Paul Eggert's avatar Paul Eggert

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.
parent 14d8b685
...@@ -1730,6 +1730,7 @@ dnl AC_C_BIGENDIAN is done by gnulib. ...@@ -1730,6 +1730,7 @@ dnl AC_C_BIGENDIAN is done by gnulib.
dnl check for Make feature dnl check for Make feature
AUTO_DEPEND=no AUTO_DEPEND=no
AUTODEPEND_PARENTS='lib src'
dnl check if we have GCC and autodepend is on. dnl check if we have GCC and autodepend is on.
if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then
AC_MSG_CHECKING([whether gcc understands -MMD -MF]) AC_MSG_CHECKING([whether gcc understands -MMD -MF])
...@@ -1742,9 +1743,6 @@ if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then ...@@ -1742,9 +1743,6 @@ if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then
AC_MSG_RESULT([$ac_enable_autodepend]) AC_MSG_RESULT([$ac_enable_autodepend])
if test $ac_enable_autodepend = yes; then if test $ac_enable_autodepend = yes; then
AUTO_DEPEND=yes AUTO_DEPEND=yes
for depdir in */deps; do
test ! -d "$depdir" || rm -fr "$depdir"/../*.o "$depdir" || exit
done
fi fi
fi fi
AC_SUBST(AUTO_DEPEND) AC_SUBST(AUTO_DEPEND)
...@@ -5016,8 +5014,10 @@ if test "$HAVE_GTK" = yes || test "$HAVE_X11" != yes; then ...@@ -5016,8 +5014,10 @@ if test "$HAVE_GTK" = yes || test "$HAVE_X11" != yes; then
LIBXMENU= LIBXMENU=
elif test "$USE_X_TOOLKIT" = none; then elif test "$USE_X_TOOLKIT" = none; then
LIBXMENU='$(oldXMenudir)/libXMenu11.a' LIBXMENU='$(oldXMenudir)/libXMenu11.a'
AUTODEPEND_PARENTS="$AUTODEPEND_PARENTS oldXMenu"
else else
LIBXMENU='$(lwlibdir)/liblw.a' LIBXMENU='$(lwlibdir)/liblw.a'
AUTODEPEND_PARENTS="$AUTODEPEND_PARENTS lwlib"
fi fi
AC_SUBST(LIBXMENU) AC_SUBST(LIBXMENU)
...@@ -5473,6 +5473,13 @@ ${MAKE-make} -s MAKEFILE_NAME=do-not-make-Makefile etc-emacsver || \ ...@@ -5473,6 +5473,13 @@ ${MAKE-make} -s MAKEFILE_NAME=do-not-make-Makefile etc-emacsver || \
AC_MSG_ERROR(['etc/refcards/emacsver.tex' could not be made.]) AC_MSG_ERROR(['etc/refcards/emacsver.tex' could not be made.])
]) ])
if test $AUTO_DEPEND = yes; then
for dir in $AUTODEPEND_PARENTS; do
rm -f $dir/*.o $dir/deps/*
AS_MKDIR_P([$dir/deps])
done
fi
AC_OUTPUT AC_OUTPUT
if test ! "$with_mailutils"; then if test ! "$with_mailutils"; then
......
...@@ -65,16 +65,12 @@ ifneq ($(SYSTEM_TYPE),windows-nt) ...@@ -65,16 +65,12 @@ ifneq ($(SYSTEM_TYPE),windows-nt)
libgnu_a_SOURCES += openat-die.c save-cwd.c libgnu_a_SOURCES += openat-die.c save-cwd.c
endif endif
# Dependencies. When !AUTO_DEPEND, don't bother with a dependencies file,
# as the default dependencies are often adequate.
DEPDIR = deps DEPDIR = deps
ifeq ($(AUTO_DEPEND),yes) ifeq ($(AUTO_DEPEND),yes)
DEPFLAGS = -MMD -MF $(DEPDIR)/$*.d -MP DEPFLAGS = -MMD -MF $(DEPDIR)/$*.d -MP
MKDEPDIR = $(MKDIR_P) $(DEPDIR)
-include $(ALLOBJS:%.o=$(DEPDIR)/%.d) -include $(ALLOBJS:%.o=$(DEPDIR)/%.d)
else else
DEPFLAGS = DEPFLAGS =
MKDEPDIR = :
endif endif
.PRECIOUS: ../config.status Makefile .PRECIOUS: ../config.status Makefile
...@@ -90,10 +86,8 @@ libegnu_a_OBJECTS = $(patsubst %.o,e-%.o,$(libgnu_a_OBJECTS)) ...@@ -90,10 +86,8 @@ libegnu_a_OBJECTS = $(patsubst %.o,e-%.o,$(libgnu_a_OBJECTS))
$(libegnu_a_OBJECTS) $(libgnu_a_OBJECTS): $(BUILT_SOURCES) $(libegnu_a_OBJECTS) $(libgnu_a_OBJECTS): $(BUILT_SOURCES)
.c.o: .c.o:
@$(MKDEPDIR)
$(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< $(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
e-%.o: %.c e-%.o: %.c
@$(MKDEPDIR)
$(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -Demacs -o $@ $< $(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -Demacs -o $@ $<
all: libgnu.a $(if $(HYBRID_MALLOC),libegnu.a) all: libgnu.a $(if $(HYBRID_MALLOC),libegnu.a)
...@@ -118,10 +112,10 @@ TAGS: $(ETAGS) $(tagsfiles) ...@@ -118,10 +112,10 @@ TAGS: $(ETAGS) $(tagsfiles)
.PHONY: $(ETAGS) tags .PHONY: $(ETAGS) tags
clean mostlyclean: clean mostlyclean:
rm -f *.[ao] \#* rm -f *.[ao] \#* $(DEPDIR)/*
-rm -rf $(DEPDIR)
distclean: clean distclean: clean
rm -f Makefile $(BUILT_SOURCES) rm -f Makefile $(BUILT_SOURCES)
rm -fr $(DEPDIR)
bootstrap-clean: distclean bootstrap-clean: distclean
rm -f TAGS rm -f TAGS
maintainer-clean: bootstrap-clean maintainer-clean: bootstrap-clean
......
...@@ -22,6 +22,9 @@ ...@@ -22,6 +22,9 @@
# This was taken from the output of Imake using Lucid's Imakefile. # This was taken from the output of Imake using Lucid's Imakefile.
# and set up to be configured by ../configure. # and set up to be configured by ../configure.
all: liblw.a
.PHONY: all
srcdir=@srcdir@ srcdir=@srcdir@
# MinGW CPPFLAGS may use this. # MinGW CPPFLAGS may use this.
abs_top_srcdir=@abs_top_srcdir@ abs_top_srcdir=@abs_top_srcdir@
...@@ -71,15 +74,14 @@ am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) ...@@ -71,15 +74,14 @@ am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @ am__v_at_0 = @
am__v_at_1 = am__v_at_1 =
DEPDIR = deps
AUTO_DEPEND = @AUTO_DEPEND@ AUTO_DEPEND = @AUTO_DEPEND@
DEPDIR = deps
ifeq ($(AUTO_DEPEND),yes) ifeq ($(AUTO_DEPEND),yes)
DEPFLAGS = -MMD -MF ${DEPDIR}/$*.d -MP DEPFLAGS = -MMD -MF $(DEPDIR)/$*.d -MP
MKDEPDIR = ${MKDIR_P} ${DEPDIR} -include $(ALLOBJS:%.o=$(DEPDIR)/%.d)
else else
DEPFLAGS = DEPFLAGS =
MKDEPDIR = : include $(srcdir)/deps.mk
endif endif
## ../src is where the generated file (config.h, globals.h) are. ## ../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,11 +96,7 @@ ALL_CFLAGS= $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \
-Demacs -I../src \ -Demacs -I../src \
-I$(srcdir) -I$(srcdir)/../src -I../lib -I$(srcdir)/../lib -I$(srcdir) -I$(srcdir)/../src -I../lib -I$(srcdir)/../lib
all: liblw.a
.PHONY: all
.c.o: .c.o:
@$(MKDEPDIR)
$(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< $(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
liblw.a: $(OBJS) liblw.a: $(OBJS)
...@@ -110,20 +108,14 @@ globals_h = ../src/globals.h ...@@ -110,20 +108,14 @@ globals_h = ../src/globals.h
$(globals_h): $(globals_h):
$(MAKE) -C ../src globals.h $(MAKE) -C ../src globals.h
ifeq ($(AUTO_DEPEND),yes)
-include $(ALLOBJS:%.o=${DEPDIR}/%.d)
else
include $(srcdir)/deps.mk
endif
.PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean .PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean
clean mostlyclean: clean mostlyclean:
rm -f *.o liblw.a \#* rm -f *.o liblw.a \#* $(DEPDIR)/*
-rm -rf ${DEPDIR}
distclean: clean distclean: clean
rm -f Makefile rm -f Makefile
rm -fr $(DEPDIR)
bootstrap-clean maintainer-clean: distclean bootstrap-clean maintainer-clean: distclean
rm -f TAGS rm -f TAGS
......
...@@ -111,15 +111,14 @@ am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) ...@@ -111,15 +111,14 @@ am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @ am__v_at_0 = @
am__v_at_1 = am__v_at_1 =
DEPDIR = deps
AUTO_DEPEND = @AUTO_DEPEND@ AUTO_DEPEND = @AUTO_DEPEND@
DEPDIR = deps
ifeq ($(AUTO_DEPEND),yes) ifeq ($(AUTO_DEPEND),yes)
DEPFLAGS = -MMD -MF ${DEPDIR}/$*.d -MP DEPFLAGS = -MMD -MF $(DEPDIR)/$*.d -MP
MKDEPDIR = ${MKDIR_P} ${DEPDIR} -include $(ALLOBJS:%.o=$(DEPDIR)/%.d)
else else
DEPFLAGS = DEPFLAGS =
MKDEPDIR = : include $(srcdir)/deps.mk
endif endif
ALL_CFLAGS=$(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \ ALL_CFLAGS=$(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \
...@@ -129,7 +128,6 @@ ALL_CFLAGS=$(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \ ...@@ -129,7 +128,6 @@ ALL_CFLAGS=$(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \
-I../src -I../lib -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib -I../src -I../lib -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib
.c.o: .c.o:
@$(MKDEPDIR)
$(AM_V_CC)$(CC) -c ${ALL_CFLAGS} $< $(AM_V_CC)$(CC) -c ${ALL_CFLAGS} $<
libXMenu11.a: $(OBJS) $(EXTRA) libXMenu11.a: $(OBJS) $(EXTRA)
...@@ -137,20 +135,14 @@ libXMenu11.a: $(OBJS) $(EXTRA) ...@@ -137,20 +135,14 @@ libXMenu11.a: $(OBJS) $(EXTRA)
$(AM_V_at)$(AR) $(ARFLAGS) $@ $(OBJS) $(EXTRA) $(AM_V_at)$(AR) $(ARFLAGS) $@ $(OBJS) $(EXTRA)
$(AM_V_at)$(RANLIB) $@ $(AM_V_at)$(RANLIB) $@
ifeq ($(AUTO_DEPEND),yes)
-include $(ALLOBJS:%.o=${DEPDIR}/%.d)
else
include $(srcdir)/deps.mk
endif
.PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean .PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean
clean mostlyclean: clean mostlyclean:
rm -f libXMenu11.a *.o rm -f libXMenu11.a *.o $(DEPDIR)/*
-rm -rf ${DEPDIR}
bootstrap-clean maintainer-clean distclean: clean bootstrap-clean maintainer-clean distclean: clean
rm -f Makefile rm -f Makefile
rm -fr $(DEPDIR)
ETAGS = ../lib-src/etags${EXEEXT} ETAGS = ../lib-src/etags${EXEEXT}
......
...@@ -347,15 +347,14 @@ am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) ...@@ -347,15 +347,14 @@ am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @ am__v_at_0 = @
am__v_at_1 = am__v_at_1 =
DEPDIR=deps
AUTO_DEPEND = @AUTO_DEPEND@ AUTO_DEPEND = @AUTO_DEPEND@
DEPDIR = deps
ifeq ($(AUTO_DEPEND),yes) ifeq ($(AUTO_DEPEND),yes)
DEPFLAGS = -MMD -MF ${DEPDIR}/$*.d -MP DEPFLAGS = -MMD -MF $(DEPDIR)/$*.d -MP
MKDEPDIR = ${MKDIR_P} ${DEPDIR} -include $(ALLOBJS:%.o=$(DEPDIR)/%.d)
else else
DEPFLAGS = DEPFLAGS =
MKDEPDIR = : include $(srcdir)/deps.mk
endif endif
# Flags that might be in WARN_CFLAGS but are not valid for Objective C. # Flags that might be in WARN_CFLAGS but are not valid for Objective C.
...@@ -383,10 +382,8 @@ ALL_OBJC_CFLAGS = $(EMACS_CFLAGS) \ ...@@ -383,10 +382,8 @@ ALL_OBJC_CFLAGS = $(EMACS_CFLAGS) \
.SUFFIXES: .m .SUFFIXES: .m
.c.o: .c.o:
@$(MKDEPDIR)
$(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $(PROFILING_CFLAGS) $< $(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $(PROFILING_CFLAGS) $<
.m.o: .m.o:
@$(MKDEPDIR)
$(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_OBJC_CFLAGS) $(PROFILING_CFLAGS) $< $(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_OBJC_CFLAGS) $(PROFILING_CFLAGS) $<
## lastfile must follow all files whose initialized data areas should ## lastfile must follow all files whose initialized data areas should
...@@ -650,8 +647,7 @@ mostlyclean: ...@@ -650,8 +647,7 @@ mostlyclean:
rm -f globals.h gl-stamp rm -f globals.h gl-stamp
rm -f *.res *.tmp rm -f *.res *.tmp
clean: mostlyclean clean: mostlyclean
rm -f emacs-*.*.*$(EXEEXT) emacs$(EXEEXT) rm -f emacs-*.*.*$(EXEEXT) emacs$(EXEEXT) $(DEPDIR)/*
-rm -rf $(DEPDIR)
## bootstrap-clean is used to clean up just before a bootstrap. ## bootstrap-clean is used to clean up just before a bootstrap.
## It should remove all files generated during a compilation/bootstrap, ## It should remove all files generated during a compilation/bootstrap,
...@@ -666,6 +662,7 @@ bootstrap-clean: clean ...@@ -666,6 +662,7 @@ bootstrap-clean: clean
distclean: bootstrap-clean distclean: bootstrap-clean
rm -f Makefile lisp.mk rm -f Makefile lisp.mk
rm -fr $(DEPDIR)
maintainer-clean: distclean maintainer-clean: distclean
rm -f TAGS rm -f TAGS
...@@ -755,11 +752,3 @@ else ...@@ -755,11 +752,3 @@ else
endif endif
@: Compile some files earlier to speed up further compilation. @: Compile some files earlier to speed up further compilation.
$(MAKE) -C ../lisp compile-first EMACS="$(bootstrap_exe)" $(MAKE) -C ../lisp compile-first EMACS="$(bootstrap_exe)"
ifeq ($(AUTO_DEPEND),yes)
-include $(ALLOBJS:%.o=${DEPDIR}/%.d)
else
include $(srcdir)/deps.mk
endif
### Makefile.in ends here
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment