When trying to isolate some issues with bsd.test.mk, I noticed that make clean/cleanobj was not cleaning as expected, in particular make clean does not clean any of the compiled programs, and make cleanobj only cleans out the last compiled program. If I run make cleandir, it napalms the heck out of the directory by deleting the bsd.dep.mk files 6 times (twice for cleandir, twice for cleanobj, twice for cleandepend) and the generated objects 2 times each (once each for cleanobj, once each for cleandir). I've provided an example below: % uname -a FreeBSD isilon-fuji-current.local 11.0-CURRENT FreeBSD 11.0-CURRENT #5 0d2be6b(isilon-atf): Sun Jun 8 21:34:32 PDT 2014 root@fuji-current.local:/usr/obj/usr/src/sys/FUJI i386 % cat * # Makefile FILESDIR=/tmp/share FILES= c BINDIR= /tmp/bin PROGS= a b MAN= .include <bsd.progs.mk> /* a.c */ #include <stdio.h> int main(void) { printf("hello world!\n"); return (0); } /* b.c */ #include <stdio.h> int main(void) { printf("hello world!\n"); return (0); } /* c */ This directory contains a simple C app that says, "hello world!" % make obj /usr/obj/root/make_clean_broken_with_progs_dot_mk created for /root/make_clean_broken_with_progs_dot_mk % make depend (cd /root/make_clean_broken_with_progs_dot_mk && make -f /root/make_clean_broken_with_progs_dot_mk/Makefile _RECURSING_PROGS= SUBDIR= PROG=a depend) rm -f .depend.a mkdep -f .depend.a -a -std=gnu99 /root/make_clean_broken_with_progs_dot_mk/a.c echo a: /usr/lib/libc.a >> .depend.a (cd /root/make_clean_broken_with_progs_dot_mk && make -f /root/make_clean_broken_with_progs_dot_mk/Makefile _RECURSING_PROGS= SUBDIR= PROG=b depend) rm -f .depend.b mkdep -f .depend.b -a -std=gnu99 /root/make_clean_broken_with_progs_dot_mk/b.c echo b: /usr/lib/libc.a >> .depend.b % make all (cd /root/make_clean_broken_with_progs_dot_mk && make -f /root/make_clean_broken_with_progs_dot_mk/Makefile _RECURSING_PROGS= SUBDIR= PROG=a ) cc -O2 -pipe -std=gnu99 -fstack-protector -Qunused-arguments -c /root/make_clean_broken_with_progs_dot_mk/a.c cc -O2 -pipe -std=gnu99 -fstack-protector -Qunused-arguments -o a a.o (cd /root/make_clean_broken_with_progs_dot_mk && make -f /root/make_clean_broken_with_progs_dot_mk/Makefile _RECURSING_PROGS= SUBDIR= PROG=b ) cc -O2 -pipe -std=gnu99 -fstack-protector -Qunused-arguments -c /root/make_clean_broken_with_progs_dot_mk/b.c cc -O2 -pipe -std=gnu99 -fstack-protector -Qunused-arguments -o b b.o % make clean % make cleanobj (cd /root/make_clean_broken_with_progs_dot_mk && make -f /root/make_clean_broken_with_progs_dot_mk/Makefile _RECURSING_PROGS= SUBDIR= PROG=a cleanobj) (cd /root/make_clean_broken_with_progs_dot_mk && make -f /root/make_clean_broken_with_progs_dot_mk/Makefile _RECURSING_PROGS= SUBDIR= PROG=b cleanobj) rm -f b b.o rm -f .depend.b GPATH GRTAGS GSYMS GTAGS % make cleandir (cd /root/make_clean_broken_with_progs_dot_mk && make -f Makefile _RECURSING_PROGS= SUBDIR= PROG=a cleandepend) rm -f .depend.a GPATH GRTAGS GSYMS GTAGS (cd /root/make_clean_broken_with_progs_dot_mk && make -f Makefile _RECURSING_PROGS= SUBDIR= PROG=b cleandepend) rm -f .depend.b GPATH GRTAGS GSYMS GTAGS (cd /root/make_clean_broken_with_progs_dot_mk && make -f Makefile _RECURSING_PROGS= SUBDIR= PROG=a cleanobj) rm -f a a.o rm -f .depend.a GPATH GRTAGS GSYMS GTAGS (cd /root/make_clean_broken_with_progs_dot_mk && make -f Makefile _RECURSING_PROGS= SUBDIR= PROG=b cleanobj) rm -f b b.o rm -f .depend.b GPATH GRTAGS GSYMS GTAGS (cd /root/make_clean_broken_with_progs_dot_mk && make -f Makefile _RECURSING_PROGS= SUBDIR= PROG=a cleandir) rm -f a a.o rm -f .depend.a GPATH GRTAGS GSYMS GTAGS (cd /root/make_clean_broken_with_progs_dot_mk && make -f Makefile _RECURSING_PROGS= SUBDIR= PROG=b cleandir) rm -f b b.o rm -f .depend.b GPATH GRTAGS GSYMS GTAGS % Expected behavior: - make clean should clean all apps and generated files. - make cleanobj should just nuke ${.OBJDIR}; it shouldn't have to nuke the files under ${.OBJDIR} (bsd.obj.mk ensures that requirement is met for cleanobj). - make cleandir should does the same thing as cleanobj (why they're separate targets, I have no idea, but cleanobj isn't advertised in the docs though...).
refine summary again.
I attached a proposed fix to bug 191055.
As you mention with your fix, this is actually a duplicate of 191055. bsd.progs.mk is not handling the case of a mixture of PROGS and FILES correctly for all targets other than build. *** This bug has been marked as a duplicate of bug 191055 ***