Date: Fri, 20 Aug 2004 15:36:05 +0300 From: Ruslan Ermilov <ru@FreeBSD.org> To: Oliver Eikemeier <eikemeier@fillmore-labs.com> Cc: current@FreeBSD.org Subject: Re: setting CFLAGS in /etc/make.conf Message-ID: <20040820123605.GD29568@ip.net.ua> In-Reply-To: <A8718F96-F2A1-11D8-A951-00039312D914@fillmore-labs.com> References: <p06110400bd4b837282da@[128.113.24.47]> <A8718F96-F2A1-11D8-A951-00039312D914@fillmore-labs.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--+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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040820123605.GD29568>