automake
[Top][All Lists]
Advanced

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

Re: 2nd possibly silly question: XTRA_foo_SOURCES


From: Robert Collins
Subject: Re: 2nd possibly silly question: XTRA_foo_SOURCES
Date: Mon, 9 Apr 2001 01:45:11 +1000

----- Original Message -----
From: "Tom Tromey" <address@hidden>
To: "Robert Collins" <address@hidden>
Cc: <address@hidden>
Sent: Sunday, April 08, 2001 6:36 AM
Subject: Re: 2nd possibly silly question: XTRA_foo_SOURCES


> >>>>> "Robert" == Robert Collins <address@hidden>
writes:
>
> Robert> 1) The
> Robert> http://www.gnu.org/manual/automake/html_mono/automake.html
> Robert> documentation implies that _SOURCES can take the same style of
> Robert> late bound entries as _PROGRAMS and _LIBRARIES can, as long as
> Robert> EXTRA_foo_SOURCES contains all possible entries.
>
> Thanks.  Can you suggest a doc patch?

yes, where EXTRA_foo_SOURCES is discussed add something like:

"Due to the fact that make requires targets, and SOURCES are precursors
for targets, configure variables cannot be directly inserted into
*_SOURCES lines. Instead you should set an am_conditional in
configure.in like
<pick a good clean example here>
and test for it like
if TESTVALUE
foo_SOURCES += source.c
endif
or
if TESTVALUE
SOURCEC = source.c
endif

foo_SOURCES = ... $(SOURCEC) ...
"

If possible I'd also enlarge the error when running to automake to
either include the example given and the reasoning you've got below, or
provide a reference to the chapter in the doco.

> Robert> 2) I don't understand why there is a fundamental difference
between
> Robert> _PROGRAMS (allows configure substitutions both directly and
indirectly
> Robert> ($(CONFGSUBSTVAR)) and _SOURCES wihch doesn't.
> Robert> - Working on the principle of least surprise, this fails :].
>
> Yeah, that's a tough one.
>
> However the two cases are different.  Suppose you have @FOO@ in
> _PROGRAMS.  When configure computes FOO, it is putting program names
> in there.  These can be directly substituted into the Makefile,
> because those same program names will be actual targets.
>
> Now consider @FOO@ in a _SOURCES variable.  In this case configure
> will compute `FOO = something.c' -- but the actual target name is
> `something.o', and there is no portable way (I think) to do the .c ->
> .o mapping at make time.  (Maybe $(FOO:.c=.o) is portable.  But that
> neglects .cc, .f77, .java, etc, etc.)
>
> In essence the difference is that automake has to do more processing
> of _SOURCES than _PROGRAMS.  I agree this distinction is confusing for
> the user though.
>
> Tom
>

Thanks, that's cleared it up for me... I can see the issue clearly now.
Something to consider: Is it possible to have a macro like
AM_ADD_SOURCE(program, sourcefile;sourcefile;sourcefile)
that wraps the conditional and so forth? That would make it direct for
the average user, and if/when the issue is cleared up in the future, the
macro could be changed rather than all the makefile.am's needing
conversion to avoid the conditional.

Rob




reply via email to

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