chiark / gitweb /
Makefile: Generate and include dependency information for headers.
authorMark Wooding <mdw@distorted.org.uk>
Wed, 6 Jun 2018 20:51:32 +0000 (21:51 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Wed, 6 Jun 2018 23:54:08 +0000 (00:54 +0100)
Not that there are any right now, but it's the principle of the thing.

.gitignore
Makefile

index 241f56aef735ee9849ef9877f377059d670dc0eb..aa06ea3e583b70da2a03f6abd4ef6697e919816d 100644 (file)
@@ -1,6 +1,7 @@
 *.tar.gz
 *.so
 *.o
+*.d
 /COPYING
 /auto-version
 /noip
index e6ddd66516624080f4cbd0c7b0dcbc0c7f39b4b3..4f075250a694d85e8ccb37d4201779f748cc2ac0 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -78,7 +78,7 @@ INST_BIN               = $(INSTALL) -c -m755
 MKDIRS                  = $(INSTALL) -d -m755
 
 ## Probably best if you leave these alone.
-REAL_CFLAGS             = $(CFLAGS) -fPIC
+REAL_CFLAGS             = $(CFLAGS) -fPIC -MD
 REAL_LDFLAGS            = $(LDFLAGS) -shared
 
 ###--------------------------------------------------------------------------
@@ -142,7 +142,7 @@ all:: $(TARGETS)
 .PHONY: ALL
 
 CLEAN                  += $(TARGETS)
-CLEAN                  += *.o
+CLEAN                  += *.o *.d
 clean::
        rm -f $(CLEAN)
 .PHONY: clean
@@ -160,6 +160,8 @@ $(SCRIPTS): %: withlib.in
        $(V_GEN)sed "s/@lib@/$@/" withlib.in >$@.new && \
                chmod +x $@.new && mv $@.new $@
 
+-include $(patsubst %.c,%d,$(ALL_SOURCES))
+
 ###--------------------------------------------------------------------------
 ### Installation.