在我的项目中,我正在使用Google的协议缓冲库。我发现在protoc 2.5.0和2.4.1生成的代码之间没有向后兼容性(很明显):
#error incompatible with your Protocol Buffer headers. Please
regenerate this file with a newer version of protoc.因此,我只想添加Makefile规则来调用protoc并在用户机器上生成源文件。(是的,请提供更多不必要的依赖)
我想为bisonc++、flexc++和xsd-generated代码添加类似的规则。
该项目位于autohell (GNU autoconf)构建系统上。
发布于 2013-10-05 15:28:21
我不知道protoc,但我从Makefile运行其他程序。
在我的例子中,程序生成依赖于平台的数据,在交叉编译时不起作用。你可能不需要这些支票。
在configure.ac中:
AM_CONDITIONAL([CROSS_COMPILING], [ test "x$cross_compiling" = xyes ])在Makefile.am中添加生成的文件(假设您使用自动):
if !CROSS_COMPILING
pkgdata_DATA = generated_file
endif然后编写一个普通的make规则来生成它:
generated_file: input_file
generate$(EXEEXT) -input $< -output $@https://stackoverflow.com/questions/19165715
复制相似问题