Skip to content

Commit

Permalink
safestring: Allow clean along with other targets
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
MRustad committed Jun 3, 2018
1 parent 0f2e412 commit a02ed2b
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ OTDIR=objtest
SRCDIR=safeclib
TESTDIR=unittests

CLEANGOAL := $(filter clean,${MAKECMDGOALS})
OTHERGOALS := $(filter-out clean,${MAKECMDGOALS})

ifeq (${CLEANGOAL},)

.PHONY: all
all: libsafestring.a safestringtest

Expand Down Expand Up @@ -84,13 +89,22 @@ ${ODIR}:
${OTDIR}:
${MKDIR_P} ${OTDIR}

-include $(wildcard ${ODIR}/*.d)
-include $(wildcard ${OTDIR}/*.d)

else

.PHONY: clean

clean:
rm -f *~ core ${INCDIR}/*~
rm -rf ${ODIR} ${OTDIR}
rm -f libsafestring.a
rm -f safestringtest
ifneq (${OTHERGOALS},)
${MAKE} ${OTHERGOALS}
endif

-include $(wildcard ${ODIR}/*.d)
-include $(wildcard ${OTDIR}/*.d)
%: ;

endif # CLEANGOAL

0 comments on commit a02ed2b

Please sign in to comment.