Skip to content

Commit

Permalink
Fix problem with client-only build requiring btyacc's generated files…
Browse files Browse the repository at this point in the history
… present.

This also fixes annoying problem of incorrect dependecies build of parser.y with parallel make.
  • Loading branch information
asfernandes committed Sep 15, 2023
1 parent 58e4691 commit 5dc3b20
Show file tree
Hide file tree
Showing 15 changed files with 764 additions and 675 deletions.
22 changes: 16 additions & 6 deletions builds/posix/make.shared.targets
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,29 @@
# MOD 07-Oct-2002

# This rule creates parse.cpp from parse.y
# With make 4.3 this can be simplified with a simple group target (&:) dependency.

$(OBJ)/dsql/parse.cpp: $(SRC_ROOT)/include/gen/parse.h
$(OBJ)/dsql/parse.cpp $(SRC_ROOT)/include/gen/parse.h: $(SRC_ROOT)/dsql/parse.y $(SRC_ROOT)/dsql/btyacc_fb.ske
.INTERMEDIATE: parse-gen

$(OBJ)/dsql/parse.cpp: $(GEN_ROOT)/y_tab.c parse-gen
$(CP) $< $@
touch $@

$(SRC_ROOT)/include/gen/parse.h: $(GEN_ROOT)/y_tab.h parse-gen
$(CP) $< $@
touch $@

$(GEN_ROOT)/y_tab.c: parse-gen
$(GEN_ROOT)/y_tab.h: parse-gen

parse-gen: $(SRC_ROOT)/dsql/parse.y $(SRC_ROOT)/dsql/btyacc_fb.ske
sed -n '/%type .*/p' < $< > $(GEN_ROOT)/types.y
sed 's/%type .*//' < $< > $(GEN_ROOT)/y.y
($(BTYACC) -l -d -S $(SRC_ROOT)/dsql/btyacc_fb.ske $(GEN_ROOT)/y.y; echo $$? > $(GEN_ROOT)/y.status) 2>&1 | tee $(GEN_ROOT)/y.txt
(exit `cat $(GEN_ROOT)/y.status`)
sed -n -e "s/.*btyacc: \(.*conflicts.*\)/\1/p" $(GEN_ROOT)/y.txt > $(SRC_ROOT)/dsql/parse-conflicts.txt
sed -i -e 's/#define \([A-Z].*\)/#define TOK_\1/' $(GEN_ROOT)/y_tab.h
sed -i -e 's/#define TOK_YY\(.*\)/#define YY\1/' $(GEN_ROOT)/y_tab.h
$(MV) $(GEN_ROOT)/y_tab.h $(SRC_ROOT)/include/gen/parse.h
$(MV) $(GEN_ROOT)/y_tab.c $(OBJ)/dsql/parse.cpp
touch $(OBJ)/dsql/parse.cpp


# gpre_meta needs a special boot build since there is no database.
Expand All @@ -62,7 +72,7 @@ $(SRC_ROOT)/gpre/gpre_meta.cpp: $(SRC_ROOT)/gpre/gpre_meta.epp


# Explicit dependence on generated header (parser)
$(OBJ)/dsql/Parser.o $(OBJ)/common/keywords.o $(OBJ)/dsql/dsql.o: $(SRC_ROOT)/include/gen/parse.h
$(OBJ)/dsql/Parser.o $(OBJ)/dsql/Keywords.o $(OBJ)/dsql/dsql.o: $(SRC_ROOT)/include/gen/parse.h

