Search code examples
cmakefileautotoolsautomake

How to specify multiple source files in Makefile.am


New to using autoconf and automake, I am following this to learn them.

I have a question regarding Makefile.am file. For a simple helloworld program below Makefile.am works:

AUTOMAKE_OPTIONS = foreign
bin_PROGRAMS = helloworld
helloworld_SOURCES = hello.c

How do we specify multiple source files (if there are multiple source files required to compile the program) in the third line ?

You can assume all source files are in same directory where the Makefile.am is.


Solution

  • All you have to do is add them to the hellworld_SOURCES each file is delimited by a space.

    AUTOMAKE_OPTIONS = foreign
    bin_PROGRAMS = helloworld
    helloworld_SOURCES = hello.c x.c y.c b.c