GNU bug report logs - #14396
AM_CPPFLAGS not respected when using subdir-objects

Previous Next

Package: automake;

Reported by: Mike Frysinger <vapier <at> gentoo.org>

Date: Tue, 14 May 2013 03:09:02 UTC

Severity: normal

Tags: notabug

Done: Stefano Lattarini <stefano.lattarini <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Mike Frysinger <vapier <at> gentoo.org>
To: bug-automake <at> gnu.org
Subject: AM_CPPFLAGS not respected when using subdir-objects
Date: Mon, 13 May 2013 23:07:42 -0400
[Message part 1 (text/plain, inline)]
i've been playing around with subdir-objects and noticed that sub-compiles 
don't respect AM_CPPFLAGS :(.  happens with automake 1.13.1 and the latest 
1.13.1d test release.  also using autoconf-2.69 if it matters.

$ cat configure.ac
AC_INIT([pkg], [0])
AM_INIT_AUTOMAKE([subdir-objects])
AC_PROG_CC
AM_PROG_CC_C_O
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

$ cat Makefile.am
noinst_PROGRAMS =
AM_CPPFLAGS = -DXXX
include src/Makemodule.am

$ cat src/Makemodule.am
noinst_PROGRAMS += src/x
src_x_SOURCES = src/x.c
src_x_CPPFLAGS = -DYYY

$ cat src/x.c
main(){}

$ touch NEWS README AUTHORS ChangeLog COPYING
$ autoreconf -f -i
$ ./configure
$ make
gcc -DPACKAGE_NAME=\"pkg\" -DPACKAGE_TARNAME=\"pkg\" -DPACKAGE_VERSION=\"0\" -
DPACKAGE_STRING=\"pkg\ 0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -
DPACKAGE=\"pkg\" -DVERSION=\"0\" -I.  -DYYY   -g -O2 -MT src/src_x-x.o -MD -MP 
-MF src/.deps/src_x-x.Tpo -c -o src/src_x-x.o `test -f 'src/x.c' || echo 
'./'`src/x.c

there is no -DXXX there :(.  i know the var is set correctly because if i 
manually add $(AM_CPPFLAGS) to the src_x_CPPFLAGS line, it shows up.

reading the generated Makefile i see:
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
and this is good.  but that var isn't used to compile things.  instead, 
there's this rule:
	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_x_CPPFLAGS) 
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/src_x-x.o -MD -MP -MF 
src/$(DEPDIR)/src_x-x.Tpo -c -o src/src_x-x.o `test -f 'src/x.c' || echo 
'$(srcdir)/'`src/x.c

and indeed, there's no AM_CPPFLAGS in there.  all the other good stuff 
(including the deprecated vars) though ...
-mike
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 12 years and 15 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.