简体   繁体   English

gengetopt和Automake

[英]gengetopt and Automake

I'm trying to include the generation of the cmdline.c file (from gengetopt's defaults) in my Makefile.am file. 我正在尝试在我的Makefile.am文件中包含cmdline.c文件的生成(来自gengetopt的默认值)。

The file currently reads like these: 该文件当前读取如下:

bin_PROGRAMS = myprog

myprog_SOURCES = main.c cmdline.c
myprog_DEPENDENCIES = gen_cmdline $(myprog_SOURCES) # somewhere I read that setting DEPENDENCIES inhibits automake from calculating those

gen_cmdline:
    gengetopt < myprog.ggo

However, if I modify just myprog.ggo , the cmdline.c and all its dependents won't get recompiled. 但是,如果我只修改myprog.ggocmdline.c及其所有依赖项将不会被重新编译。 What am I missing here? 我在这里错过了什么?

Is gen_cmdline a .PHONY target? gen_cmdline是.PHONY目标吗? If gengetopt creates a file named cmdline.c , then your Makefile.am should probably look like: 如果gengetopt创建了一个名为cmdline.c的文件,那么你的Makefile.am应该看起来像:

bin_PROGRAMS = myprog

myprog_SOURCES = main.c cmdline.c
BUILT_SOURCES = cmdline.c
cmdline.c: myprog.ggo
    gengetopt < $(srcdir)/myprog.ggo

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM