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 11:44:51PM -0700, Simon J. Gerraty wrote:
> Simple and effective.
> The following may be gross, but it "just works" with -j:
> 
> .y.h:
>       yacc -d ${.IMPSRC}
>       mv y.tab.h ${.PREFIX}.h
>       mv y.tab.c ${.PREFIX}.c
>       touch ${.PREFIX}.c
> 
> .y.c: ${.TARGET:R:T}.h
>       true

The only problem with ones like that is when the .c file
gets deleted, but the .h file remains.
One solution is to change the 'true' to something like:
        [ -f $@ ] || rm ${@:.c=.h}
So that a rebuild will work.

I'm sure I've done such hackery on SYSV make :-)

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index