> 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!

True.

> 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

Another idea would be always generate two outputs independently.

        arith.c: tmp_arith_c.c:
        tmp_arith_c.c: tmp_arith_c.y
        tmp_arith_c.y: arith.y
                cp arith.y tmp_arith_c.y

        arith.h: tmp_arith_h.h:
        tmp_arith_h.h: tmp_arith_h.y
        tmp_arith_h.y: arith.y
                cp arith.y tmp_arith_h.y

I can think of no problem of this.  At the cost of redundancy (run command
twice + some tmp files) you get accurate dependency tree.

Masao

-- 
Masao Uebayashi / Tombi Inc. / Tel: +81-90-9141-4635

Reply via email to