[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dynamic include in

From: Ralf Wildenhues
Subject: Re: dynamic include in
Date: Fri, 2 Apr 2010 11:45:42 +0200
User-agent: Mutt/1.5.20 (2009-10-28)

Hello Tim,

* Tim Just wrote on Fri, Apr 02, 2010 at 10:04:13AM CEST:
> We use one central to avoid the recursive use of make. This
> central contains all information related to app/ and lib/.
> However each module defines its build system information in an own
> that is located in modules/.
> By default each module should be included to the central
> Furthermore it should be possible to disable modules per
> configure option. That is to not include the corresponding module

One thing you need to know about the automake 'include' feature is that
it works at 'automake' run time: it literally copies the text of the
included fragment files into the resulting toplevel file.
That explains why things wouldn't work with your intermediate include

Another thing to know is that automake flattens
  foo += bar

statements, because += is not portable to non-GNU make.

That being said, automake conditionals can come to the rescue for you.
You can put something like
  AM_CONDITIONAL([MODULE_FOO], [test "$enable_module_foo" = yes])

in (if you've ensured enable_module_foo to be set before),
and use something like
  include modules/foo/

in your toplevel, or alternatively wrap the if/endif around
all text within modules/foo/

You may still run into issues; conditionals don't work with arbitrary
makefile constructs, but those you have showed in the example should be
fine.  Also, the resulting file can grow quite large.

Hope that helps.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]