Source-Changes-D archive

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

Re: CVS commit: src/bin/sh



On Mon, Dec 07, 2009 at 04:22:41PM +0000, Masao Uebayashi wrote:
> Module Name:  src
> Committed By: uebayasi
> Date:         Mon Dec  7 16:22:41 UTC 2009
> 
> Modified Files:
>       src/bin/sh: Makefile
> 
> Log Message:
> Define dependencies of arith.[ch] on arith.y.

This added:

arith.h: arith.c
arith.c: arith.y

I'm fairly sure this doesn't have the desired effect!
In particular if arith.h doesn't exist, but arith.c does then you'll
get a 'no rules to create arith.h' (or similar error).

At least one of those dependencies must already exist! Otherwise
the file would never have been generated!

Similar problems will arise if yacc happens to generate an arith.c
with a later timestamp than arith.h

make doesn't really handle one set of rules generating 2 files
(as yacc does from foo.y).

If you have
arith.c arith.h: arith.y
        <yacc commands>

Then the commands can be run twice - and may be run twice at the
same time.

Thinks ....
It might be best have:

arith.h: arith.y
        <yacc commands>

arith.o: arith.h
        [ -f ${@:.o=c} ] || { rm ${@:.o=.h}; exit 1; }
        <commands to compile arith.c>

ie having no real dependency against arith.c

        David

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


Home | Main Index | Thread Index | Old Index