tech-toolchain archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
cleanfiles
Given the following Makefile:
PROG=simple
SRCS=simple.l
LDADD=-ll
MKMAN=no
.include <bsd.prog.mk>
check:
@echo "cleanfiles: ${CLEANFILES}"
and a trivial lex file simple.l:
int num_lines = 0, num_chars = 0;
%%
\n ++num_lines; ++num_chars;
. ++num_chars;
%%
main()
{
yylex();
printf("lines: %d, chars: %d\n", num_lines, num_chars);
}
% make
rm -f .gdbinit
touch .gdbinit
# lex clean/simple.c
lex -Pyy -osimple.c simple.l
# compile clean/simple.o
cc -O2 -Werror -c simple.c
# link clean/simple
cc -o simple -Wl,-rpath-link,/lib:/usr/lib -L/lib simple.o -ll
% make check
cleanfiles: simple.c
% make clean
rm -f simple.o
rm -f simple
rm -f a.out [Ee]rrs mklog core *.core .gdbinit
% ls
Makefile simple.c simple.l
simple.c is left behind after "make clean" even though simple.c is in
"CLEANFILES".
The removal should happen because of:
cleanextra: .PHONY
.if defined(CLEANFILES) && !empty(CLEANFILES)
rm -f ${CLEANFILES}
.endif
Removing the .if and .endif lines fixes the problem, as "rm -f" without a
file doesn't give a rm syntax error (since 26th May 2008).
Looking at other files e.g., bsd.man.mk shows the same construct. Would it
make sense to gather all these various cleanxxx targets together?
Does anyone actually use
make cleanhtml
make cleanlib
?
We only claim that clean and cleandir exist in bsd.README. Should I prepare
a patch which removes the cleanxxx targets and replaces them with a
bsd.clean.mk which rm -f's CLEANFILES for clean: and CLEANDIRFILES for
cleandir:, and let the bsd.*.mk files set CLEANFILES and CLEANDIRFILES and
.include bsd.clean.mk ?
Cheers,
Patrick
(cf http://mail-index.netbsd.org/tech-toolchain/2008/05/21/msg000199.html)
Home |
Main Index |
Thread Index |
Old Index