tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bsd.lib.mk question



On Tue, Jun 07, 2011 at 08:26:06AM -0700, Simon Gerraty wrote:
 >> The best bet would be::
 >> 
 >>     parser.h: parser.y
 >>             ${YACC} -d -o ${.TARGET:T:R}.c ${.IMPSRC}
 >>             mv t.tab.y ${.TARGET}
 >> 
 >>     parser.c:       parser.h
 >> 
 >>     file1.o:        parser.h
 >> 
 >> This avoids the race conditions as well as the chance of cyclic
 >> dependencies.

With at least some makes, this will (possibly depending on timestamps)
cause parser.o to be recompiled from parser.c every time you type
make, because it's been "rebuilt" by the null rule. Furthermore, it's
lying to make, which never works out well in the long run. The only
correct way to handle these cases is to declare to make in some
fashion that the recipe creates multiple files.

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index