Use gcc auto-dependency information for lwlib and oldXMenu
authorGlenn Morris <rgm@gnu.org>
Sat, 28 Jun 2014 22:57:23 +0000 (15:57 -0700)
committerGlenn Morris <rgm@gnu.org>
Sat, 28 Jun 2014 22:57:23 +0000 (15:57 -0700)
* configure.ac (lwlib_deps_frag, oldxmenu_deps_frag): New output files.

* make-dist (lwlib, oldXMenu): Distribute *.mk.

* lwlib/Makefile.in: Move old dependency information to new file deps.mk.
(MKDIR_P, DEPFLAGS, MKDEPDIR, lwlib_deps_frag):
New, set by configure.
(DEPDIR): New variable.
(ALL_CFLAGS): Add DEPFLAGS.
(.c.o): Add MKDEPDIR.
(clean, mostlyclean): Delete DEPDIR.

* lwlib/deps.mk, lwlib/autodeps.mk: New files.

* oldXMenu/Makefile.in: Move old dependency information to new file deps.mk.
(MKDIR_P, DEPFLAGS, MKDEPDIR, oldxmenu_deps_frag):
New, set by configure.
(DEPDIR): New variable.
(ALL_CFLAGS): Add DEPFLAGS.
(.c.o): Add MKDEPDIR.
(clean, mostlyclean): Delete DEPDIR.

* oldXMenu/deps.mk, oldXMenu/autodeps.mk: New files.

* src/deps.mk: Comment update.

* .bzrignore: Ignore lwlib/deps, oldXMenu/deps.

12 files changed:
ChangeLog
configure.ac
lwlib/ChangeLog
lwlib/Makefile.in
lwlib/autodeps.mk [new file with mode: 0644]
lwlib/deps.mk [new file with mode: 0644]
make-dist
oldXMenu/ChangeLog
oldXMenu/Makefile.in
oldXMenu/autodeps.mk [new file with mode: 0644]
oldXMenu/deps.mk [new file with mode: 0644]
src/deps.mk

index 3a5797a..8226a13 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-06-28  Glenn Morris  <rgm@gnu.org>
+
+       * configure.ac (lwlib_deps_frag, oldxmenu_deps_frag): New output files.
+       * make-dist (lwlib, oldXMenu): Distribute *.mk.
+
 2014-06-27  Glenn Morris  <rgm@gnu.org>
 
        * Makefile.in (src): No more need to pass BOOTSTRAPEMACS.
index b253d24..04c75e3 100644 (file)
@@ -1590,11 +1590,14 @@ if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then
       deps_frag=autodeps.mk
    fi
 fi
+lwlib_deps_frag=$srcdir/lwlib/$deps_frag
+oldxmenu_deps_frag=$srcdir/oldXMenu/$deps_frag
 deps_frag=$srcdir/src/$deps_frag
 AC_SUBST(MKDEPDIR)
 AC_SUBST(DEPFLAGS)
 AC_SUBST_FILE(deps_frag)
-
+AC_SUBST_FILE(lwlib_deps_frag)
+AC_SUBST_FILE(oldxmenu_deps_frag)
 
 lisp_frag=$srcdir/src/lisp.mk
 AC_SUBST_FILE(lisp_frag)
index 430add5..20ace66 100644 (file)
@@ -1,3 +1,15 @@
+2014-06-28  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in: Use gcc auto-dependency information.
+       Move old dependency information to new file deps.mk.
+       (MKDIR_P, DEPFLAGS, MKDEPDIR, lwlib_deps_frag):
+       New, set by configure.
+       (DEPDIR): New variable.
+       (ALL_CFLAGS): Add DEPFLAGS.
+       (.c.o): Add MKDEPDIR.
+       (clean, mostlyclean): Delete DEPDIR.
+       * deps.mk, autodeps.mk: New files.
+
 2014-06-17  Paul Eggert  <eggert@cs.ucla.edu>
 
        Omit redundant extern decls.
index 7185aa6..516b328 100644 (file)
@@ -41,6 +41,7 @@ RANLIB=@RANLIB@
 
 AR = @AR@
 ARFLAGS = @ARFLAGS@
+MKDIR_P = @MKDIR_P@
 
 LUCID_OBJS = lwlib-Xlw.o xlwmenu.o lwlib-Xaw.o
 MOTIF_OBJS = lwlib-Xm.o
