Question

I'm using Google's protocol buffers library in my project. I've found that there is no backward-compatibility between protoc 2.5.0 and 2.4.1 generated code (obviously):

#error incompatible with your Protocol Buffer headers. Please 
regenerate this file with a newer version of protoc.

So I simply want to add Makefile rules to call protoc and generate source files on user's machine. (yes more unnecessary dependencies please)

I would like to add similar rules for bisonc++,flexc++ and xsd-generated codes.

The project is on an autohell (GNU autoconf) build system.

Était-ce utile?

La solution

I don't know protoc, but I run other programs from Makefile.

In my case programs generate platform-dependent data and don't work when cross-compiling. You probably don't need these checks.

in configure.ac:

AM_CONDITIONAL([CROSS_COMPILING], [ test "x$cross_compiling" = xyes ])

add generated file in Makefile.am (assuming that you use automake):

if !CROSS_COMPILING
pkgdata_DATA = generated_file
endif

and then just write a normal make rule to generate it:

generated_file: input_file
        generate$(EXEEXT) -input $< -output $@
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top