automake
[Top][All Lists]
Advanced

[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

Hi,

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

Given the following Makefile.am

        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
foo_CFLAGS.

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).

Regards,
-Steve



#! /bin/sh

# Test that AM_ shadow variables are honoured.

. $srcdir/defs || exit 1

cat >> configure.in << 'END'
AC_PROG_CC
AC_PROG_CXX
END

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

END

# 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)'  Makefile.in | grep -v '$(AM_CPPFLAGS)'`"  && exit 1
test "`grep '$(CFLAGS)'    Makefile.in | grep -v '$(AM_CFLAGS)'`"    && exit 1
test "`grep '$(LDFLAGS)'   Makefile.in | grep -v '$(AM_LDFLAGS)'`"   && exit 1
test "`grep '$(CXXFLAGS)'  Makefile.in | grep -v '$(AM_CXXFLAGS)'`"  && exit 1
test "`grep '$(OBJCFLAGS)' Makefile.in | grep -v '$(AM_OBJCFLAGS)'`" && exit 1
test "`grep '$(ASFLAGS)'   Makefile.in | grep -v '$(AM_ASFLAGS)'`"   && exit 1
test "`grep '$(FFLAGS)'    Makefile.in | grep -v '$(AM_FFLAGS)'`"    && exit 1
test "`grep '$(RFLAGS)'    Makefile.in | grep -v '$(AM_RFLAGS)'`"    && exit 1
test "`grep '$(GCJFLAGS)'  Makefile.in | grep -v '$(AM_GCJFLAGS)'`"  && exit 1
test "`grep '$(YFLAGS)'    Makefile.in | 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]