| 1 | # Copyright 1999-2008 Gentoo Foundation |
1 | # Copyright 1999-2008 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.124 2008/07/03 05:30:54 dberkholz Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.125 2008/09/14 19:43:41 dirtyepic Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: flag-o-matic.eclass |
5 | # @ECLASS: flag-o-matic.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # toolchain@gentoo.org |
7 | # toolchain@gentoo.org |
| 8 | # @BLURB: common functions to manipulate and query toolchain flags |
8 | # @BLURB: common functions to manipulate and query toolchain flags |
| … | |
… | |
| 173 | [[ $# != 2 ]] \ |
173 | [[ $# != 2 ]] \ |
| 174 | && echo && eerror "Usage: replace-flags <old flag> <new flag>" \ |
174 | && echo && eerror "Usage: replace-flags <old flag> <new flag>" \ |
| 175 | && die "replace-flags takes 2 arguments, not $#" |
175 | && die "replace-flags takes 2 arguments, not $#" |
| 176 | |
176 | |
| 177 | local f fset |
177 | local f fset |
| 178 | declare -a new_CFLAGS new_CXXFLAGS |
178 | declare -a new_CFLAGS new_CXXFLAGS new_FFLAGS new_FCFLAGS |
| 179 | |
179 | |
| 180 | for fset in CFLAGS CXXFLAGS FFLAGS FCFLAGS; do |
180 | for fset in CFLAGS CXXFLAGS FFLAGS FCFLAGS; do |
| 181 | # Looping over the flags instead of using a global |
181 | # Looping over the flags instead of using a global |
| 182 | # substitution ensures that we're working with flag atoms. |
182 | # substitution ensures that we're working with flag atoms. |
| 183 | # Otherwise globs like -O* have the potential to wipe out the |
183 | # Otherwise globs like -O* have the potential to wipe out the |