Update lex/yacc builds to be consistent and to support parallel builds
Not all the lex/yacc (flex/bison) targets were using a consistent syntax. This patch fixes that and explicitly serializes the *.c/*.cc and *.h build. Not doing this was causing problem when using make -j. The issue appears to be that if two targets are specified for a rule (e.g. file.cc file.h: file.y) make does not realize they are both built by the same call so the rule is executed twice. Once for the .cc target and once for the .h target. This is not a problem for a serial build. To work around this only use the .c/.cc file in the main target and then make the .h file depend on the .c/.cc file as a sub-target.
This commit is contained in:
parent
f22b42c2cd
commit
9c99bce054
16
Makefile.in
16
Makefile.in
|
|
@ -150,8 +150,8 @@ endif
|
|||
clean:
|
||||
$(foreach dir,$(SUBDIRS),$(MAKE) -C $(dir) $@ && ) true
|
||||
rm -f *.o parse.cc parse.h lexor.cc
|
||||
rm -f ivl.exp iverilog-vpi.man iverilog-vpi.pdf iverilog-vpi.ps parse.output
|
||||
rm -f syn-rules.output dosify.exe ivl@EXEEXT@ check.vvp
|
||||
rm -f ivl.exp iverilog-vpi.man iverilog-vpi.pdf iverilog-vpi.ps
|
||||
rm -f parse.output syn-rules.output dosify.exe ivl@EXEEXT@ check.vvp
|
||||
rm -f lexor_keyword.cc libivl.a libvpi.a iverilog-vpi syn-rules.cc
|
||||
rm -rf dep
|
||||
rm -f version.exe
|
||||
|
|
@ -244,15 +244,17 @@ lexor.o: lexor.cc parse.h
|
|||
|
||||
parse.o: parse.cc
|
||||
|
||||
parse.cc parse.h: $(srcdir)/parse.y
|
||||
$(YACC) --verbose -t -p VL -d -o parse.cc $(srcdir)/parse.y
|
||||
mv parse.cc.h parse.h 2>/dev/null || mv parse.hh parse.h
|
||||
# Build this in two steps to avoid parallel build issues (see pr3462585)
|
||||
parse.cc: $(srcdir)/parse.y
|
||||
$(YACC) --verbose -t -p VL -d -o $@ $<
|
||||
parse.h: parse.cc
|
||||
mv parse.cc.h $@ 2>/dev/null || mv parse.hh $@
|
||||
|
||||
syn-rules.cc: $(srcdir)/syn-rules.y
|
||||
$(YACC) --verbose -p syn_ -o syn-rules.cc $(srcdir)/syn-rules.y
|
||||
$(YACC) --verbose -t -p syn_ -o $@ $<
|
||||
|
||||
lexor.cc: $(srcdir)/lexor.lex
|
||||
$(LEX) -s -olexor.cc $(srcdir)/lexor.lex
|
||||
$(LEX) -s -t $< > $@
|
||||
|
||||
lexor_keyword.o: lexor_keyword.cc parse.h
|
||||
|
||||
|
|
|
|||
|
|
@ -79,11 +79,13 @@ dep:
|
|||
iverilog@EXEEXT@: $O
|
||||
$(CC) $(LDFLAGS) $O -o iverilog@EXEEXT@ @EXTRALIBS@
|
||||
|
||||
cflexor.c: cflexor.lex
|
||||
$(LEX) -s -ocflexor.c $(srcdir)/cflexor.lex
|
||||
cflexor.c: $(srcdir)/cflexor.lex
|
||||
$(LEX) -s -t $< > $@
|
||||
|
||||
cfparse.h cfparse.c: cfparse.y
|
||||
$(YACC) --verbose -t -d -o cfparse.c --name-prefix=cf $(srcdir)/cfparse.y
|
||||
# Build this in two steps to avoid parallel build issues (see pr3462585)
|
||||
cfparse.c: $(srcdir)/cfparse.y
|
||||
$(YACC) --verbose -t -p cf -d -o $@ $<
|
||||
cfparse.h: cfparse.c
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) @DEPENDENCY_FLAG@ -c $< -o $*.o
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ ivlpp@EXEEXT@: $O
|
|||
$(CC) $(LDFLAGS) $O -o ivlpp@EXEEXT@ @EXTRALIBS@
|
||||
|
||||
lexor.c: $(srcdir)/lexor.lex
|
||||
$(LEX) -olexor.c $(srcdir)/lexor.lex
|
||||
$(LEX) -s -t $< > $@
|
||||
|
||||
install: all installdirs $(libdir)/ivl$(suffix)/ivlpp@EXEEXT@
|
||||
|
||||
|
|
|
|||
|
|
@ -110,9 +110,11 @@ parse.o: parse.cc
|
|||
lexor.cc: $(srcdir)/lexor.lex
|
||||
$(LEX) -s -olexor.cc $(srcdir)/lexor.lex
|
||||
|
||||
parse.cc parse.h: $(srcdir)/parse.y
|
||||
$(YACC) --verbose -t -d -o parse.cc $(srcdir)/parse.y
|
||||
mv parse.cc.h parse.h 2>/dev/null || mv parse.hh parse.h
|
||||
# Build this in two steps to avoid parallel build issues (see pr3462585)
|
||||
parse.cc: $(srcdir)/parse.y
|
||||
$(YACC) --verbose -t -d -o $@ $<
|
||||
parse.h: parse.cc
|
||||
mv parse.cc.h $@ 2>/dev/null || mv parse.hh $@
|
||||
|
||||
lexor_keyword.o: lexor_keyword.cc parse.h
|
||||
|
||||
|
|
|
|||
|
|
@ -125,23 +125,27 @@ system.vpi: $O $(OPP) ../vvp/libvpi.a
|
|||
$(CXX) @shared@ -o $@ $O $(OPP) -L../vvp $(LDFLAGS) -lvpi $(SYSTEM_VPI_LDFLAGS)
|
||||
|
||||
sys_readmem_lex.c: $(srcdir)/sys_readmem_lex.lex
|
||||
$(LEX) -t $(srcdir)/sys_readmem_lex.lex > sys_readmem_lex.c
|
||||
$(LEX) -s -t $< > $@
|
||||
|
||||
sdf_lexor.o: sdf_lexor.c sdf_parse.h
|
||||
|
||||
sdf_lexor.c: $(srcdir)/sdf_lexor.lex
|
||||
$(LEX) -t $(srcdir)/sdf_lexor.lex > sdf_lexor.c
|
||||
$(LEX) -s -t $< > $@
|
||||
|
||||
sdf_parse.c sdf_parse.h: $(srcdir)/sdf_parse.y
|
||||
$(YACC) --verbose -d -p sdf -o sdf_parse.c $(srcdir)/sdf_parse.y
|
||||
# Build this in two steps to avoid parallel build issues (see pr3462585)
|
||||
sdf_parse.c: $(srcdir)/sdf_parse.y
|
||||
$(YACC) --verbose -t -p sdf -d -o $@ $<
|
||||
sdf_parse.h: sdf_parse.c
|
||||
|
||||
table_mod_lexor.o: table_mod_lexor.c table_mod_parse.h
|
||||
|
||||
table_mod_lexor.c: $(srcdir)/table_mod_lexor.lex
|
||||
$(LEX) -t $< > $@
|
||||
$(LEX) -s -t $< > $@
|
||||
|
||||
table_mod_parse.c table_mod_parse.h: $(srcdir)/table_mod_parse.y
|
||||
$(YACC) --verbose -d -p tblmod -o table_mod_parse.c $<
|
||||
# Build this in two steps to avoid parallel build issues (see pr3462585)
|
||||
table_mod_parse.c: $(srcdir)/table_mod_parse.y
|
||||
$(YACC) --verbose -t -p tblmod -d -o $@ $<
|
||||
table_mod_parse.h: table_mod_parse.c
|
||||
|
||||
v2005_math.vpi: $M ../vvp/libvpi.a
|
||||
$(CC) @shared@ -o $@ $M -L../vvp $(LDFLAGS) -lvpi $(VA_MATH_VPI_LDFLAGS)
|
||||
|
|
|
|||
|
|
@ -157,11 +157,11 @@ parse.o: parse.cc
|
|||
|
||||
tables.o: tables.cc
|
||||
|
||||
# Build this in two steps to avoid parallel build issues (see pr3462585)
|
||||
parse.cc: $(srcdir)/parse.y
|
||||
$(YACC) --verbose -t -d -o parse.cc $(srcdir)/parse.y
|
||||
|
||||
$(YACC) --verbose -t -d -o $@ $<
|
||||
parse.h: parse.cc
|
||||
mv parse.cc.h parse.h 2>/dev/null || mv parse.hh parse.h
|
||||
mv parse.cc.h $@ 2>/dev/null || mv parse.hh $@
|
||||
|
||||
lexor.cc: $(srcdir)/lexor.lex
|
||||
$(LEX) -s -olexor.cc $(srcdir)/lexor.lex
|
||||
|
|
|
|||
Loading…
Reference in New Issue