@@ -50,13 +51,19 @@ TOOLKIT_OBJS = $(@X_TOOLKIT_TYPE@_OBJS)
 
 OBJS = lwlib.o $(TOOLKIT_OBJS) lwlib-utils.o
 
+DEPDIR = deps
+## -MMD -MF $(DEPDIR)/$*.d if AUTO_DEPEND; else empty.
+DEPFLAGS = @DEPFLAGS@
+## ${MKDIR_P} ${DEPDIR} (if AUTO_DEPEND); else ':'.
+MKDEPDIR = @MKDEPDIR@
+
 ## ../src is where the generated file (config.h, globals.h) are.
 ## $(srcdir)/../src is where the non-generated files (lisp.h) are.
 ## (In an out-of-tree build, these two are not the same.)
 ## $(srcdir) is where the lwlib sources are.
 ## There are no generated lwlib files, hence no need for -I.
 ALL_CFLAGS= $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \
-  $(C_SWITCH_MACHINE) \
+  $(C_SWITCH_MACHINE) $(DEPFLAGS) \
   $(WARN_CFLAGS) $(WERROR_CFLAGS) $(PROFILING_CFLAGS) $(CFLAGS) \
   -Demacs -I../src \
   -I$(srcdir) -I$(srcdir)/../src -I../lib -I$(srcdir)/../lib
@@ -65,6 +72,7 @@ all: liblw.a
 .PHONY: all
 
 .c.o:
+       @$(MKDEPDIR)
        $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
 
 liblw.a: $(OBJS)
@@ -72,30 +80,18 @@ liblw.a: $(OBJS)
        $(AR) $(ARFLAGS) $@ $(OBJS)
        $(RANLIB) $@
 
-## Generated files in ../src, non-generated in $(srcdir)/../src.
-config_h = ../src/config.h $(srcdir)/../src/conf_post.h
-lisp_h = $(srcdir)/../src/lisp.h
-## lisp.h includes this.
 globals_h = ../src/globals.h
-src_h = $(config_h) $(lisp_h) $(globals_h)
-
 $(globals_h):
        $(MAKE) -C ../src globals.h
 
-lwlib-utils.o: $(src_h) lwlib-utils.c lwlib-utils.h lwlib.h
-lwlib.o:       $(src_h) lwlib.c lwlib.h lwlib-int.h lwlib-utils.h \
-  lwlib-Xlw.h lwlib-Xm.h lwlib-Xaw.h
-lwlib-Xlw.o:   $(src_h) lwlib-Xlw.c lwlib.h lwlib-int.h lwlib-Xlw.h xlwmenu.h
-lwlib-Xaw.o:   $(src_h) lwlib-Xaw.c lwlib-Xaw.h lwlib.h lwlib-int.h
-lwlib-Xm.o:    $(src_h) lwlib-Xm.c lwlib-Xm.h lwlib.h lwlib-int.h lwlib-utils.h
-xlwmenu.o:     $(src_h) xlwmenu.c xlwmenu.h lwlib.h xlwmenuP.h \
-  $(srcdir)/../src/xterm.h
-
+## Insert either autodeps.mk (if AUTO_DEPEND), else deps.mk.
+@lwlib_deps_frag@
 
 .PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean
 
 clean mostlyclean:
        rm -f *.o liblw.a \#*
+       -rm -rf ${DEPDIR}
 
 distclean: clean
        rm -f Makefile
