/[gentoo-x86]/eclass/flag-o-matic.eclass
Gentoo

Diff of /eclass/flag-o-matic.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.9 Revision 1.11
1# Copyright 1999-2002 Gentoo Technologies, Inc. 1# Copyright 1999-2002 Gentoo Technologies, Inc.
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# Author Bart Verwilst <verwilst@gentoo.org> 3# Author Bart Verwilst <verwilst@gentoo.org>
4# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.9 2002/10/20 06:43:10 seemant Exp $ 4# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.11 2002/12/22 12:11:56 cretin Exp $
5 5
6ECLASS=flag-o-matic 6ECLASS=flag-o-matic
7INHERITED="$INHERITED $ECLASS" 7INHERITED="$INHERITED $ECLASS"
8 8
9# 9#
21# Matches only complete flag 21# Matches only complete flag
22# 22#
23#### strip-flags #### 23#### strip-flags ####
24# Strip C[XX]FLAGS of everything except known 24# Strip C[XX]FLAGS of everything except known
25# good options. 25# good options.
26#
27#### get-flag <flag> ####
28# Find and echo the value for a particular flag
26# 29#
27 30
28filter-flags () { 31filter-flags () {
29 32
30 for x in $1 33 for x in $1
65strip-flags() { 68strip-flags() {
66 69
67 local NEW_CFLAGS="" 70 local NEW_CFLAGS=""
68 local NEW_CXXFLAGS="" 71 local NEW_CXXFLAGS=""
69 72
70 local ALLOWED_FLAGS="-O -mcpu -march -pipe" 73 local ALLOWED_FLAGS="-O -mcpu -march -pipe -g"
71 74
72 set -f 75 set -f
73 76
74 for x in ${CFLAGS} 77 for x in ${CFLAGS}
75 do 78 do
107 110
108 export CFLAGS="${NEW_CFLAGS}" 111 export CFLAGS="${NEW_CFLAGS}"
109 export CXXFLAGS="${NEW_CXXFLAGS}" 112 export CXXFLAGS="${NEW_CXXFLAGS}"
110} 113}
111 114
115get-flag() {
116 local findflag="$1"
117
118 for f in ${CFLAGS} ${CXXFLAGS} ; do
119 if [ "${f/${findflag}}" != "${f}" ] ; then
120 echo "${f/-${findflag}=}"
121 return
122 fi
123 done
124}

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.11

  ViewVC Help
Powered by ViewVC 1.1.20