Reputation: 549
I have to modify a Makefile such that the intermediate files with extension .cc
are moved to .cpp
before building the .o.
files. My modified Makefile looks like below.
PROTOC=protoc
all: client_grpc pb
client_grpc: abc.pb.o abc.grpc.pb.o client_grpc.o
$(CXX) $^ $(LDFLAGS) -o $@
pb: %.pb.cc
mv $^ $@
%.grpc.pb.cc: %.proto
$(PROTOC) --grpc_out=. --plugin=protoc-gen-grpc=$(GRPC_CPP_PLUGIN_PATH) $<
%.pb.cc: %.proto
$(PROTOC) --cpp_out=. $<
clean:
rm -f *.o *.pb.cc *.pb.h client_gqegrpc
protoc
is a compiler that generates .cc
files. How to make targets so that after generating the .cc
files those are move to .cpp
and then the client_grpc
is built using the .cpp
files ?
Upvotes: 3
Views: 2028
Reputation: 126203
The usual way to do this would be to have your rule produce .cpp files:
%.pb.cpp: %.proto
$(PROTOC) --cpp_out=. $<
mv $*.pb.cc $*.pb.cpp
Upvotes: 3