bug-automake
[Top][All Lists]
Advanced

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

bug#14396: AM_CPPFLAGS not respected when using subdir-objects


From: Mike Frysinger
Subject: bug#14396: AM_CPPFLAGS not respected when using subdir-objects
Date: Mon, 13 May 2013 23:07:42 -0400
User-agent: KMail/1.13.7 (Linux/3.8.3; KDE/4.6.5; x86_64; ; )

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

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

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