/[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.11 Revision 1.15
1# Copyright 1999-2002 Gentoo Technologies, Inc. 1# Copyright 1999-2003 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# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.15 2003/04/06 23:35:41 method Exp $
4#
3# Author Bart Verwilst <verwilst@gentoo.org> 5# Author Bart Verwilst <verwilst@gentoo.org>
4# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.11 2002/12/22 12:11:56 cretin Exp $
5 6
6ECLASS=flag-o-matic 7ECLASS=flag-o-matic
7INHERITED="$INHERITED $ECLASS" 8INHERITED="$INHERITED $ECLASS"
8 9
9# 10#
25# good options. 26# good options.
26# 27#
27#### get-flag <flag> #### 28#### get-flag <flag> ####
28# Find and echo the value for a particular flag 29# Find and echo the value for a particular flag
29# 30#
31
32ALLOWED_FLAGS="-O -mcpu -march -mtune -fstack-protector -pipe -g"
33
30 34
31filter-flags () { 35filter-flags () {
32 36
33 for x in $1 37 for x in $1
34 do 38 do
68strip-flags() { 72strip-flags() {
69 73
70 local NEW_CFLAGS="" 74 local NEW_CFLAGS=""
71 local NEW_CXXFLAGS="" 75 local NEW_CXXFLAGS=""
72 76
73 local ALLOWED_FLAGS="-O -mcpu -march -pipe -g"
74
75 set -f 77 set -f
76 78
77 for x in ${CFLAGS} 79 for x in ${CFLAGS}
78 do 80 do
79 for y in ${ALLOWED_FLAGS} 81 for y in ${ALLOWED_FLAGS}
80 do 82 do
83 flag=${x%%=*}
81 if [ "${x/${y}}" != "${x}" ] 84 if [ "${flag%%${y}}" = "" ]
82 then 85 then
83 if [ -z "${NEW_CFLAGS}" ]
84 then
85 NEW_CFLAGS="${x}"
86 else
87 NEW_CFLAGS="${NEW_CFLAGS} ${x}" 86 NEW_CFLAGS="${NEW_CFLAGS} ${x}"
88 fi 87 break
89 fi 88 fi
90 done 89 done
91 done 90 done
92 91
93 for x in ${CXXFLAGS} 92 for x in ${CXXFLAGS}
94 do 93 do
95 for y in ${ALLOWED_FLAGS} 94 for y in ${ALLOWED_FLAGS}
96 do 95 do
96 flag=${x%%=*}
97 if [ "${x/${y}}" != "${x}" ] 97 if [ "${flag%%${y}}" = "" ]
98 then 98 then
99 if [ -z "${NEW_CXXFLAGS}" ]
100 then
101 NEW_CXXFLAGS="${x}"
102 else
103 NEW_CXXFLAGS="${NEW_CXXFLAGS} ${x}" 99 NEW_CXXFLAGS="${NEW_CXXFLAGS} ${x}"
104 fi 100 break
105 fi 101 fi
106 done 102 done
107 done 103 done
108 104
109 set +f 105 set +f

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

  ViewVC Help
Powered by ViewVC 1.1.20