Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Wildcard expansion with automake/autoconf

625 views
Skip to first unread message

Ian Pilcher

unread,
Apr 12, 2002, 7:43:37 AM4/12/02
to
I am trying to construct a Makefile.am that will build a program out of
all the *.c files in a directory. It seems like it should be simple,
but I can't find a way to make it work.

I can use the wildcard function to specify the sources, but automake
doesn't deal with this when figuring out the objects.

Am I missing something really obvious (entirely possible), or is this
truly far more difficult that it should be?

Thanks!
--
========================================================================
Ian Pilcher pilc...@attbi.com
========================================================================

Roger Leigh

unread,
Apr 12, 2002, 2:00:16 PM4/12/02
to
Ian Pilcher <pilc...@attbi.com> writes:

> I am trying to construct a Makefile.am that will build a program out of
> all the *.c files in a directory. It seems like it should be simple,
> but I can't find a way to make it work.

Automake will want a complete list of the sources of your program, so
that it can compute dependencies.

> I can use the wildcard function to specify the sources, but automake
> doesn't deal with this when figuring out the objects.

> Am I missing something really obvious (entirely possible), or is this
> truly far more difficult that it should be?

It's not possible, and is actively discouraged. You should explicitly
define your sources:

bin_PROGRAMS = myprog
myprog_SOURCES = foo.c bar.c baz.c

If you want to conditionally compile source code, you can list extra
potential source files with EXTRA_myprog_SOURCES, and then include
them in myprog_SOURCES with @foo@ configure substitutions.

--
Roger Leigh
** Registration Number: 151826, http://counter.li.org **
Need Epson Stylus Utilities? http://gimp-print.sourceforge.net/
GPG Public Key: 0x25BFB848 available on public keyservers

Ian Pilcher

unread,
Apr 12, 2002, 8:59:04 PM4/12/02
to
Roger Leigh wrote:
>
> It's not possible, and is actively discouraged. You should explicitly
> define your sources:
>

Of course. It would be foolish to use computers to automate repetitive
tasks.

Roger Leigh

unread,
Apr 13, 2002, 4:55:00 AM4/13/02
to
Ian Pilcher <pilc...@attbi.com> writes:

> Roger Leigh wrote:
> >
> > It's not possible, and is actively discouraged. You should explicitly
> > define your sources:
>
> Of course. It would be foolish to use computers to automate repetitive
> tasks.

This has just been mentioned on the automake lists. Currently it's
not possible, but it may be in the future. This is one thing I would
not automate though--a build should be _reliable_, and using wildcards
will not guarantee consistency. For example, if you accidentally copy
an extra .c file into a directory, it will be built and distributed
without your knowledge (but if you use CVS, others will build
something different, as they won't have this `extra' file). The
converse also applies, and you will get errors if files are missing,
which is good.

0 new messages