I've been trying to get automake to automagically determine how to build .pb.cc and .pb.hh files from a google protocol buffers .proto description, but have had no luck.
I've tried using this post on SO, but it still doesn't work.
Here's an excerpt from my Makefile.am:
PROTOC=@ac_protoc_cmd@
%.pb.h %.pb.cc: %.proto
$(PROTOC) --proto_dir=$(srcdir)/proto --cpp_out=$(srcdir) $(srcdir)/proto/$<
libtass_a_SOURCES = \
$(srcdir)/tass.pb.cc
nobase_include_HEADERS = \
$(srcdir)/tass.pb.h
Upon attempting to run make, I get:
> Making all in src
> make[1]: Entering directory `/project/tass/src'
> make[1]: *** No rule to make target `tass.pb.cc', needed by `tass.pb.o'. Stop.
> make[1]: Leaving directory `/project/tass/src'
> make: *** [all-recursive] Error 1
ac_proto_cmd is filled in with the path to the protoc binary by configure.ac when it does a check for the GPB dependency. I've verified it's of the form "/opt/common/protobuf/-VERSION-/bin/protoc" which is where I keep the GPB library.
I'm trying to keep my .proto files in src/proto, and to have protoc spit out the compiled cc and h files into src. However, even moving my .proto files into src/ doesn't work, so I don't think that's the problem. As far as I can tell, make isn't even attempting to invoke protoc, so I'm not sure that the rule is being interpreted correctly at all by make.
Thanks in advance for any help on this.