automake
[Top][All Lists]
Advanced

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

Re: Include directive for all generated Makefile.in


From: Ralf Wildenhues
Subject: Re: Include directive for all generated Makefile.in
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 "my_include.am" declares a rule to generate
> documentation :
> $cat my_include.am
> doc :
>    INPUT=. doxygen doxygen.cfg
> 
> Now, I wish to include this rule in every Makefile generated from
> Makefile.in that are themselves generated from Makefile.am.
> 
> A simple solution would be to include "my_include.am" in all
> Makefile.am as follow :
[...]
> However, I don't want to add the "include" instruction in the
> Makefile.am, 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 configure.ac 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

# AM_MAKEFILE_PREPEND([FRAGMENT], [SUBDIR-PATTERN])
# -------------------------------------------------
# Prepend FRAGMENT file to all Makefile.am files matching SUBDIR-PATTERN.
# Multiple fragments are included in LIFO order.

# AM_MAKEFILE_APPEND([FRAGMENT], [SUBDIR-PATTERN])
# ------------------------------------------------
# Append FRAGMENT file to all Makefile.am 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 configure.ac 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])
  AM_COND_IF([COND],
             [AM_MAKEFILE_APPEND([cond-true-fragment.am])],
             [AM_MAKEFILE_APPEND([cond-false-fragment.am])])

could do the same as if you had added

  if COND
  include $(top_srcdir)/cond-true-fragment.am
  else
  include $(top_srcdir)/cond-false-fragment.am
  endif

to the bottom of all Makefile.am 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 Makefile.am 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.

Thanks,
Ralf




reply via email to

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