Skip to content

Commit 554b787

Browse files
committed
fix: serialize saithriftv2 Thrift generation for parallel Trixie builds
Signed-off-by: Nicholas Ching <nicholaslching@gmail.com>
1 parent bd953b5 commit 554b787

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

test/saithriftv2/Makefile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,23 @@ $(METADIR)sai.thrift:
7777
# rm gen-cpp/gen-py is needed since thrift don't override existing files
7878
# even if sai.thrift file changed :(
7979

80-
$(CPP_SOURCES): $(METADIR)sai.thrift
80+
gen-cpp/sai_rpc.cpp: $(METADIR)sai.thrift
8181
rm -rf gen-cpp
8282
$(THRIFT) -o ./ --gen cpp -r $^
8383

84-
$(PY_SOURCES): $(METADIR)sai.thrift
84+
$(filter-out gen-cpp/sai_rpc.cpp, $(CPP_SOURCES)): gen-cpp/sai_rpc.cpp
85+
86+
gen-py/sai/sai_rpc.py: $(METADIR)sai.thrift
8587
rm -rf gen-py
8688
$(THRIFT) -o ./ --gen py -r $^
8789
$(INSTALL) -vCD $(METADIR)sai_adapter.py gen-py/sai/sai_adapter.py
8890

91+
$(filter-out gen-py/sai/sai_rpc.py, $(PY_SOURCES)): gen-py/sai/sai_rpc.py
92+
8993
# TODO should depend on ../../inc/sai*.h ../../experimental/sai*.h and not /usr/include/sai/sai*.h
9094

9195
$(SAI_PY_HEADERS): $(SAI_HEADERS)
96+
mkdir -p gen-py/sai
9297
$(CTYPESGEN) --output-language=py32 -I/usr/include -I$(SAI_HEADER_DIR) -I../../experimental -I../../custom --include /usr/include/linux/limits.h $^ -o $@
9398
python3 convert_header.py -i $(SAI_PY_HEADERS) -o ./new_header.py
9499
mv $(SAI_PY_HEADERS) ./sai_headers.py.bk
@@ -100,7 +105,7 @@ $(METADIR)saimetadata.h:
100105
$(ODIR)/%.o: gen-cpp/%.cpp
101106
$(CXX) $(CPPFLAGS) -c $< -o $@
102107

103-
$(ODIR)/sai_rpc_server.o: $(METADIR)sai_rpc_frontend.cpp $(METADIR)saimetadata.h
108+
$(ODIR)/sai_rpc_server.o: $(METADIR)sai_rpc_frontend.cpp $(METADIR)saimetadata.h $(CPP_SOURCES)
104109
$(CXX) $(CPPFLAGS) -c $(METADIR)sai_rpc_frontend.cpp -o $@ -I$(METADIR) -I./gen-cpp -I../../inc -I../../experimental -I../../custom
105110

106111
$(ODIR)/saiserver.o: src/saiserver.cpp src/switch_sai_rpc_server.h $(CPP_SOURCES)

0 commit comments

Comments
 (0)