[BACK]Return to bsd.pkg.clean.mk CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / pkgsrc / mk

Annotation of pkgsrc/mk/bsd.pkg.clean.mk, Revision 1.2

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

CVSweb <webmaster@jp.NetBSD.org>