1

My project is a library and automake is configured to build it and test it. There is also additional target which builds demo application for my library. It's defined in Makefile.am as EXTRA_PROGRAMS. I'd like to be able to install with make install or similar. Is there a way to do it but still keep optionality of this target (i.e. simply defining this target in bin_PROGRAMS will make this target required)?

peetonn
  • 2,942
  • 4
  • 32
  • 49
  • Possible duplicate [automake: install arbitrary data files](http://stackoverflow.com/questions/10721826/automake-install-arbitrary-data-files) – Joel Mar 28 '16 at 18:50

1 Answers1

2

The usual way to do this sort of thing is to have configure substitute the value into bin_PROGRAMS conditionally. In your Makefile.am this would look like:

bin_PROGRAMS = main-program $(test_program)
EXTRA_PROGRAMS = test-program

Then in configure.in you'd do something like:

if mumble; then
  test_program=test-program
fi
AC_SUBST(test_program)
Tom Tromey
  • 21,507
  • 2
  • 45
  • 63