views:

22

answers:

2

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
+1  A: 

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)
ephemient
Cool, but seems like an ugly hack... I hope someone knows a better solution :)
viraptor
This solution works only with GNU Make, and completely bypasses automake's mechanisms. Automake will not know anything about the filenames being expanded (so he won't be able to generate proper rules in all cases).
adl
+1  A: 

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?").

adl