[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.10

1.10    ! adrianp     1: # $NetBSD: bsd.pkg.clean.mk,v 1.9 2006/10/09 11:44:06 joerg 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:
1.10    ! adrianp    30: .if defined(PRIVILEGED_STAGE) && !empty(PRIVILEGED_STAGE:Mclean)
        !            31: _MAKE_CLEAN_AS_ROOT=yes
        !            32: .endif
        !            33:
1.1       jlam       34: .PHONY: clean-depends
                     35: clean-depends:
                     36:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                     37:        ${_DEPENDS_WALK_CMD} ${PKGPATH} |                               \
                     38:        while read dir; do                                              \
                     39:                cd ${.CURDIR}/../../$$dir &&                            \
1.6       jlam       40:                ${RECURSIVE_MAKE} ${MAKEFLAGS} CLEANDEPENDS=no clean;   \
1.1       jlam       41:        done
                     42:
                     43: .PHONY: pre-clean
                     44: .if !target(pre-clean)
                     45: pre-clean:
                     46:        @${DO_NADA}
                     47: .endif
                     48:
                     49: .PHONY: post-clean
                     50: .if !target(post-clean)
                     51: post-clean:
                     52:        @${DO_NADA}
                     53: .endif
                     54:
                     55: .PHONY: do-clean
                     56: .if !target(do-clean)
1.9       joerg      57: .  if !empty(_MAKE_CLEAN_AS_ROOT:M[Yy][Ee][Ss])
                     58: do-clean: su-target
                     59: .  else
                     60: do-clean: su-do-clean
                     61: .  endif
                     62: .endif
                     63:
                     64: su-do-clean:
1.4       jlam       65:        @${PHASE_MSG} "Cleaning for ${PKGNAME}"
1.1       jlam       66:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                     67:        if ${TEST} -d ${WRKDIR:Q}; then                                 \
                     68:                if ${TEST} -w ${WRKDIR:Q}; then                         \
                     69:                        ${RM} -fr ${WRKDIR:Q};                          \
                     70:                else                                                    \
1.4       jlam       71:                        ${STEP_MSG} ${WRKDIR:Q}" not writable, skipping"; \
1.1       jlam       72:                fi;                                                     \
                     73:         fi
                     74: .  if defined(WRKOBJDIR)
1.7       rillig     75:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                     76:        ${RMDIR} ${BUILD_DIR} 2>/dev/null || ${TRUE};                   \
                     77:        ${RM} -f ${WRKDIR_BASENAME} 2>/dev/null || ${TRUE}
1.1       jlam       78: .  endif
                     79:
                     80: _CLEAN_TARGETS+=       pre-clean
                     81: .if empty(CLEANDEPENDS:M[nN][oO])
                     82: _CLEAN_TARGETS+=       clean-depends
                     83: .endif
                     84: _CLEAN_TARGETS+=       do-clean
                     85: _CLEAN_TARGETS+=       post-clean
                     86:
                     87: .PHONY: clean
                     88: .if !target(clean)
                     89: clean: ${_CLEAN_TARGETS}
                     90: .endif
                     91:
                     92: .PHONY: cleandir
                     93: cleandir: clean

CVSweb <webmaster@jp.NetBSD.org>