automake
[Top][All Lists]
Advanced

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

Re: multi-line AC_SUBSTs as targets in Makefile.am


From: Ralf Wildenhues
Subject: Re: multi-line AC_SUBSTs as targets in Makefile.am
Date: Mon, 8 Oct 2007 20:38:42 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

Hello William,

* William Pursell wrote on Mon, Oct 08, 2007 at 12:11:59PM CEST:
> Andreas Schwab wrote:
>> William Pursell <address@hidden> writes:
>>
>>> I'd like to get away from AC_SUBST_FILE, but I don't see a way
>>> around the manner in which automake is building the Makefile.
>>> Is there a way to construct a generic target via AC_SUBST?
>>
>> How about using AM_CONDITIONAL instead?
>
> How so?  What I'm hoping to do is to have a set of generic targets
> so that I can have a template Makefile.am that simply includes
> the line @MY_TARGETS@
>
> I currently have it working with AC_SUBST_FILE, but I'm copying the
> template target files into each of my project directory trees.
> I would rather install my macros in /usr/share/aclocal, but I
> notice that none of the packages I have ever seen invoke
> AC_SUBST_FILE, and I suspect the reason is that there's no
> good place to put the target file.

Well,  with Autoconf 2.60 or newer, AC_SUBSTed values can contain
newlines, so in principle you could
  AC_PREREQ([2.60])
  AC_SUBST([MY_TARGETS], [# this assignment line is ignored
  target1:
        [...]
  ...])

and it will have roughly the same effect as your previous AC_SUBST_FILE.

However, in both cases (AC_SUBST or AC_SUBST_FILE), you put stuff in a
Makefile which automake won't see, and all its magic variables, its
machinery to let you override its default-provided targets, and so on,
won't work as expected.  This may in some cases be what you want, but
mostly I would guess it shouldn't, unless you are working around some
bug in Automake.

Instead, I suggest you just use Automake's `include' feature to put the
fragment file in the Makefile.am where it is used.  This won't relieve
you from having to copy the fragment into your projects, but it will
cause a readable error message from `automake' if you forgot to.  You
could provide a `bootstrap' script that does the copying for you.

Hope that helps.

Cheers,
Ralf




reply via email to

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