automake
[Top][All Lists]
Advanced

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

Re: AM_CPPFLAGS vs. [lib]_CPPFLAGS


From: Alexandre Duret-Lutz
Subject: Re: AM_CPPFLAGS vs. [lib]_CPPFLAGS
Date: Sun, 13 Apr 2003 23:13:17 +0200
User-agent: Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.2 (gnu/linux)

>>> "Bill" == Bill Moseley <address@hidden> writes:

[...]

 Bill> But I don't understand why.  Is this expected behavior?

Yes.  If you use per-targets flag, objects files need to be
renamed just in case they would clash with objects files compiled 
from the same sources, but with different flags.

Consider

bin_PROGRAMS = true false
true_SOURCES = generic.c
true_CPPFLAGS = -DEXIT_CODE=0
false_SOURCES = generic.c
false_CPPFLAGS = -DEXIT_CODE=1

Obviously the two programs are built from the same source, but
it would be bad if the shared the same object (generic.o)
because it cannot be built with EXIT_CODE=0 *and* EXIT_CODE=1...
Therefore Automake output rules to build two different objects:
true-generic.o and false-generic.o.

Automake doesn't actually look whether sources files are shared
to decide if it must rename objects.  It will just rename all
objects of a target as soon as it sees per-target flags are
used.

If you don't use per-target flags, then it's ok to share
object files.  For instance

AM_CPPFLAGS = -DVERSION=1.0
bin_PROGRAMS = true false
true_SOURCES = true.c version.c
false_SOURCES = false.c version.c

Here true and false will both use version.o.
-- 
Alexandre Duret-Lutz





reply via email to

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