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 5d58b6b..402e687 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 e235fcd..08f8dcc 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)