diff --git a/lwlib/autodeps.mk b/lwlib/autodeps.mk
new file mode 100644 (file)
index 0000000..f710929
--- /dev/null
@@ -0,0 +1,5 @@
+### autodeps.mk --- lwlib/Makefile fragment for GNU Emacs
+
+## This is inserted in lwlib/Makefile if AUTO_DEPEND=yes.
+
+-include $(ALLOBJS:%.o=${DEPDIR}/%.d)
diff --git a/lwlib/deps.mk b/lwlib/deps.mk
new file mode 100644 (file)
index 0000000..6355ec6
--- /dev/null
@@ -0,0 +1,43 @@
+### deps.mk --- lwlib/Makefile fragment for GNU Emacs
+
+# Copyright (C) 1992, 1993 Lucid, Inc.
+# Copyright (C) 1994, 2001-2014 Free Software Foundation, Inc.
+#
+# This file is part of the Lucid Widget Library.
+#
+# The Lucid Widget Library 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 1, or (at your option)
+# any later version.
+#
+# The Lucid Widget Library 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 <http://www.gnu.org/licenses/>.
+
+### Commentary:
+
+## This file is inserted in lwlib/Makefile if AUTO_DEPEND=no.
+## It defines static dependencies between the various source files.
+
+### Code:
+
+## Generated files in ../src, non-generated in $(srcdir)/../src.
+config_h = ../src/config.h $(srcdir)/../src/conf_post.h
+lisp_h = $(srcdir)/../src/lisp.h
+## lisp.h includes this.
+src_h = $(config_h) $(lisp_h) $(globals_h)
+
+lwlib-utils.o: $(src_h) lwlib-utils.c lwlib-utils.h lwlib.h
+lwlib.o:       $(src_h) lwlib.c lwlib.h lwlib-int.h lwlib-utils.h \
+  lwlib-Xlw.h lwlib-Xm.h lwlib-Xaw.h
+lwlib-Xlw.o:   $(src_h) lwlib-Xlw.c lwlib.h lwlib-int.h lwlib-Xlw.h xlwmenu.h
+lwlib-Xaw.o:   $(src_h) lwlib-Xaw.c lwlib-Xaw.h lwlib.h lwlib-int.h
+lwlib-Xm.o:    $(src_h) lwlib-Xm.c lwlib-Xm.h lwlib.h lwlib-int.h lwlib-utils.h
+xlwmenu.o:     $(src_h) xlwmenu.c xlwmenu.h lwlib.h xlwmenuP.h \
+  $(srcdir)/../src/xterm.h
+
+### deps.mk ends here
index ed6a7cf..fba4905 100755 (executable)
--- a/make-dist
+++ b/make-dist
@@ -438,12 +438,12 @@ echo "Making links to \`nextstep/GNUstep/Emacs.base/Resources'"
 
 echo "Making links to \`oldXMenu'"
 (cd oldXMenu
- ln *.[ch] *.in ../${tempdir}/oldXMenu
+ ln *.[ch] *.in *.mk ../${tempdir}/oldXMenu
  ln README ChangeLog ../${tempdir}/oldXMenu)
 
 echo "Making links to \`lwlib'"
 (cd lwlib
- ln *.[ch] *.in ../${tempdir}/lwlib
+ ln *.[ch] *.in *.mk ../${tempdir}/lwlib
  ln README ChangeLog ../${tempdir}/lwlib)
 
 ## It is important to distribute admin/ because it contains sources
index 74686f6..2d382be 100644 (file)
@@ -1,3 +1,15 @@
+2014-06-28  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in: Use gcc auto-dependency information.
+       Move old dependency information to new file deps.mk.
+       (MKDIR_P, DEPFLAGS, MKDEPDIR, oldxmenu_deps_frag):
+       New, set by configure.
+       (DEPDIR): New variable.
+       (ALL_CFLAGS): Add DEPFLAGS.
+       (.c.o): Add MKDEPDIR.
+       (clean, mostlyclean): Delete DEPDIR.
+       * deps.mk, autodeps.mk: New files.
+
 2014-06-15  Glenn Morris  <rgm@gnu.org>
 
        * Makefile.in (CPPFLAGS): Explicitly set via configure.
index 91b313a..bfa7d97 100644 (file)
@@ -63,6 +63,7 @@ RM = rm -f
 RANLIB = @RANLIB@
 AR = @AR@
 ARFLAGS = @ARFLAGS@
+MKDIR_P = @MKDIR_P@
 
 OBJS =  Activate.o \
        AddPane.o \
@@ -92,13 +93,20 @@ OBJS =  Activate.o \
 all: libXMenu11.a
 .PHONY: all
 
