chiark / gitweb /
Makefile.in: Use -MMD, not depend.sh
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 2 Oct 2014 15:29:21 +0000 (16:29 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 5 Oct 2014 20:06:27 +0000 (21:06 +0100)
Generate the dependency information in .d files automatically with
-MMD, rather than explicitly in the Makefile.  This is faster, and
more reliable.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Makefile.in
depend.sh [deleted file]

index feda4e80538a0951b7ae455746bc32f851bf9e6a..3c4ae924d9e3f913ad5f6e8500a8e97df899fb73 100644 (file)
@@ -37,7 +37,8 @@ CFLAGS:=-Wall @WRITESTRINGS@ @CFLAGS@ -Werror \
        -Wmissing-declarations -Wnested-externs -Wredundant-decls \
        -Wpointer-arith -Wformat=2 -Winit-self \
        -Wswitch-enum -Wunused-variable -Wunused-function -Wbad-function-cast \
-       -Wno-strict-aliasing -fno-strict-aliasing
+       -Wno-strict-aliasing -fno-strict-aliasing \
+       -MMD
 ALL_CFLAGS:=@DEFS@ -I$(srcdir) -I. $(CFLAGS) $(EXTRA_CFLAGS)
 CPPFLAGS:=@CPPFLAGS@ $(EXTRA_CPPFLAGS)
 LDFLAGS:=@LDFLAGS@ $(EXTRA_LDFLAGS)
@@ -106,12 +107,7 @@ config.status: configure
 SOURCES:=$(OBJECTS:.o=.c) $(TEST_OBJECTS:.o=.c)
 DEPENDS:=$(OBJECTS:.o=.d) $(TEST_OBJECTS:.o=.d)
 
-$(DEPENDS): ${srcdir}/depend.sh
-
-%.d: %.c
-       ${srcdir}/depend.sh $(srcdir) $(CPPFLAGS) $(ALL_CFLAGS) $< > $@
-
--include $(DEPENDS)
+-include *.d
 
 # Manual dependencies section
 conffile.yy.c: conffile.fl conffile.tab.c
diff --git a/depend.sh b/depend.sh
deleted file mode 100755 (executable)
index 72fde4b..0000000
--- a/depend.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh
-
-# For more information see "Recursive Make Considered Harmful" at
-# http://www.canb.auug.org.au/~millerp/rmch/recu-make-cons-harm.html
-
-set -e
-set -u
-
-cutout="$1"
-shift
-
-# cutout may contain the character '.' which means a special thing to sed
-# Escape all '.'s (i.e. '..' -> '\.\.')
-cutout2="`echo ${cutout} | sed -e 's@\.@\\\.@g'`"
-
-# We don't bother depending on system header files (which have names
-# starting with '/'). We arrange for both the .o and the .d file to depend
-# on the appropriate header files. We're using VPATH, so we turn pathnames
-# of the form "${srcdir}/foo" into just "foo" (we expect srcdir to be
-# passed as our first command line argument)
-gcc -M -MG "$@" |
-sed -e 's@ /[^ ]*@@g' -e 's@^\(.*\)\.o:@\1.d \1.o:@' -e "s@${cutout2}/@@g"