# Special cases for building cpp from epp
$(OBJ)/dsql/metd.cpp: $(SRC_ROOT)/dsql/metd.epp
Expand Down
4 changes: 2 additions & 2 deletions builds/win32/msvc15/common.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
<ClCompile Include="..\..\..\src\common\isc.cpp" />
<ClCompile Include="..\..\..\src\common\isc_file.cpp" />
<ClCompile Include="..\..\..\src\common\isc_sync.cpp" />
<ClCompile Include="..\..\..\src\common\keywords.cpp" />
<ClCompile Include="..\..\..\src\common\MsgMetadata.cpp" />
<ClCompile Include="..\..\..\src\common\MsgUtil.cpp" />
<ClCompile Include="..\..\..\src\common\os\win32\fbsyslog.cpp" />
Expand Down Expand Up @@ -189,7 +188,6 @@
<ClInclude Include="..\..\..\src\common\isc_f_proto.h" />
<ClInclude Include="..\..\..\src\common\isc_proto.h" />
<ClInclude Include="..\..\..\src\common\isc_s_proto.h" />
<ClInclude Include="..\..\..\src\common\keywords.h" />
<ClInclude Include="..\..\..\src\common\MsgMetadata.h" />
<ClInclude Include="..\..\..\src\common\MsgUtil.h" />
<ClInclude Include="..\..\..\src\common\os\divorce.h" />
Expand All @@ -199,6 +197,7 @@
<ClInclude Include="..\..\..\src\common\os\mod_loader.h" />
<ClInclude Include="..\..\..\src\common\os\os_utils.h" />
<ClInclude Include="..\..\..\src\common\os\path_utils.h" />
<ClInclude Include="..\..\..\src\common\ParserTokens.h" />
<ClInclude Include="..\..\..\src\common\prett_proto.h" />
<ClInclude Include="..\..\..\src\common\ScanDir.h" />
<ClInclude Include="..\..\..\src\common\sdl.h" />
Expand All @@ -218,6 +217,7 @@
<ClInclude Include="..\..\..\src\common\ThreadStart.h" />
<ClInclude Include="..\..\..\src\common\TimeZones.h" />
<ClInclude Include="..\..\..\src\common\TimeZoneUtil.h" />
<ClInclude Include="..\..\..\src\common\Token.h" />
<ClInclude Include="..\..\..\src\common\Tokens.h" />
<ClInclude Include="..\..\..\src\common\unicode_util.h" />
<ClInclude Include="..\..\..\src\common\UtilSvc.h" />
Expand Down
12 changes: 6 additions & 6 deletions builds/win32/msvc15/common.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,6 @@
<ClCompile Include="..\..\..\src\common\classes\ParsedList.cpp">
<Filter>classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\common\keywords.cpp">
<Filter>common</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\common\Int128.cpp">
<Filter>common</Filter>
</ClCompile>
Expand Down Expand Up @@ -581,6 +578,9 @@
<ClInclude Include="..\..\..\src\common\classes\BlobWrapper.h">
<Filter>headers</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\common\ParserTokens.h">
<Filter>headers</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\common\sha2\sha2.h">
<Filter>headers</Filter>
</ClInclude>
Expand All @@ -599,15 +599,15 @@
<ClInclude Include="..\..\..\src\common\classes\ParsedList.h">
<Filter>headers</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\common\keywords.h">
<Filter>headers</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\common\Int128.h">
<Filter>headers</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\common\Task.h">
<Filter>headers</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\common\Token.h">
<Filter>headers</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\common\classes\TimerImpl.h">
<Filter>headers</Filter>
</ClInclude>
Expand Down
2 changes: 2 additions & 0 deletions builds/win32/msvc15/engine_static.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
<ClCompile Include="..\..\..\src\dsql\errd.cpp" />
<ClCompile Include="..\..\..\src\dsql\ExprNodes.cpp" />
<ClCompile Include="..\..\..\src\dsql\gen.cpp" />
<ClCompile Include="..\..\..\src\dsql\Keywords.cpp" />
<ClCompile Include="..\..\..\src\dsql\make.cpp" />
<ClCompile Include="..\..\..\src\dsql\movd.cpp" />
<ClCompile Include="..\..\..\src\dsql\parse.cpp" />
Expand Down Expand Up @@ -201,6 +202,7 @@
<ClInclude Include="..\..\..\src\dsql\errd_proto.h" />
<ClInclude Include="..\..\..\src\dsql\ExprNodes.h" />
<ClInclude Include="..\..\..\src\dsql\gen_proto.h" />
<ClInclude Include="..\..\..\src\dsql\Keywords.h" />
<ClInclude Include="..\..\..\src\dsql\make_proto.h" />
<ClInclude Include="..\..\..\src\dsql\metd_proto.h" />
<ClInclude Include="..\..\..\src\dsql\movd_proto.h" />
Expand Down
6 changes: 6 additions & 0 deletions builds/win32/msvc15/engine_static.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@
<ClCompile Include="..\..\..\src\dsql\gen.cpp">
<Filter>DSQL</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\dsql\Keywords.cpp">
<Filter>DSQL</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\dsql\make.cpp">
<Filter>DSQL</Filter>
</ClCompile>
Expand Down Expand Up @@ -587,6 +590,9 @@
<ClInclude Include="..\..\..\src\dsql\gen_proto.h">
<Filter>Header files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\dsql\Keywords.h">
<Filter>Header files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\dsql\make_proto.h">
<Filter>Header files</Filter>
</ClInclude>
Expand Down
Loading

0 comments on commit 5dc3b20

Please sign in to comment.