From owner-freebsd-current@FreeBSD.ORG Fri Aug 20 12:37:34 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4566116A4CE for ; Fri, 20 Aug 2004 12:37:34 +0000 (GMT) Received: from tigra.ip.net.ua (tigra.ip.net.ua [82.193.96.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4E97743D45 for ; Fri, 20 Aug 2004 12:37:33 +0000 (GMT) (envelope-from ru@ip.net.ua) Received: from heffalump.ip.net.ua (heffalump.ip.net.ua [82.193.96.213]) by tigra.ip.net.ua (8.12.11/8.12.11) with ESMTP id i7KCa3Ht052139 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 20 Aug 2004 15:36:04 +0300 (EEST) (envelope-from ru@ip.net.ua) Received: (from ru@localhost) by heffalump.ip.net.ua (8.13.1/8.13.1) id i7KCa5H2029894; Fri, 20 Aug 2004 15:36:05 +0300 (EEST) (envelope-from ru) Date: Fri, 20 Aug 2004 15:36:05 +0300 From: Ruslan Ermilov To: Oliver Eikemeier Message-ID: <20040820123605.GD29568@ip.net.ua> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="+KJYzRxRHjYqLGl5" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new cc: current@FreeBSD.org Subject: Re: setting CFLAGS in /etc/make.conf X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Aug 2004 12:37:34 -0000 --+KJYzRxRHjYqLGl5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Aug 20, 2004 at 02:08:33PM +0200, Oliver Eikemeier wrote: > I run into this recently with mail/exim. Of course it was possible to=20 > work around this too, but it happened only when certain configuration=20 > options where given *and* CFLAGS was set in /etc/make.conf. There must=20 > be a better way to deal with this. >=20 Facts: 1. In FreeBSD, CFLAGS (if not explicitly set, or set in /etc/make.conf) is the global make(1) variable. 2. FreeBSD make(1) knows about environment and global variables, and global variables take precedence over environment variables. 3. If CFLAGS is not explicitly set in /etc/make.conf, and CFLAGS is set in environment instead, its value becomes a value of the CFLAGS make(1) global variable: : $ cat makefile : FOO+=3D bar :=20 : all: : @echo global FOO: ${FOO} : @echo env FOO: $${FOO} : $ FOO=3Dfoo make : global FOO: foo bar : env FOO: foo So, if you need to change another makefile's idea of the initial value of CFLAGS, you basically have two reliable choices: a) Don't use /etc/make.conf to avoid the possibility of setting CFLAGS in /etc/make.conf. b) Modify this another makefile to add things you want to CFLAGS; the modification may be either hardcoded, or using another macro whose value you can then pass as environment variable. There's no other reliable way, and FreeBSD make(1) doesn't provide you a way to initialize a variable in the global context on the command line or from environment, except for -D which would set it to "1". You can only modify global variables from makefile or =66rom its included sources. P.S. I start to hate command-line variable in make(1). ;) Cheers, --=20 Ruslan Ermilov ru@FreeBSD.org FreeBSD committer --+KJYzRxRHjYqLGl5 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (FreeBSD) iD8DBQFBJfA1qRfpzJluFF4RAko2AJ9azOA4MhcwYrCmev7oFITxTN40mgCfU6IL fAl9YPeFmzVNL5UY+tsnRMo= =EJCX -----END PGP SIGNATURE----- --+KJYzRxRHjYqLGl5--