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

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

  ViewVC Help
Powered by ViewVC 1.1.20