3
votes

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.

2
There are much more comprehensive guides to developing an autotools build system, like the Autotools Mythbuster, which introduces features progressively. The learning curve for the the autotools is very steep, but it's probably the best attempt I've seen that attempts to overcome this.Brett Hale
@BrettHale Thanks for the link...sps

2 Answers

3
votes

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
1
votes

If you just dont want to provide all file names in _SOURCES as below

helloworld_SOURCES = hello.c x.c y.c b.c

and just want to use *.c then you can use it as below in makefile.am

helloworld_SOURCES = $(wildcard your_src_dir/*.c)