From 5c99a7202fe6895190cbc7e3fdc0948e04ab73d1 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 13 Nov 2019 22:12:10 +0000 Subject: [PATCH 1/1] Documentation for clean.sd.mk and cdeps.sd.mk Signed-off-by: Ian Jackson --- subdirmk/cdeps.sd.mk | 12 ++++++++++++ subdirmk/clean.sd.mk | 12 ++++++++++++ 2 files changed, 24 insertions(+) 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) -- 2.30.2