+DEPDIR = deps
+## -MMD -MF $(DEPDIR)/$*.d if AUTO_DEPEND; else empty.
+DEPFLAGS = @DEPFLAGS@
+## ${MKDIR_P} ${DEPDIR} (if AUTO_DEPEND); else ':'.
+MKDEPDIR = @MKDEPDIR@
+
 ALL_CFLAGS=$(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \
-  $(C_SWITCH_X_SITE) \
+  $(C_SWITCH_X_SITE) $(DEPFLAGS) \
   $(WARN_CFLAGS) $(WERROR_CFLAGS) ${PROFILING_CFLAGS} \
   $(CPPFLAGS) $(CFLAGS) -DEMACS_BITMAP_FILES \
   -I../src -I../lib -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib
 
 .c.o:
+       @$(MKDEPDIR)
        $(CC) -c ${ALL_CFLAGS} $<
 
 libXMenu11.a: $(OBJS) $(EXTRA)
@@ -106,42 +114,14 @@ libXMenu11.a: $(OBJS) $(EXTRA)
        $(AR) $(ARFLAGS) $@ $(OBJS) $(EXTRA)
        $(RANLIB) $@
 
-Activate.o: Activate.c XMenuInt.h XMenu.h X10.h
-AddPane.o: AddPane.c XMenuInt.h XMenu.h X10.h
-AddSel.o: AddSel.c XMenuInt.h XMenu.h X10.h
-ChgPane.o: ChgPane.c XMenuInt.h XMenu.h X10.h
-ChgSel.o: ChgSel.c XMenuInt.h XMenu.h X10.h
-Create.o: Create.c XMenuInt.h XMenu.h X10.h
-DelPane.o: DelPane.c XMenuInt.h XMenu.h X10.h
-DelSel.o: DelSel.c XMenuInt.h XMenu.h X10.h
-Destroy.o: Destroy.c XMenuInt.h XMenu.h X10.h
-Error.o: Error.c XMenuInt.h XMenu.h X10.h
-EvHand.o: EvHand.c XMenuInt.h XMenu.h X10.h
-FindPane.o: FindPane.c XMenuInt.h XMenu.h X10.h
-FindSel.o: FindSel.c XMenuInt.h XMenu.h X10.h
-InsPane.o: InsPane.c XMenuInt.h XMenu.h X10.h
-InsSel.o: InsSel.c XMenuInt.h XMenu.h X10.h
-Internal.o: Internal.c XMenuInt.h XMenu.h X10.h
-Locate.o: Locate.c XMenuInt.h XMenu.h X10.h
-Post.o: Post.c XMenuInt.h XMenu.h X10.h
-Recomp.o: Recomp.c XMenuInt.h XMenu.h X10.h
-SetAEQ.o: SetAEQ.c XMenuInt.h XMenu.h X10.h
-SetFrz.o: SetFrz.c XMenuInt.h XMenu.h X10.h
-SetPane.o: SetPane.c XMenuInt.h XMenu.h X10.h
-SetSel.o: SetSel.c XMenuInt.h XMenu.h X10.h
-XDelAssoc.o: XDelAssoc.c X10.h
-XLookAssoc.o: XLookAssoc.c X10.h
-XCrAssoc.o: XCrAssoc.c X10.h
-XDestAssoc.o: XDestAssoc.c X10.h
-XMakeAssoc.o: XMakeAssoc.c X10.h
-insque.o: insque.c
+## Insert either autodeps.mk (if AUTO_DEPEND), else deps.mk.
+@oldxmenu_deps_frag@
 
 .PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean
 
-mostlyclean:
+clean mostlyclean:
        rm -f libXMenu11.a ${OBJS} ${EXTRA}
-
-clean: mostlyclean
+       -rm -rf ${DEPDIR}
 
 bootstrap-clean maintainer-clean distclean: clean
        rm -f Makefile
@@ -150,3 +130,4 @@ bootstrap-clean maintainer-clean distclean: clean
 tags:
        $(TAGS) -t *.[ch]
 
+### Makefile.in ends here
diff --git a/oldXMenu/autodeps.mk b/oldXMenu/autodeps.mk
new file mode 100644 (file)
index 0000000..f710929
--- /dev/null
@@ -0,0 +1,5 @@
+### autodeps.mk --- lwlib/Makefile fragment for GNU Emacs
+
+## This is inserted in lwlib/Makefile if AUTO_DEPEND=yes.
+
+-include $(ALLOBJS:%.o=${DEPDIR}/%.d)
diff --git a/oldXMenu/deps.mk b/oldXMenu/deps.mk
new file mode 100644 (file)
index 0000000..c5a4966
--- /dev/null
@@ -0,0 +1,70 @@
+### deps.mk --- oldXMenu/Makefile fragment for GNU Emacs
+
+## Copyright 1985, 1986, 1987 by the Massachusetts Institute of Technology
+
+## Permission to use, copy, modify, and distribute this
+## software and its documentation for any purpose and without
+## fee is hereby granted, provided that the above copyright
+## notice appear in all copies and that both that copyright
+## notice and this permission notice appear in supporting
+## documentation, and that the name of M.I.T. not be used in
+## advertising or publicity pertaining to distribution of the
+## software without specific, written prior permission.
+## M.I.T. makes no representations about the suitability of
+## this software for any purpose.  It is provided "as is"
+## without express or implied warranty.
+
+
+## Copyright (C) 2001-2014 Free Software Foundation, Inc.
+
+## This program 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.
+
+## This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+
+### Commentary:
+
+## This file is inserted in oldXMenu/Makefile if AUTO_DEPEND=no.
+## It defines static dependencies between the various source files.
+
+### Code:
+
+Activate.o: Activate.c XMenuInt.h XMenu.h X10.h
+AddPane.o: AddPane.c XMenuInt.h XMenu.h X10.h
+AddSel.o: AddSel.c XMenuInt.h XMenu.h X10.h
+ChgPane.o: ChgPane.c XMenuInt.h XMenu.h X10.h
+ChgSel.o: ChgSel.c XMenuInt.h XMenu.h X10.h
+Create.o: Create.c XMenuInt.h XMenu.h X10.h
+DelPane.o: DelPane.c XMenuInt.h XMenu.h X10.h
+DelSel.o: DelSel.c XMenuInt.h XMenu.h X10.h
+Destroy.o: Destroy.c XMenuInt.h XMenu.h X10.h
+Error.o: Error.c XMenuInt.h XMenu.h X10.h
+EvHand.o: EvHand.c XMenuInt.h XMenu.h X10.h
+FindPane.o: FindPane.c XMenuInt.h XMenu.h X10.h
+FindSel.o: FindSel.c XMenuInt.h XMenu.h X10.h
+InsPane.o: InsPane.c XMenuInt.h XMenu.h X10.h
+InsSel.o: InsSel.c XMenuInt.h XMenu.h X10.h
+Internal.o: Internal.c XMenuInt.h XMenu.h X10.h
+Locate.o: Locate.c XMenuInt.h XMenu.h X10.h
+Post.o: Post.c XMenuInt.h XMenu.h X10.h
+Recomp.o: Recomp.c XMenuInt.h XMenu.h X10.h
+SetAEQ.o: SetAEQ.c XMenuInt.h XMenu.h X10.h
+SetFrz.o: SetFrz.c XMenuInt.h XMenu.h X10.h
+SetPane.o: SetPane.c XMenuInt.h XMenu.h X10.h
+SetSel.o: SetSel.c XMenuInt.h XMenu.h X10.h
+XDelAssoc.o: XDelAssoc.c X10.h
+XLookAssoc.o: XLookAssoc.c X10.h
+XCrAssoc.o: XCrAssoc.c X10.h
+XDestAssoc.o: XDestAssoc.c X10.h
+XMakeAssoc.o: XMakeAssoc.c X10.h
+insque.o: insque.c
+
+### deps.mk ends here
index 1d67d75..3fdbbe6 100644 (file)
@@ -1,7 +1,7 @@
 ### deps.mk --- src/Makefile fragment for GNU Emacs
 
-## Copyright (C) 1985, 1987-1988, 1993-1995, 1999-2014 Free Software
-## Foundation, Inc.
+## Copyright (C) 1985, 1987-1988, 1993-1995, 1999-2014
+##   Free Software Foundation, Inc.
 
 ## This file is part of GNU Emacs.
 
@@ -27,8 +27,6 @@
 ## Eg callproc.c only depends on w32.h for WINDOWSNT builds.
 ## One way to fix this would be to replace w32.h (etc) by $(W32_H),
 ## a variable set by configure.  Does not seem worth the trouble.
-## Since the w32 build does not even use this file, you might ask
-## why these dependencies are here at all...
 
 ## nsgui.h: In fact, every .o file depends directly or indirectly on
 ## dispextern.h and hence nsgui.h under NS.  But the ones that actually