Building dash in parallel still fails:
GEN dash/builtins.def
HOSTCC dash/mkinit
HOSTCC dash/mknodes
HOSTCC dash/mksignames
HOSTCC dash/mksyntax
dash/mksignames.c:59: warning: function declaration isn?t a prototype
dash/mksignames.c:365: warning: function declaration isn?t a prototype
dash/mksignames.c:386: warning: function declaration isn?t a prototype
KLIBCCC dash/alias.o
cd dash; \
bison -y -d /home/hpa/klibc/klibc.clean/dash/arith.y; \
mv y.tab.c arith.c; \
mv y.tab.h arith.h
cd dash; \
bison -y -d /home/hpa/klibc/klibc.clean/dash/arith.y; \
mv y.tab.c arith.c; \
mv y.tab.h arith.h
KLIBCCC dash/cd.o
dash/alias.c: In function ?unaliascmd?:
dash/alias.c:162: warning: unused parameter ?argc?
dash/alias.c:162: warning: unused parameter ?argv?
KLIBCCC dash/error.o
KLIBCCC dash/eval.o
dash/cd.c:47:36: error: nodes.h: No such file or directory
In file included from dash/cd.c:48:
dash/jobs.h:102: warning: ?union node? declared inside parameter list
dash/jobs.h:102: warning: its scope is only this definition or
declaration, which is probably not what you want
dash/jobs.h:103: warning: ?union node? declared inside parameter list
In file included from dash/cd.c:53:
dash/exec.h:74: warning: ?union node? declared inside parameter list
dash/cd.c: In function ?cdcmd?:
dash/cd.c:88: warning: unused parameter ?argc?
dash/cd.c:88: warning: unused parameter ?argv?
dash/cd.c: In function ?pwdcmd?:
dash/cd.c:259: warning: unused parameter ?argc?
dash/cd.c:259: warning: unused parameter ?argv?
make[2]: *** [dash/cd.o] Error 1
make[2]: *** Waiting for unfinished jobs....
... I'm pretty sure this is due to the rules of the following form ...
# Generate nodes{.c + .h}
quiet_cmd_mknodes = GEN $@
cmd_mknodes = cd $(obj); ./mknodes $(srctree)/$(src)/nodetypes \
$(srctree)/$(src)/nodes.c.pat
$(obj)/nodes.c $(obj)/nodes.h: $(obj)/mknodes $(src)/nodetypes \
$(src)/nodes.c.pat
$(call cmd,mknodes)
... which DO NOT do what one logically think they do. If executed in
parallel that rule will be executed not once but *twice*, one for
nodes.c and one for nodes.h, and they will of course step on each other.
One way to deal with that is to have a dummy rule from nodes.c to
nodes.h, and another way is to have the program only output one file and
not the other.
This particular misfeature is my #1 gripe with make, and has been.
Unfortunately, the GNU make people don't seem willing to come up with a
proper fix.
-hpa
On Tue, Dec 13, 2005 at 09:29:02AM -0800, H. Peter Anvin wrote:> ... which DO NOT do what one logically think they do. If executed in > parallel that rule will be executed not once but *twice*, one for > nodes.c and one for nodes.h, and they will of course step on each other. > One way to deal with that is to have a dummy rule from nodes.c to > nodes.h, and another way is to have the program only output one file and > not the other.Thanks for the suggestion. This is defintely tricky stuff :) I've done the dummy rule for nodes.[ch] and the split output for arith.[ch]. This patch should also make O=dir work. Cheers, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- diff --git a/dash/Kbuild b/dash/Kbuild --- a/dash/Kbuild +++ b/dash/Kbuild @@ -2,8 +2,6 @@ # Kbuild file for dash # -YACC := bison -y - COMMON_CFLAGS : COMMON_CPPFLAGS := \ -DBSD=1 -DSMALL -DSHELL \ @@ -14,14 +12,14 @@ CFLAGS := $(COMMON_CFLAGS) CPPFLAGS := $(COMMON_CPPFLAGS) CFLAGS_FOR_BUILD := $(COMMON_CFLAGS) CPPFLAGS_FOR_BUILD := $(COMMON_CPPFLAGS) -YFLAGS := -d DEFS := -DHAVE_CONFIG_H -DEFAULT_INCLUDES := -I$(srctree)/$(src) -include $(srctree)/$(src)/config.h +DEFAULT_INCLUDES := \ + -I$(srctree)/$(src) -I$(objtree)/$(obj) \ + -include $(srctree)/$(src)/config.h EXTRA_KLIBCCFLAGS := $(DEFS) $(DEFAULT_INCLUDES) $(CPPFLAGS) $(CFLAGS) HOST_EXTRACFLAGS := $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -YACCCOMPILE := $(YACC) $(YFLAGS) SRCS := alias.c arith_yylex.c cd.c error.c eval.c exec.c expand.c \ histedit.c input.c jobs.c mail.c main.c memalloc.c miscbltin.c \ @@ -59,7 +57,12 @@ hostprogs-y := $(HELPERS) # For cleaning targets := $(static-y) $(shared-y) $(CLEANFILES) -$(addprefix $(obj)/, $(OBJS)): $(addprefix $(obj)/, $(BUILT_SOURCES)) +$(addprefix $(obj)/, $(OBJS)): $(addprefix $(obj)/, $(BUILT_SOURCES) check) + +quiet_cmd_check = CHECK $(obj) + cmd_check = mkdir -p $(obj)/bltin; touch $(obj)/check +$(obj)/check: + $(call cmd,check) # Generate token.h quiet_cmd_mktokens = GEN $@ @@ -90,10 +93,14 @@ $(obj)/init.c: $(obj)/mkinit $(addprefix quiet_cmd_mknodes = GEN $@ cmd_mknodes = cd $(obj); ./mknodes $(srctree)/$(src)/nodetypes \ $(srctree)/$(src)/nodes.c.pat -$(obj)/nodes.c $(obj)/nodes.h: $(obj)/mknodes $(src)/nodetypes \ - $(src)/nodes.c.pat +$(obj)/nodes.c: $(obj)/mknodes $(src)/nodetypes $(src)/nodes.c.pat $(call cmd,mknodes) +quiet_cmd_mknodes_h = GEN $@ + cmd_mknodes_h = : +$(obj)/nodes.h: $(obj)/nodes.c + $(call cmd,mknodes_h) + quiet_cmd_mksyntax = GEN $@ cmd_mksyntax = cd $(obj); ./mksyntax $(obj)/syntax.c $(obj)/syntax.h: $(obj)/mksyntax @@ -105,11 +112,11 @@ $(obj)/signames.c: $(obj)/mksignames $(call cmd,mksignames) -$(obj)/arith.h $(obj)/arith.c: $(src)/arith.y - cd $(obj); \ - $(YACCCOMPILE) $(srctree)/$<; \ - mv y.tab.c arith.c; \ - mv y.tab.h arith.h +$(obj)/arith.c: $(src)/arith.y + bison -o $@ $< + +$(obj)/arith.h: $(src)/arith.y + bison --defines=$@ -o /dev/null $< # Targets to install
On Tue, Dec 13, 2005 at 09:29:02AM -0800, H. Peter Anvin wrote: [...]> $(obj)/nodes.c $(obj)/nodes.h: $(obj)/mknodes $(src)/nodetypes \ > $(src)/nodes.c.pat > $(call cmd,mknodes) > > ... which DO NOT do what one logically think they do. If executed in > parallel that rule will be executed not once but *twice*, one for > nodes.c and one for nodes.h, and they will of course step on each other. > One way to deal with that is to have a dummy rule from nodes.c to > nodes.h, and another way is to have the program only output one file and > not the other.Another option is to use a pattern rule for the targets. If a pattern rule contains multiple targets, GNU make marks all of the targets as updated after running the commands only once (see the "Pattern Intro" node in the GNU make manual).> This particular misfeature is my #1 gripe with make, and has been. > Unfortunately, the GNU make people don't seem willing to come up with a > proper fix.The pattern rule technique is obscure and might be hard to apply in a readable manner. I only know about it because I had to solve a similar problem in another project last week. For the above case: $(obj)/nodes.%: ... might not solve it, if make thinks that the pattern also matches nodes.o (the order of the rules in the Makefile may be important). Something really ugly like this might work: $(obj)/%odes.h $(obj)/%odes.c: ... -Dave Dodge