From: Ian Jackson Date: Wed, 13 Nov 2019 22:12:10 +0000 (+0000) Subject: Documentation for clean.sd.mk and cdeps.sd.mk X-Git-Tag: subdirmk/0.1~43 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?p=subdirmk.git;a=commitdiff_plain;h=5c99a7202fe6895190cbc7e3fdc0948e04ab73d1;hp=a2d0da0b0b2f40319d8787b98f5198f78303f85d Documentation for clean.sd.mk and cdeps.sd.mk Signed-off-by: Ian Jackson --- diff --git a/subdirmk/cdeps.sd.mk b/subdirmk/cdeps.sd.mk index 5d58b6b..402e687 100644 --- a/subdirmk/cdeps.sd.mk +++ b/subdirmk/cdeps.sd.mk @@ -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)), \ diff --git a/subdirmk/clean.sd.mk b/subdirmk/clean.sd.mk index e235fcd..08f8dcc 100644 --- a/subdirmk/clean.sd.mk +++ b/subdirmk/clean.sd.mk @@ -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)