Date: Sun, 19 Dec 2010 14:10:48 +0200 From: Peter Pentchev <roam@ringlet.net> To: Alexander Best <arundel@freebsd.org> Cc: freebsd-hackers@freebsd.org Subject: Re: question about CFLAGS, CXXFLAGS and DEBUG_FLAGS Message-ID: <20101219121048.GA3835@straylight.ringlet.net> In-Reply-To: <20101218212431.GA35554@freebsd.org> References: <20101218200937.GA2932@freebsd.org> <20101218204047.GA4214@straylight.ringlet.net> <20101218212431.GA35554@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--azLHFNyN32YCQGCU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Dec 18, 2010 at 09:24:31PM +0000, Alexander Best wrote: > On Sat Dec 18 10, Peter Pentchev wrote: > > On Sat, Dec 18, 2010 at 08:09:37PM +0000, Alexander Best wrote: > > > hi there, > > >=20 > > > i just stumbled over these lines: > > >=20 > > > otaku% grep -n \${DEBUG_FLAGS} /usr/share/mk/bsd.prog.mk > > > 24:CFLAGS+=3D${DEBUG_FLAGS} > > > 25:CXXFLAGS+=3D${DEBUG_FLAGS} > > >=20 > > > is it really necessary to assign the debug flags to both CFLAGS *and*= CXXFLAGS? > >=20 > > Uhm... yes, so they can be used in both C and C++ programs :) > > ...or are you making the mistake I've made too many times (and still > > make sometimes) of confusing CXXFLAGS with CPPFLAGS? :) >=20 > *hehehe* i don't think so. Nah, just making sure, no offense intended :) > i just saw a lot of these lines in buildworld: >=20 > clang++ -O2 -pipe -DNDEBUG -g -I/usr/obj/usr/subversion-src/tmp/legacy/us= r/include -I/usr/subversion-src/gnu/usr.bin/gperf/../../../contrib/gperf/li= b -I/usr/subversion-src/gnu/usr.bin/gperf -g -c /usr/subversion-src/gnu/usr= =2Ebin/gperf/../../../contrib/gperf/lib/hash.cc > clang++: warning: argument unused during compilation: '-g' > clang++: warning: argument unused during compilation: '-g' >=20 > as you can see -g gets specified twice, so i thought maybe adding -g to > CFLAGS makes adding it to CXXFLAGS obsolete. Well, according to my copy of src/share/mk/sys.mk (8.x-STABLE), if the user does not override CXXFLAGS, they are copied from CFLAGS with some exceptions. Thus, it does seem sensible to add -g to both sets of flags - yes, if no CXXFLAGS are specified, the -g will be doubled, but if CXXFLAGS *are* specified in the environment or on the make(1) command line, then only one -g will be added. Maybe a better solution could be to somehow test for empty CXXFLAGS in sys.mk and set another variable that says "we've copied those over", and then only add DEBUG_FLAGS to CXXFLAGS if that variable is not set, but I'm not sure if it's really worth it. Thanks for bringing this up - I wasn't aware of the fact that CXXFLAGS were copied over unless overridden :) Learn something new every day, I guess. G'luck, Peter --=20 Peter Pentchev roam@space.bg roam@ringlet.net roam@FreeBSD.org PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 No language can express every thought unambiguously, least of all this one. --azLHFNyN32YCQGCU Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQIcBAEBCAAGBQJNDfZCAAoJEGUe77AlJ98TCjcQALbJQ9z/8SO8vbjXUNyr7iwl nkZddxwG93iFq0OIpoLp15NS4QFiBRoUo+LUPblVn9SPLDf0LNpgUE+wFyIlyY5S t0N99lqethjqsLsPedim0nSFPDYJnkM1mSod1IKVL5fmq5+Hpwlp6mg4bQZ7kaE1 z5dzzuCqcK8HdUAytU8VQwsmyG3oUklg80YzLAozXWZSjN+yVCxN3ZqrDknxSKWZ 2+cVm5rJmWCdU6f9mQg+h10/EaoPRpUxk7xEtq0CzTbSzceXtKmd8HONPmojpEBt WGZM0UjWMaX1B1MJtXmWrNQX+KAhFpqJMpZFuqwvOe0K9tHnTPS+r/RirirF7/VV aNBd8uqHn9tU4R/TAwbm+0a7S4cTyNuHqJ06kw6o3uh1BAjunoA4CX14dJkkt94v zxz6ci2epSDHwaXhllMO3tSI3x5L/jjI5dQHXQDaOSs1mr5PhLcmlf0N0nEWfjFR Zm5NiQDKP71GKMIcNB62vlew74KQkRa0wXXXSKJ6dRcwaZBVtF6jQPVBlM96xiBk RK4algM1Q/lsoT7Tx+1DFH401bJrt2mwDOY9G91N8G6UJLwhStIv3yWKCKm8iCJB lhL0bW/DJInvS/8FDe0HXuJRI8fLzH68CUB4nlu3lJK0+635xlwEZsY7JR2GA6Ai szUkfqBWS2faof1k3n/3 =crhz -----END PGP SIGNATURE----- --azLHFNyN32YCQGCU--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101219121048.GA3835>