summaryrefslogtreecommitdiff
path: root/lwlib
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2014-06-28 15:57:23 -0700
committerGlenn Morris <rgm@gnu.org>2014-06-28 15:57:23 -0700
commit93160ec3928b5efd654824dfc727d1bbec3c0aec (patch)
treedbca945901d1ff3d2d21e5b20f18ae76d6b134f7 /lwlib
parente0d9c3c9a26ba2982595ec2ec4a1167ee7e39ddb (diff)
Use gcc auto-dependency information for lwlib and oldXMenu
* 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.
Diffstat (limited to 'lwlib')
-rw-r--r--lwlib/ChangeLog12
-rw-r--r--lwlib/Makefile.in28
-rw-r--r--lwlib/autodeps.mk5
-rw-r--r--lwlib/deps.mk43
4 files changed, 72 insertions, 16 deletions
diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog
index 430add5a8b..20ace66073 100644
--- a/lwlib/ChangeLog
+++ b/lwlib/ChangeLog
@@ -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.
diff --git a/lwlib/Makefile.in b/lwlib/Makefile.in
index 7185aa6072..516b328695 100644
--- a/lwlib/Makefile.in
+++ b/lwlib/Makefile.in
@@ -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
index 0000000000..f7109295ce
--- /dev/null
+++ b/lwlib/autodeps.mk
@@ -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
index 0000000000..6355ec62e6
--- /dev/null
+++ b/lwlib/deps.mk
@@ -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