[Top][All Lists]

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

AM_CFLAGS and sub/foo.c

From: Steve M. Robbins
Subject: AM_CFLAGS and sub/foo.c
Date: Wed, 13 Jun 2001 19:17:34 -0400
User-agent: Mutt/1.3.18i


I'm quite confused by the behaviour of CVS automake and AM_CFLAGS.

Given the following

        bin_PROGRAMS = foo
        foo_SOURCES = foo.c sub/foo2.c

it turns out that "foo.c" is compiled using $(COMPILE), and hence
includes AM_CFLAGS.  However, "foo2.c" is compiled *without*
AM_CFLAGS.  Indeed, in automake's handle_languages(), "foo_CFLAGS" is
explicitly substituted for AM_CFLAGS.  

The upshot is that "foo.c" is compiled using AM_CFLAGS but NOT
foo_CFLAGS, while "foo2.c" is compiled NOT using AM_CFLAGS but using

That strikes me as inconsistent.  What is intended?

It seems to me that AM_CFLAGS should always be there.  Assuming this is
true, I started a test case to detect when this is not true (attached).


#! /bin/sh

# Test that AM_ shadow variables are honoured.

. $srcdir/defs || exit 1

cat >> << 'END'

cat > << 'END'
bin_PROGRAMS = foo bar
foo_SOURCES = foo.c sub/foo2.c
bar_SOURCES = sub/


# Make sure `compile' is required.
$ACLOCAL || exit 1
$AUTOMAKE || exit 1

: > compile

$AUTOMAKE || exit 1

# Each line with variable VAR should have shadow variable AM_VAR
# (assume they will appear on the same line)

test "`grep '$(CPPFLAGS)' | grep -v '$(AM_CPPFLAGS)'`"  && exit 1
test "`grep '$(CFLAGS)' | grep -v '$(AM_CFLAGS)'`"    && exit 1
test "`grep '$(LDFLAGS)' | grep -v '$(AM_LDFLAGS)'`"   && exit 1
test "`grep '$(CXXFLAGS)' | grep -v '$(AM_CXXFLAGS)'`"  && exit 1
test "`grep '$(OBJCFLAGS)' | grep -v '$(AM_OBJCFLAGS)'`" && exit 1
test "`grep '$(ASFLAGS)' | grep -v '$(AM_ASFLAGS)'`"   && exit 1
test "`grep '$(FFLAGS)' | grep -v '$(AM_FFLAGS)'`"    && exit 1
test "`grep '$(RFLAGS)' | grep -v '$(AM_RFLAGS)'`"    && exit 1
test "`grep '$(GCJFLAGS)' | grep -v '$(AM_GCJFLAGS)'`"  && exit 1
test "`grep '$(YFLAGS)' | grep -v '$(AM_YFLAGS)'`"    && exit 1

exit 0

by Rocket to the Moon,
by Airplane to the Rocket,
by Taxi to the Airport,
by Frontdoor to the Taxi,
by throwing back the blanket and laying down the legs ...
- They Might Be Giants

reply via email to

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