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

1.14    ! rillig      1: # $NetBSD: bsd.pkg.clean.mk,v 1.13 2007/11/15 12:09:52 rillig 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: #
1.14    ! rillig     15: # clean-depends:
        !            16: #      descends into dependencies' package directories and invokes the
        !            17: #      "clean" action.
        !            18: #
        !            19: # do-clean:
        !            20: #      does the actual cleaning, which involves removing the work
        !            21: #      directory and other temporary files used by the package.
1.1       jlam       22: #
1.14    ! rillig     23: # clean:
        !            24: #      is invoked by the user to perform the "clean" action.
1.1       jlam       25: #
1.14    ! rillig     26: # cleandir:
        !            27: #      an alias for "clean".
1.1       jlam       28: #
                     29:
                     30: CLEANDEPENDS?= no
                     31:
1.11      adrianp    32: .if defined(PRIVILEGED_STAGES) && !empty(PRIVILEGED_STAGES:Mclean)
1.10      adrianp    33: _MAKE_CLEAN_AS_ROOT=yes
                     34: .endif
                     35:
1.1       jlam       36: .PHONY: clean-depends
                     37: clean-depends:
1.13      rillig     38:        ${RUN}                                                          \
1.1       jlam       39:        ${_DEPENDS_WALK_CMD} ${PKGPATH} |                               \
                     40:        while read dir; do                                              \
                     41:                cd ${.CURDIR}/../../$$dir &&                            \
1.6       jlam       42:                ${RECURSIVE_MAKE} ${MAKEFLAGS} CLEANDEPENDS=no clean;   \
1.1       jlam       43:        done
                     44:
                     45: .PHONY: pre-clean
                     46: .if !target(pre-clean)
                     47: pre-clean:
                     48:        @${DO_NADA}
                     49: .endif
                     50:
                     51: .PHONY: post-clean
                     52: .if !target(post-clean)
                     53: post-clean:
                     54:        @${DO_NADA}
                     55: .endif
                     56:
                     57: .PHONY: do-clean
                     58: .if !target(do-clean)
1.9       joerg      59: .  if !empty(_MAKE_CLEAN_AS_ROOT:M[Yy][Ee][Ss])
                     60: do-clean: su-target
                     61: .  else
                     62: do-clean: su-do-clean
                     63: .  endif
                     64: .endif
                     65:
1.13      rillig     66: su-do-clean: .PHONY
1.4       jlam       67:        @${PHASE_MSG} "Cleaning for ${PKGNAME}"
1.13      rillig     68:        ${RUN}                                                          \
                     69:        if ${TEST} -d ${WRKDIR}; then                                   \
                     70:                if ${TEST} -w ${WRKDIR}; then                           \
                     71:                        ${RM} -fr ${WRKDIR};                            \
1.1       jlam       72:                else                                                    \
1.13      rillig     73:                        ${STEP_MSG} ${WRKDIR}" not writable, skipping"; \
1.1       jlam       74:                fi;                                                     \
                     75:         fi
1.13      rillig     76: .if defined(WRKOBJDIR)
                     77:        ${RUN}                                                          \
1.7       rillig     78:        ${RMDIR} ${BUILD_DIR} 2>/dev/null || ${TRUE};                   \
1.12      rillig     79:        ${RMDIR} ${BUILD_DIR:H} 2>/dev/null || ${TRUE};                 \
1.7       rillig     80:        ${RM} -f ${WRKDIR_BASENAME} 2>/dev/null || ${TRUE}
1.13      rillig     81: .endif
1.1       jlam       82:
                     83: _CLEAN_TARGETS+=       pre-clean
                     84: .if empty(CLEANDEPENDS:M[nN][oO])
                     85: _CLEAN_TARGETS+=       clean-depends
                     86: .endif
                     87: _CLEAN_TARGETS+=       do-clean
                     88: _CLEAN_TARGETS+=       post-clean
                     89:
                     90: .PHONY: clean
                     91: .if !target(clean)
                     92: clean: ${_CLEAN_TARGETS}
                     93: .endif
                     94:
                     95: .PHONY: cleandir
                     96: cleandir: clean

CVSweb <webmaster@jp.NetBSD.org>