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

1.9     ! joerg       1: # $NetBSD: bsd.pkg.clean.mk,v 1.8 2006/08/09 15:31:01 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 &&                            \
1.6       jlam       36:                ${RECURSIVE_MAKE} ${MAKEFLAGS} CLEANDEPENDS=no clean;   \
1.1       jlam       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)
1.9     ! joerg      53: .  if !empty(_MAKE_CLEAN_AS_ROOT:M[Yy][Ee][Ss])
        !            54: do-clean: su-target
        !            55: .  else
        !            56: do-clean: su-do-clean
        !            57: .  endif
        !            58: .endif
        !            59:
        !            60: su-do-clean:
1.4       jlam       61:        @${PHASE_MSG} "Cleaning for ${PKGNAME}"
1.1       jlam       62:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                     63:        if ${TEST} -d ${WRKDIR:Q}; then                                 \
                     64:                if ${TEST} -w ${WRKDIR:Q}; then                         \
                     65:                        ${RM} -fr ${WRKDIR:Q};                          \
                     66:                else                                                    \
1.4       jlam       67:                        ${STEP_MSG} ${WRKDIR:Q}" not writable, skipping"; \
1.1       jlam       68:                fi;                                                     \
                     69:         fi
                     70: .  if defined(WRKOBJDIR)
1.7       rillig     71:        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
                     72:        ${RMDIR} ${BUILD_DIR} 2>/dev/null || ${TRUE};                   \
                     73:        ${RM} -f ${WRKDIR_BASENAME} 2>/dev/null || ${TRUE}
1.1       jlam       74: .  endif
                     75:
                     76: _CLEAN_TARGETS+=       pre-clean
                     77: .if empty(CLEANDEPENDS:M[nN][oO])
                     78: _CLEAN_TARGETS+=       clean-depends
                     79: .endif
                     80: _CLEAN_TARGETS+=       do-clean
                     81: _CLEAN_TARGETS+=       post-clean
                     82:
                     83: .PHONY: clean
                     84: .if !target(clean)
                     85: clean: ${_CLEAN_TARGETS}
                     86: .endif
                     87:
                     88: .PHONY: cleandir
                     89: cleandir: clean

CVSweb <webmaster@jp.NetBSD.org>