From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18261 invoked from network); 20 Nov 2004 06:14:55 +0000 Received: from smtp.gentoo.org (156.56.111.197) by lists.gentoo.org with AES256-SHA encrypted SMTP; 20 Nov 2004 06:14:55 +0000 Received: from lists.gentoo.org ([156.56.111.196] helo=parrot.gentoo.org) by smtp.gentoo.org with esmtp (Exim 4.41) id 1CVOWN-0007Fu-9m for arch-gentoo-dev@lists.gentoo.org; Sat, 20 Nov 2004 06:14:55 +0000 Received: (qmail 4384 invoked by uid 89); 20 Nov 2004 06:14:54 +0000 Mailing-List: contact gentoo-dev-help@gentoo.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@gentoo.org Received: (qmail 6245 invoked from network); 20 Nov 2004 06:14:54 +0000 Message-ID: <419EE0D6.2090900@gentoo.org> Date: Sat, 20 Nov 2004 15:14:46 +0900 From: Chris White User-Agent: Mozilla Thunderbird 0.9 (X11/20041112) X-Accept-Language: en-us, en MIME-Version: 1.0 To: gentoo-dev@lists.gentoo.org X-Enigmail-Version: 0.86.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig148F6FED241BAC25BB874619" X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - sls-ce5p311.hostitnow.com X-AntiAbuse: Original Domain - lists.gentoo.org X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12] X-AntiAbuse: Sender Address Domain - gentoo.org X-Source: X-Source-Args: X-Source-Dir: Subject: [gentoo-dev] CUSTOM cflags replacement snippet X-Archives-Salt: 49ce43f3-1df4-4f3c-abb9-fcf442c1b7f5 X-Archives-Hash: 3f25bb8b329c4c0e1a382d3fb78baa5a --------------enig148F6FED241BAC25BB874619 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit All, I created this quick little function to recursively patch Makefiles with custom CFLAGS. custom_cflags() { for directories in * do if [ -d $directories -a -e $directories/Makefile ] then cd $directories for subdirectories in * do if [ -d $subdirectories -a -e $subdirectories/Makefile ] then custom_cflags fi done sed -i \ -e "s:^CFLAGS.*:CFLAGS = ${CFLAGS}:" Makefile \ -e "s:^CXXFLAGS.*:CXXFLAGS = ${CXXFLAGS}:" Makefile \ || die "Could not patch $directories/Makefile for custom CFLAGS" cd .. fi done } Known issues: if CFLAGS have something such as -Iblah or -D__BREAKS__WITHOUT__THIS__, you're screwed. if CFLAGS are added onto at some point (CFLAGS = $CFLAGS -mnewflag), you're screwed. It's not perfect, but it works for me in most cases. Go ahead and flame, just thought I'd toss it here to make people's lives 2% easier :). -- Chris White ------------------------ Sound | Video | Security Mozilla | Haskell | Lang-misc ChrisWhite @ irc.freenode.net --------------enig148F6FED241BAC25BB874619 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFBnuDgFdQwWVoAgN4RAgKvAKC0Yh2WE8yrzz3bw+33xnM7X+Vc9ACg4TT3 Xp6xTTYnWSzR9+3cOS0jQtc= =TjZd -----END PGP SIGNATURE----- --------------enig148F6FED241BAC25BB874619--