Skip to content

Commit 27e8df8

Browse files
committed
safestring: Allow clean along with other targets
Allow clean to be used along with other targets by processing the clean first and then all other targets. Signed-off-by: Mark Rustad <MRustad@gmail.com>
1 parent fee7fa5 commit 27e8df8

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

makefile

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ OTDIR=objtest
1111
SRCDIR=safeclib
1212
TESTDIR=unittests
1313

14+
CLEANGOAL := $(filter clean,${MAKECMDGOALS})
15+
OTHERGOALS := $(filter-out clean,${MAKECMDGOALS})
16+
17+
ifeq (${CLEANGOAL},)
18+
1419
.PHONY: all
1520
all: libsafestring.a safestringtest
1621

@@ -84,13 +89,22 @@ ${ODIR}:
8489
${OTDIR}:
8590
${MKDIR_P} ${OTDIR}
8691

92+
-include $(wildcard ${ODIR}/*.d)
93+
-include $(wildcard ${OTDIR}/*.d)
94+
95+
else
96+
8797
.PHONY: clean
8898

8999
clean:
90100
rm -f *~ core ${INCDIR}/*~
91101
rm -rf ${ODIR} ${OTDIR}
92102
rm -f libsafestring.a
93103
rm -f safestringtest
104+
ifneq (${OTHERGOALS},)
105+
${MAKE} ${OTHERGOALS}
106+
endif
94107

95-
-include $(wildcard ${ODIR}/*.d)
96-
-include $(wildcard ${OTDIR}/*.d)
108+
%: ;
109+
110+
endif # CLEANGOAL

0 commit comments

Comments
 (0)