0

I'm trying to include the generation of the cmdline.c file (from gengetopt's defaults) in my Makefile.am file.

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. What am I missing here?

ivarec
  • 2,542
  • 2
  • 34
  • 57

1 Answers1

2

Is gen_cmdline a .PHONY target? If gengetopt creates a file named cmdline.c, then your Makefile.am should probably look like:

bin_PROGRAMS = myprog

myprog_SOURCES = main.c cmdline.c
BUILT_SOURCES = cmdline.c
cmdline.c: myprog.ggo
    gengetopt < $(srcdir)/myprog.ggo
William Pursell
  • 204,365
  • 48
  • 270
  • 300