automake
[Top][All Lists]
Advanced

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

Re: AM_CPPFLAGS vs. [lib]_CPPFLAGS


From: William S Fulton
Subject: Re: AM_CPPFLAGS vs. [lib]_CPPFLAGS
Date: Fri, 18 Apr 2003 21:37:45 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1) Gecko/20021130

I was puzzling over this some time ago too. Perhaps this explanation could be put in the manual?

William


 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]