tech-toolchain archive

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

Re: make rule of multiple file generation (was Re: CVS commit: src/share/mk)

On Dec 14, 11:40am, (Masao Uebayashi) wrote:
-- Subject: Re: make rule of multiple file generation (was Re: CVS commit: sr

| > This has nothing to do with yacc; the rules in that Makefile are wrong.
| > 
| > instead of:
| > 
| >     nodes.h: nodes.c
| >     nodes.c: nodetypes nodes.c.pat
| > 
| > it should be:
| > 
| >     nodes.h nodes.c: nodetypes nodes.c.pat
|       % /src/netbsd/work.TNF/landisk/tools/bin/nbmake-landisk -j 2 nodes.h 
|            create  sh/nodes.c
|            create  sh/nodes.h
|       mv: rename /src/netbsd/work.TNF/landisk/obj/bin/sh/nodes.h.tmp to 
/src/netbsd/work.TNF/landisk/obj/bin/sh/nodes.h: No such file or directory
|       --- nodes.h ---
|       *** [nodes.h] Error code 1
|       1 error
|       nbmake: stopped in /src/netbsd/src.TNF/bin/sh
| "a b: c" doesn't describe a 1-to-N generation, but just a syntax sugar of
| "a: c" and "b: c".  make(1) tries to build a and b in two jobs and gets
| confused.
| You'll realize what $GENCMD does is a solution, not a work-around.

So this is fixed with an additional dependency to force serialization,
or by fixing the script not to re-use the same temp filenames:

nodes.h: nodes.c
nodes.c nodes.h: nodetypes nodes.c.pat
        ${SCRIPT_ENV} ${HOST_SH} ${.ALLSRC:S/^nodes.c$//} ${.OBJDIR}
        [ -f nodes.h ]

Still you have not shown me why GENCMD is necessary... For me it adds
complexity and slows things down. Fixing parallelization in Makefiles
is simple and adequately done with the existing make features, or by
correcting the scripts that generate files to use unique filenames.


Home | Main Index | Thread Index | Old Index