chiark / gitweb /
syntax: Support &: literal (for make `grouped' multiple targets)
[subdirmk.git] / clean.sd.mk
1 # subdirmk - useful rules for clean target
2 #  Copyright 2019 Mark Wooding
3 #  Copyright 2019 Ian Jackson
4 # SPDX-License-Identifier: LGPL-2.0-or-later
5 # There is NO WARRANTY.
6
7 &# Usage:
8 &#   &:include subdirmk/clean.sd.mk
9 &# (probably in Suffix.sd.mk)
10 &#
11 &# Provides a per-directory `clean' target, which deletes all the files
12 &# in &CLEAN.  &OBJECTS, &DEPFILES and &TARGETS are automatically deleted.
13 &#
14 &# If you want to delete a directory, extend the target with
15 &#   &/clean::
16 &#      $(RM) -r somethingn
17 &# ($(RM) conventionally contains `-f'.)
18
19 &CLEAN += & *~ .*~ *.tmp
20 &CLEAN += $(&OBJECTS)
21 &CLEAN += $(&TARGETS)
22
23 &TARGETS_clean +=
24
25 &/clean::
26         $(RM) $(&CLEAN)