blob: 872334085baf22c94b62e131d71763642c277ccc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# $NetBSD: bsd.pkg.clean.mk,v 1.3 2006/01/19 16:24:51 jlam Exp $
#
# This Makefile fragment is included to bsd.pkg.mk and defines the
# relevant variables and targets for the "clean" phase.
#
# The following variables may be set by the package Makefile and
# specify how cleaning happens:
#
# CLEANDEPENDS specifies the whether "cleaning" will also clean
# in all dependencies, implied and direct. CLEANDEPENDS
# defaults to "no".
#
# The following targets are defined by bsd.pkg.clean.mk:
#
# clean-depends is the target which descends into dependencies'
# package directories and invokes the "clean" action.
#
# do-clean is the target that does the actual cleaning, which
# involves removing the work directory and other temporary
# files used by the package.
#
# clean is the target that is invoked by the user to perform
# the "clean" action.
#
# cleandir is an alias for "clean".
#
CLEANDEPENDS?= no
.PHONY: clean-depends
clean-depends:
${_PKG_SILENT}${_PKG_DEBUG} \
${_DEPENDS_WALK_CMD} ${PKGPATH} | \
while read dir; do \
cd ${.CURDIR}/../../$$dir && \
${MAKE} ${MAKEFLAGS} CLEANDEPENDS=no clean; \
done
.PHONY: pre-clean
.if !target(pre-clean)
pre-clean:
@${DO_NADA}
.endif
.PHONY: post-clean
.if !target(post-clean)
post-clean:
@${DO_NADA}
.endif
.PHONY: do-clean
.if !target(do-clean)
do-clean:
@${ECHO_MSG} "${_PKGSRC_IN}> Cleaning for ${PKGNAME}"
${_PKG_SILENT}${_PKG_DEBUG} \
if ${TEST} -d ${WRKDIR:Q}; then \
if ${TEST} -w ${WRKDIR:Q}; then \
${RM} -fr ${WRKDIR:Q}; \
else \
${ECHO_MSG} "${_PKGSRC_IN}> "${WRKDIR:Q}" not writable, skipping"; \
fi; \
fi
. if defined(WRKOBJDIR)
-${_PKG_SILENT}${_PKG_DEBUG} \
${RMDIR} ${BUILD_DIR} 2>/dev/null; \
${RM} -f ${WRKDIR_BASENAME}
. endif
.endif
_CLEAN_TARGETS+= pre-clean
.if empty(CLEANDEPENDS:M[nN][oO])
_CLEAN_TARGETS+= clean-depends
.endif
_CLEAN_TARGETS+= do-clean
_CLEAN_TARGETS+= post-clean
.ORDER: ${_CLEAN_TARGETS}
.PHONY: clean
.if !target(clean)
clean: ${_CLEAN_TARGETS}
.endif
.PHONY: cleandir
cleandir: clean
|