chenBright commented on code in PR #3596:
URL: https://github.com/apache/brpc/pull/3596#discussion_r4581607906


##########
Makefile:
##########
@@ -305,6 +305,10 @@ output/bin:protoc-gen-mcpack
        @mkdir -p $@
        @cp $^ $@
 
+src/idl_options.pb.cc src/idl_options.pb.h:src/mcpack2pb/idl_options.proto
+       @echo "> Generating $@"
+       $(PROTOC) --cpp_out=./src --proto_path=./src/mcpack2pb 
--proto_path=$(PROTOBUF_HDR) $<

Review Comment:
   Using a normal `:` here treats `.pb.cc` and `.pb.h` as two independent 
targets. In a clean parallel build, the direct dependency of 
`protoc-gen-mcpack` on `.pb.cc` and the dependency of `generator.o` on `.pb.h` 
can start two `protoc` processes that write the same set of files concurrently. 
After one finishes, the compiler may read the header while the other is 
truncating and rewriting it, causing intermittent build failures. The baseline 
multi-target pattern rule runs the generation only once.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to