| Summary: | make clean in bsd.obj.mk no longer properly removes *.core and others | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | howardjp <howardjp> | ||||
| Component: | bin | Assignee: | freebsd-bugs (Nobody) <bugs> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Only Me | ||||||
| Priority: | Normal | ||||||
| Version: | 4.0-CURRENT | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
>/usr/src/share/mk/bsd.README describes ``make clean'' as: > > clean: > remove the program, any object files and the files a.out, > Errs, errs, mklog, and ${PROG}.core. > >However, make clean does not remove a.out, Errs, errs, mklog and >${PROG}.core any longer. This is intentional. I forgot to change the README. `make clean' is now supposed to remove precisely those files that are created automatically at some time (including temporaries). ${PROG}.core will almost never be created, because ${PROG} is almost never run in the obj directory. If any cores are created, then they will be for things like cc1, but finding all cores is too hard, especially since we have a sysctl for changing the format of core file names. a.out is only created in rare cases, mainly for libraries. These cases are supposed to be handled specially. >>How-To-Repeat: > >cd /usr/src/bin/cat (or anything else) and ``make clean''. See what it >lists as files to delete. `make -V CLEANFILES' should give the complete list. (It doesn't for at least libraries. Separate rm's are used for libraries to reduce the chance of there being too many args.) >diff -c mk/bsd.obj.mk mk-jph/bsd.obj.mk >*** mk/bsd.obj.mk Tue Aug 24 00:10:30 1999 >--- mk-jph/bsd.obj.mk Tue Aug 24 00:14:23 1999 >*************** >*** 107,113 **** > .if !target(clean) > clean: _SUBDIR > .if defined(CLEANFILES) && !empty(CLEANFILES) >! rm -f ${CLEANFILES} > .endif > .if defined(CLEANDIRS) && !empty(CLEANDIRS) > rm -rf ${CLEANDIRS} >--- 107,113 ---- > .if !target(clean) > clean: _SUBDIR > .if defined(CLEANFILES) && !empty(CLEANFILES) >! rm -f a.out Errs errs mklog ${CLEANFILES} > .endif > .if defined(CLEANDIRS) && !empty(CLEANDIRS) > rm -rf ${CLEANDIRS} This fails to remove a.out, etc. if CLEANFILES is unset or empty. The main reason for not cleaning in all cases is to speed up `make clean' a bit. Bruce On Wed, 25 Aug 1999, Bruce Evans wrote:
> This is intentional. I forgot to change the README. `make clean' is now
Ahh, I see. In that event, here is a diff to correct the README, not that
it is that complicated, but anyway.
*** bsd.README.orig Tue Aug 24 13:57:51 1999
--- bsd.README Tue Aug 24 13:58:43 1999
***************
*** 158,165 ****
all:
build the program and its manual page
clean:
! remove the program, any object files and the files a.out,
! Errs, errs, mklog, and ${PROG}.core.
cleandir:
remove all of the files removed by the target clean, as
well as .depend, tags, and any manual pages.
--- 158,164 ----
all:
build the program and its manual page
clean:
! remove the program and any object files.
cleandir:
remove all of the files removed by the target clean, as
well as .depend, tags, and any manual pages.
>Ahh, I see. In that event, here is a diff to correct the README, not that >it is that complicated, but anyway. > >*** bsd.README.orig Tue Aug 24 13:57:51 1999 >--- bsd.README Tue Aug 24 13:58:43 1999 >*************** >*** 158,165 **** > all: > build the program and its manual page > clean: >! remove the program, any object files and the files a.out, >! Errs, errs, mklog, and ${PROG}.core. > cleandir: > remove all of the files removed by the target clean, as > well as .depend, tags, and any manual pages. >--- 158,164 ---- > all: > build the program and its manual page > clean: >! remove the program and any object files. It removes a bit more than object files. This is perhaps best described by saying that it removes all generated files except the ones handled by cleadir. The README is seriously incomplete. cleandepend is missing here. > cleandir: > remove all of the files removed by the target clean, as > well as .depend, tags, and any manual pages. This is quite out of date too. cleandir also removes the canonical object directory and any link to it, modulo some complications when there is an obj subdirectory. Bruce State Changed From-To: open->suspended This should be dead easy to fix, based on bde's comments. Awaiting committer. State Changed From-To: suspended->closed Closed at the originator's request. He believes the data in this PR is no longer accurate. |
/usr/src/share/mk/bsd.README describes ``make clean'' as: clean: remove the program, any object files and the files a.out, Errs, errs, mklog, and ${PROG}.core. However, make clean does not remove a.out, Errs, errs, mklog and ${PROG}.core any longer. Fix: Below is a diff which modifies /usr/src/share/mk/bsd.{prog,obj}.mk and adds these files to CLEANFILES, the list of files which should be deleted. I do not know if changes need to make to CLEANDIRS, I suspect not. I tested this are varius targets in /usr/src/bin and it worked every time. Apply this diff to /usr/src/share/mk. Thanks and have a nice day :) How-To-Repeat: cd /usr/src/bin/cat (or anything else) and ``make clean''. See what it lists as files to delete.