From unknown Mon Jun 23 22:03:58 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#14396 <14396@debbugs.gnu.org> To: bug#14396 <14396@debbugs.gnu.org> Subject: Status: AM_CPPFLAGS not respected when using subdir-objects Reply-To: bug#14396 <14396@debbugs.gnu.org> Date: Tue, 24 Jun 2025 05:03:58 +0000 retitle 14396 AM_CPPFLAGS not respected when using subdir-objects reassign 14396 automake submitter 14396 Mike Frysinger severity 14396 normal tag 14396 notabug thanks From debbugs-submit-bounces@debbugs.gnu.org Mon May 13 23:08:22 2013 Received: (at submit) by debbugs.gnu.org; 14 May 2013 03:08:22 +0000 Received: from localhost ([127.0.0.1]:39239 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Uc5bB-0007c3-5g for submit@debbugs.gnu.org; Mon, 13 May 2013 23:08:22 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56125) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Uc5b5-0007bl-BO for submit@debbugs.gnu.org; Mon, 13 May 2013 23:08:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uc5aZ-0007jd-IJ for submit@debbugs.gnu.org; Mon, 13 May 2013 23:07:44 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-107.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, USER_IN_WHITELIST autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:60841) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uc5aZ-0007jI-Fb for submit@debbugs.gnu.org; Mon, 13 May 2013 23:07:43 -0400 Received: from eggs.gnu.org ([208.118.235.92]:39248) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uc5aX-0002L0-Ti for bug-automake@gnu.org; Mon, 13 May 2013 23:07:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uc5aW-0007io-Fc for bug-automake@gnu.org; Mon, 13 May 2013 23:07:41 -0400 Received: from smtp.gentoo.org ([140.211.166.183]:58896) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uc5aW-0007ii-AB for bug-automake@gnu.org; Mon, 13 May 2013 23:07:40 -0400 Received: from vapier.localnet (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id C331C33DF00 for ; Tue, 14 May 2013 03:07:37 +0000 (UTC) From: Mike Frysinger Organization: wh0rd.org To: bug-automake@gnu.org Subject: 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; ; ) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2126622.qota2hsbKD"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <201305132307.43149.vapier@gentoo.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -4.7 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.1 (------) --nextPart2126622.qota2hsbKD Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable i've been playing around with subdir-objects and noticed that sub-compiles= =20 don't respect AM_CPPFLAGS :(. happens with automake 1.13.1 and the latest= =20 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 =3D AM_CPPFLAGS =3D -DXXX include src/Makemodule.am $ cat src/Makemodule.am noinst_PROGRAMS +=3D src/x src_x_SOURCES =3D src/x.c src_x_CPPFLAGS =3D -DYYY $ cat src/x.c main(){} $ touch NEWS README AUTHORS ChangeLog COPYING $ autoreconf -f -i $ ./configure $ make gcc -DPACKAGE_NAME=3D\"pkg\" -DPACKAGE_TARNAME=3D\"pkg\" -DPACKAGE_VERSION= =3D\"0\" - DPACKAGE_STRING=3D\"pkg\ 0\" -DPACKAGE_BUGREPORT=3D\"\" -DPACKAGE_URL=3D\"\= " - DPACKAGE=3D\"pkg\" -DVERSION=3D\"0\" -I. -DYYY -g -O2 -MT src/src_x-x.o = =2DMD -MP=20 =2DMF src/.deps/src_x-x.Tpo -c -o src/src_x-x.o `test -f 'src/x.c' || echo= =20 './'`src/x.c there is no -DXXX there :(. i know the var is set correctly because if i=20 manually add $(AM_CPPFLAGS) to the src_x_CPPFLAGS line, it shows up. reading the generated Makefile i see: COMPILE =3D $(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,=20 there's this rule: $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(src_x_CPPFLAGS)= =20 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/src_x-x.o -MD -MP -MF=20 src/$(DEPDIR)/src_x-x.Tpo -c -o src/src_x-x.o `test -f 'src/x.c' || echo=20 '$(srcdir)/'`src/x.c and indeed, there's no AM_CPPFLAGS in there. all the other good stuff=20 (including the deprecated vars) though ... =2Dmike --nextPart2126622.qota2hsbKD Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (GNU/Linux) iQIcBAABAgAGBQJRkap/AAoJEEFjO5/oN/WB+PQQAKcVmEQxToNWsiPEWmsMqJGQ EVFHOQIrQhEcnG82uwAJE5IBOR76Z9sm4VVLVegDCCKxCMvU9FGC9HLp4S1flqnz zrTsBbiRL8rndLZNLZyPsprCcZXg6Emzh305NgPFwHT4cPOP3Y5qIiVHJUvo3b0/ zllMZaTvpe+lMzYDkhT4XPBRxC8H270tagon6iqOh8om5Sy4j96W5yipCbm0YrJM /UdPaWoYglv1Az6S6JvnbiajicljyXCvaSuiDQHw/Xpq/5uFoOmRoS40gdDdyWtP UM7UToMlB5mbDCuijlCVWxxPHbfMXsQgxaIRMlNQSyzfUlaIbA8TM9Tb1JSL9x6H mE4uGaPqSCDA1K52MwT72qX3Np8ZTZFRrFDiHKitjAMiwttX0nLJUChWG7AaTmvy lnLAuh3p+LCIxDI7Gy7pRdgXjW3TPZ05zlOq80vqK+O1lQ63nPzb73/SoPqw4spP okoPGp1+Px1J5+tJ3R6GpNnRzBGi+fUDK30ZXe2E845B34HNJoEB0mKXbDJK7c7g lr7fdihHMcjONolsxfRu2hetM3fEsryLh1JvK1JEkOoNDjGoMe/MpQMog5pvrdnJ F9OZ8W0NNMDIyEEPE1fe7jR6Gy0SKCyXVLL91yvW87e/i5NVA0hrNulyZekyMwm+ RC2M9aX3ajoSRF7Yi8PQ =uq3b -----END PGP SIGNATURE----- --nextPart2126622.qota2hsbKD-- From debbugs-submit-bounces@debbugs.gnu.org Tue May 14 03:31:57 2013 Received: (at 14396) by debbugs.gnu.org; 14 May 2013 07:31:58 +0000 Received: from localhost ([127.0.0.1]:39352 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Uc9iG-00029l-Vr for submit@debbugs.gnu.org; Tue, 14 May 2013 03:31:57 -0400 Received: from mail-ee0-f46.google.com ([74.125.83.46]:57725) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Uc9iC-00029W-Fw; Tue, 14 May 2013 03:31:54 -0400 Received: by mail-ee0-f46.google.com with SMTP id e49so115342eek.19 for ; Tue, 14 May 2013 00:31:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=npxHXkwz2pHUSXW38PUtXMPiXCVoD85eMEDQv9Y5mdE=; b=DSSrG0hQ5hUJ6WND7dJ4r7SvCM1SkhsPtxik8HjiYdH+slMBlqucQARTlkKC4pxVky IfrNT5wk8pRL90TfUkBU3NP8VLNeU6WhUSB+bRzXZ9V9BOMpvOLId1sDzynJmyOGAvdU nG8kiOVnf8antW/vDDFDDqu1a13dCFvfa9jJNOwG9Dllp8xKG5mFPsITL8sWPKYL0vnE QFPenbfNh4yzUrcrbzvbVU+zRwylvlcrGXjMoyVLdEUaZCT2OXdxcRrDZpmFLChBMfJ9 U7SjF3SpdvbXym6iwmElHidBHvzJaYWj3R29/WAzpTzPI9D5ea9FyZfGFKe43WdeHcYz MyfQ== X-Received: by 10.15.52.70 with SMTP id o46mr88392947eew.14.1368516680358; Tue, 14 May 2013 00:31:20 -0700 (PDT) Received: from [192.168.178.20] (host93-95-dynamic.6-79-r.retail.telecomitalia.it. [79.6.95.93]) by mx.google.com with ESMTPSA id s8sm27569462eeo.4.2013.05.14.00.31.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 May 2013 00:31:19 -0700 (PDT) Message-ID: <5191E83F.4050602@gmail.com> Date: Tue, 14 May 2013 09:31:11 +0200 From: Stefano Lattarini MIME-Version: 1.0 To: Mike Frysinger Subject: Re: bug#14396: AM_CPPFLAGS not respected when using subdir-objects References: <201305132307.43149.vapier@gentoo.org> In-Reply-To: <201305132307.43149.vapier@gentoo.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 14396 Cc: 14396@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) tags 14396 notabug close 14396 thanks On 05/14/2013 05:07 AM, Mike Frysinger wrote: > i've been playing around with subdir-objects and noticed that sub-compiles > don't respect AM_CPPFLAGS :( > The failure you're seeing is due to a user error. See below. I'm thus closing this report as "not a bug". We are however free to continue our discussion here anyway (it should still be registered in the tracker). > 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 > OK, but ... > include src/Makemodule.am > > $ cat src/Makemodule.am > noinst_PROGRAMS += src/x > src_x_SOURCES = src/x.c > src_x_CPPFLAGS = -DYYY > > ... here you define per-program CPPFLAGS for src/x, and that *completely overrides* global AM_CPPFLAGS. That is by design. If you want the flags in AM_CPPFLAGS to be used also when compiling the objects of src/x, you need to add those flags *explicitly* to src_x_CPPFLAGS: src_x_CPPFLAGS = $(AM_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. > And that is what you're supposed to do :-) If something in the documentation doesn't make that clear, feel free to provide a patch to improve the situation. > 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. > Again, that is by design. > all the other good stuff (including the deprecated vars) though ... > -mike HTH, Stefano From unknown Mon Jun 23 22:03:58 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 11 Jun 2013 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator