chiark / gitweb /
Documentation for clean.sd.mk and cdeps.sd.mk
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 13 Nov 2019 22:12:10 +0000 (22:12 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 13 Nov 2019 22:12:25 +0000 (22:12 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
subdirmk/cdeps.sd.mk
subdirmk/clean.sd.mk

index 5d58b6b90c979ccd5153a95aed7f1e007d3a0301..402e687c6aa63153951e95e704d02f488a77d547 100644 (file)
@@ -3,6 +3,18 @@
 #  Copyright 2019 Ian Jackson
 # SPDX-License-Identifier: LGPL-2.0-or-later
 
+&# Usage:
+&#   &:include subdirmk/cdeps.sd.mk
+&# (probably in Perdir.sd.mk)
+&#
+&# Arranges for automatic #include dependency tracking for
+&# C compilation.  The compiler is asked to write the dependencies to
+&#  .*.d and these are automatically included.
+&#
+&# There is a bug: if a #included file is deleted and all references
+&# in .c files to it removed, `make' will complain that it is needed
+&# and can't be built.  `make clean' will fix this.
+
 CDEPS_CFLAGS ?= -MD -MF $(*D)/.$(*F).d
 
 &DEPFILES += $(foreach b,$(patsubst %.o,%,$(&OBJECTS)), \
index e235fcd8e251bbf8a45b9ac073b3e1415ccd0b91..08f8dcc61e5cd584618e97a8d81b696f0dfd50ca 100644 (file)
@@ -3,6 +3,18 @@
 #  Copyright 2019 Ian Jackson
 # SPDX-License-Identifier: LGPL-2.0-or-later
 
+&# Usage:
+&#   &:include subdirmk/clean.sd.mk
+&# (probably in Perdir.sd.mk)
+&#
+&# Provides a per-directory `clean' target, which deletes all the files
+&# in &CLEAN.  &OBJECTS, &DEPFILES and &TARGETS are automatically deleted.
+&#
+&# If you want to delete a directory, extend the target with
+&#   &/clean::
+&#     $(RM) -r somethingn
+&# ($(RM) conventionally contains `-f'.)
+
 &CLEAN += & *~ *.tmp
 &CLEAN += $(&OBJECTS)
 &CLEAN += $(&TARGETS)