[klibc] Re: Parallel build of dash still fails

Herbert Xu herbert at gondor.apana.org.au
Thu Dec 15 22:42:24 PST 2005


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



More information about the klibc mailing list