Question

I'd like to include many files in one Makefile.am file in the xxx_SOURCES = ... part. Is there any way to use a typical shell expansions there? What I'm looking for is a working equivalent for:

xxx_SOURCES = xxx.c $(top_builddir)/src/{aaa,bbb,ccc}.c
Was it helpful?

Solution

1) There is no way to do that in portable Make syntax (ephemient's answer will work only with GNU Make) 2) There is no way to do that using Automake either. (Although the feature should not be too hard to implement by someone who need it...)

Personally I don't really see the advantage to using

foo_SOURCES = subdir/{foo,bar,baz}.c

over

foo_SOURCES = \
  subdir/foo.c \
  subdir/bar.c \
  subdir/baz.c

I find the former is more cryptic, and it is not grepable (e.g. to answer the question "which Makefile mentions foo.c?").

OTHER TIPS

I don't know if it's the best way, but this is what I've always done:

xxx_SOURCES = xxx.c $(shell echo $(top_builddir)/src/{aaa,bbb,ccc}.c)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top