Re: make rule of multiple file generation (was Re: CVS commit: src/share/mk)
On Dec 12, 3:14pm, uebay...@tombi.co.jp (Masao Uebayashi) wrote: -- Subject: make rule of multiple file generation (was Re: CVS commit: src/sh | (Moved from source-change...@netbsd.org.) | | Actually I am interested. You just did not present your solution in | tech-whatever so I did not have a chance to comment. Do you have an | example where the existing rules fail, so that I can see what you are | trying to fix? | | % cd bin/sh | % cvs up -D20091201 | % nbmake-XXX -n sh Ok, this is fixed now (in bsd.sys.mk). What else is broken? christos
Re: make rule of multiple file generation (was Re: CVS commit: src/share/mk)
On Dec 14, 9:13am, uebay...@tombi.co.jp (Masao Uebayashi) wrote: -- Subject: Re: make rule of multiple file generation (was Re: CVS commit: sr | | % cd bin/sh | | % cvs up -D20091201 | | % nbmake-XXX -n sh | | Ok, this is fixed now (in bsd.sys.mk). What else is broken? | | % cd bin/sh | % nbmake-XXX clean | % nbmake-XXX nodes.c nodes.h | % rm $( nbmake-XXX print-objdir )/nodes.h | % nbmake-XXX This has nothing to do with yacc; the rules in that Makefile are wrong. instead of: nodes.h: nodes.c nodes.c: mknodes.sh nodetypes nodes.c.pat it should be: nodes.h nodes.c: mknodes.sh nodetypes nodes.c.pat What else? christos
Re: make rule of multiple file generation (was Re: CVS commit: src/share/mk)
On Dec 14, 11:40am, uebay...@tombi.co.jp (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: mknodes.sh nodetypes nodes.c.pat | | it should be: | | nodes.h nodes.c: mknodes.sh nodetypes nodes.c.pat | | % /src/netbsd/work.TNF/landisk/tools/bin/nbmake-landisk -j 2 nodes.h nodes.c |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: mknodes.sh nodetypes nodes.c.pat ${_MKTARGET_CREATE} ${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. christos
Re: make rule of multiple file generation (was Re: CVS commit: src/share/mk)
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: mknodes.sh nodetypes nodes.c.pat ${_MKTARGET_CREATE} ${SCRIPT_ENV} ${HOST_SH} ${.ALLSRC:S/^nodes.c$//} ${.OBJDIR} [ -f nodes.h ] You should have written this version at first. :) This seems work for me. I think I tried a similar one but clearly I figured out the trick of removing nodes.c from ${.ALLSRC}. Next is usr.bin/ktruss. 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 $GENCMD provides a way to extract only one output file. It looks like complex because it's embedded in makefile. I don't think it's really complex. It's just redundant. :) correcting the scripts that generate files to use unique filenames. Actually I like this more. Masao -- Masao Uebayashi / Tombi Inc. / Tel: +81-90-9141-4635
Re: make rule of multiple file generation (was Re: CVS commit: src/share/mk)
On Dec 14, 12:41pm, uebay...@tombi.co.jp (Masao Uebayashi) wrote: -- Subject: Re: make rule of multiple file generation (was Re: CVS commit: sr | 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: mknodes.sh nodetypes nodes.c.pat | ${_MKTARGET_CREATE} | ${SCRIPT_ENV} ${HOST_SH} ${.ALLSRC:S/^nodes.c$//} ${.OBJDIR} | [ -f nodes.h ] | | You should have written this version at first. :) Well, I did not undestand what the problem was at the time :-) | This seems work for me. I think I tried a similar one but clearly I figured | out the trick of removing nodes.c from ${.ALLSRC}. | | Next is usr.bin/ktruss. That worked ok for me with -j 4. | 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 | | $GENCMD provides a way to extract only one output file. It looks like | complex because it's embedded in makefile. I don't think it's really complex. | It's just redundant. :) Yes, it adds more explicit rules... My vote is to remove it and fix the Makefiles/scripts that are broken. It is pretty straight-forward. | correcting the scripts that generate files to use unique filenames. | | Actually I like this more. We could do both, but forcing serialization is probably more efficient since it causes the script to be invoked only once and avoids races. christos
Re: make rule of multiple file generation (was Re: CVS commit: src/share/mk)
Yes, it adds more explicit rules... My vote is to remove it and fix the Makefiles/scripts that are broken. It is pretty straight-forward. Now I'm fine with nuking GENCMD and fix rules using .ORDER:. Please go for it. It'd be also nice if all instances are rewritten to look an idiom, like: # multiple outputs .ORDER: nodes.h nodes.c nodes.c nodes.h: mknodes.sh nodetypes nodes.c.pat ${_MKTARGET_CREATE} ${SCRIPT_ENV} ${HOST_SH} ${.ALLSRC} ${.OBJDIR} So that the code fragment will propagate together. Masao -- Masao Uebayashi / Tombi Inc. / Tel: +81-90-9141-4635
Re: make rule of multiple file generation (was Re: CVS commit: src/share/mk)
On Dec 14, 1:09pm, uebay...@tombi.co.jp (Masao Uebayashi) wrote: -- Subject: Re: make rule of multiple file generation (was Re: CVS commit: sr | Yes, it adds more explicit rules... My vote is to remove it and fix | the Makefiles/scripts that are broken. It is pretty straight-forward. | | Now I'm fine with nuking GENCMD and fix rules using .ORDER:. Please go | for it. It'd be also nice if all instances are rewritten to look an idiom, | like: | | # multiple outputs | .ORDER: nodes.h nodes.c | nodes.c nodes.h: mknodes.sh nodetypes nodes.c.pat | ${_MKTARGET_CREATE} | ${SCRIPT_ENV} ${HOST_SH} ${.ALLSRC} ${.OBJDIR} | | So that the code fragment will propagate together. Do you have a list of the Makefiles contain GENCMD? christos
Re: make rule of multiple file generation (was Re: CVS commit: src/share/mk)
Yes: % find * -name Makefile | xargs grep -l GENCMD usr.bin/ktruss/Makefile % find * -name '*.mk' | xargs grep -l GENCMD share/mk/bsd.own.mk Masao -- Masao Uebayashi / Tombi Inc. / Tel: +81-90-9141-4635