diff options
author | netchild <netchild@FreeBSD.org> | 2005-07-23 14:23:30 +0000 |
---|---|---|
committer | netchild <netchild@FreeBSD.org> | 2005-07-23 14:23:30 +0000 |
commit | f78772bbe490b9eec3f72e17c387f3c297c8fb08 (patch) | |
tree | 625edb345769982da8729c698c2b5a4609b59bad /Makefile.inc1 | |
parent | 676e8250ed71e2235084276e627550974c7c35de (diff) | |
download | FreeBSD-src-f78772bbe490b9eec3f72e17c387f3c297c8fb08.zip FreeBSD-src-f78772bbe490b9eec3f72e17c387f3c297c8fb08.tar.gz |
Add delete-old and delete-old-libs targets:
- removes obsolete files/dirs or libraries.
- works in interactive (default) and batch mode
- respects DISTDIR
- documented in UPDATING and build(7)
The head of the file ObsoleteFiles.inc contains instructions how to add
obsolete files/dirs/libs to the list. Obviously one should add obsolete
files to this list, when he removes a file/dir/lib from the basesystem.
Additionally add check-old target:
- allows re@ to check if a file on the obsolete list resurfaces
Design goals:
- allows full control by the user (default interactive mode)
- possibility of scripted removal of obsolete files (batch mode)
- opt-in removal of files (explicit list of files)
- seperate removal of libs (2 delete targets)
Important design decissions:
- structured list of files to remove instead of a plain text file:
* allows to remove additional files if a NO_foo knob is specified
without the need to change the targets (no NO_foo knob is respected
yet)
- not using mtree like NetBSD does:
* mtree doesn't has an interactive mode
Discussed on: arch (long ago), current (this year)
Additional input from: re (hrs)
Approved by: mentor (joerg)
Diffstat (limited to 'Makefile.inc1')
-rw-r--r-- | Makefile.inc1 | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/Makefile.inc1 b/Makefile.inc1 index e104950..cb18de6 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1058,3 +1058,95 @@ par-${__target}: ${SUBDIR:S/$/.${__target}__D/} .endfor .include <bsd.subdir.mk> + +# +# check for / delete old files section +# + +.include "ObsoleteFiles.inc" + +OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \ +else you can not start such an application. Consult UPDATING for more \ +information regarding how to cope with the removal/revision bump of a \ +specific library." + +.if !defined(BATCH_DELETE_OLD_FILES) +RM_I=-i +.endif + +delete-old-files: +.if defined(${TARGET_ARCH}) +.error "You have to run this in a native environment!" +.endif + @echo ">>> Removing old files (only deletes safe to delete libs)" +.for file in ${OLD_FILES} +# Ask for every old file if the user really wants to remove it. +# It's anoying, but beter safe than sorry. + @[ ! -f "${DESTDIR}/${file}" ] || (rm ${RM_I} "${DESTDIR}/${file}" \ + || ([ -f "${DESTDIR}/${file}" ] \ + && echo "Removing schg flag on ${DESTDIR}/${file}" \ + && chflags noschg "${DESTDIR}/${file}" \ + && rm ${RM_I} "${DESTDIR}/${file}")) +.endfor + @echo ">>> Old files removed" + +check-old-files: +.if defined(${TARGET_ARCH}) +.error "You have to run this in a native environment!" +.endif + @echo ">>> Checking for old files" +.for file in ${OLD_FILES} + @[ ! -f "${DESTDIR}/${file}" ] || echo "${DESTDIR}/${file}" +.endfor + +delete-old-libs: +.if defined(${TARGET_ARCH}) +.error "You have to run this in a native environment!" +.endif + @echo ">>> Removing old libraries" + @echo "${OLD_LIBS_MESSAGE}" | fmt +.for file in ${OLD_LIBS} + @[ ! -f "${DESTDIR}/${file}" ] || (rm ${RM_I} "${DESTDIR}/${file}" \ + || ([ -f "${DESTDIR}/${file}" ] \ + && echo "Removing schg flag on ${DESTDIR}/${file}" \ + && chflags noschg "${DESTDIR}/${file}" \ + && rm ${RM_I} "${DESTDIR}/${file}")) +.endfor + @echo ">>> Old libraries removed" + +check-old-libs: +.if defined(${TARGET_ARCH}) +.error "You have to run this in a native environment!" +.endif + @echo ">>> Checking for old libraries" +.for file in ${OLD_LIBS} + @[ ! -f "${DESTDIR}/${file}" ] || echo "${DESTDIR}/${file}" +.endfor + +delete-old-dirs: +.if defined(${TARGET_ARCH}) +.error "You have to run this in a native environment!" +.endif + @echo ">>> Removing old directories" +.for dir in ${OLD_DIRS} +# Don't fail if an old directory isn't empty. + @[ ! -d "${DESTDIR}/${dir}" ] || (rmdir -v "${DESTDIR}/${dir}" || true) +.endfor + @echo ">>> Old directories removed" + +check-old-dirs: +.if defined(${TARGET_ARCH}) +.error "You have to run this in a native environment!" +.endif + @echo ">>> Checking for old directories" +.for dir in ${OLD_DIRS} + @[ ! -d "${DESTDIR}/${dir}" ] || echo "${DESTDIR}/${dir}" +.endfor + +delete-old: delete-old-files delete-old-dirs + @echo "To remove old libraries run '${MAKE} delete-old-libs'." + +check-old: check-old-files check-old-libs check-old-dirs + @echo "To remove old files and directories run '${MAKE} delete-old'." + @echo "To remove old libraries run '${MAKE} delete-old-libs'." + |