[Top][All Lists]

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

Re: Include directive for all generated

From: Ralf Wildenhues
Subject: Re: Include directive for all generated
Date: Tue, 13 Apr 2010 19:53:00 +0200
User-agent: Mutt/1.5.20 (2009-10-28)

* Xavier MARCELET wrote on Tue, Apr 13, 2010 at 09:38:36AM CEST:
> Lets say that the file "" declares a rule to generate
> documentation :
> $cat
> doc :
>    INPUT=. doxygen doxygen.cfg
> Now, I wish to include this rule in every Makefile generated from
> that are themselves generated from
> A simple solution would be to include "" in all
> as follow :
> However, I don't want to add the "include" instruction in the
>, in fact, I don't want to modify those files at all.
> My question is : is there any way to get the same result by
> modifying another automake's config file, like for
> instance ?

Well, repeating your question won't really change my answer, I
understood you the first time.  ;-)

However, you are right that this would be a nice feature to have, and
therefore thanks for insisting!  This could be a step in the right
direction for a more extensible Automake.

For example, we could have a couple of macros

# -------------------------------------------------
# Prepend FRAGMENT file to all files matching SUBDIR-PATTERN.
# Multiple fragments are included in LIFO order.

# ------------------------------------------------
# Append FRAGMENT file to all files matching SUBDIR-PATTERN.
# Multiple fragments are included in FIFO order.

The details for easy usage may turn out a bit hairy though, at least I
haven't thought them through fully yet:

Would it suffice to have the prepend placement be LIFO and the append
one be FIFO?  Or should these be independent degrees of freedom to set
by the author, and per-fragment or globally?

One needs to take into account that the rules should be sensible also
for authors of third-party code like gnulib.

It should be fairly straight-forward to use this within AM_COND_IF, but
other than that, there are no configure-time decisions that one may
exploit here.  For example:

  AM_CONDITIONAL([COND], [test "$cond" = yes])

could do the same as if you had added

  if COND
  include $(top_srcdir)/
  include $(top_srcdir)/

to the bottom of all files, but other than that, the
arguments to AM_MAKEFILE_PREPEND would have to be literals (to the
shell, at least; you can probably still use m4 macros).

I'm not sure whether PATTERN should be a regex, glob, or some other
sub-setting mechanism altogether.  It should probably match the
resulting Makefile and not the file however (for consistency
with AC_CONFIG_FILES and friends).

For more extensibility, we also need to think about how to define
alternate subdirs where the fragments may be found.


reply via email to

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