/[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.15 Revision 1.17
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.15 2003/04/06 23:35:41 method Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.17 2003/04/27 20:57:46 azarah 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#### replace-sparc64-flags ####
32# Sets mcpu to v8 and uses the original value
33# as mtune if none specified.
34#
31 35
32ALLOWED_FLAGS="-O -mcpu -march -mtune -fstack-protector -pipe -g"
33 36
37# C[XX]FLAGS that we allow in strip-flags
38ALLOWED_FLAGS="-O -O1 -O2 -mcpu -march -mtune -fstack-protector -pipe -g"
39
40# C[XX]FLAGS that we are think is ok, but needs testing
41# NOTE: currently -Os have issues with gcc3 and K6* arch's
42UNSTABLE_FLAGS="-Os -O3 -freorder-blocks -fprefetch-loop-arrays"
34 43
35filter-flags () { 44filter-flags () {
36 45
37 for x in $1 46 for x in $1
38 do 47 do
72strip-flags() { 81strip-flags() {
73 82
74 local NEW_CFLAGS="" 83 local NEW_CFLAGS=""
75 local NEW_CXXFLAGS="" 84 local NEW_CXXFLAGS=""
76 85
86 # Allow unstable C[XX]FLAGS if we are using unstable profile ...
87 if [ "${ACCEPT_KEYWORDS/~/}" != "${ACCEPT_KEYWORDS}" -a \
88 "${ACCEPT_KEYWORDS/-~/}" = "${ACCEPT_KEYWORDS}" ]
89 then
90 if use debug &> /dev/null
91 then
92 einfo "Enabling the use of some unstable flags"
93 fi
94
95 ALLOWED_FLAGS="${ALLOWED_FLAGS} ${UNSTABLE_FLAGS}"
96 fi
97
77 set -f 98 set -f
78 99
79 for x in ${CFLAGS} 100 for x in ${CFLAGS}
80 do 101 do
81 for y in ${ALLOWED_FLAGS} 102 for y in ${ALLOWED_FLAGS}
102 done 123 done
103 done 124 done
104 125
105 set +f 126 set +f
106 127
128 use debug &>/dev/null && einfo "CFLAGS=\"${NEW_CFLAGS}\""
129 use debug &>/dev/null && einfo "CXXFLAGS=\"${NEW_CXXFLAGS}\""
130
107 export CFLAGS="${NEW_CFLAGS}" 131 export CFLAGS="${NEW_CFLAGS}"
108 export CXXFLAGS="${NEW_CXXFLAGS}" 132 export CXXFLAGS="${NEW_CXXFLAGS}"
109} 133}
110 134
111get-flag() { 135get-flag() {
116 echo "${f/-${findflag}=}" 140 echo "${f/-${findflag}=}"
117 return 141 return
118 fi 142 fi
119 done 143 done
120} 144}
145
146replace-sparc64-flags () {
147
148 local SPARC64_CPUS="ultrasparc v9"
149
150 if [ "${CFLAGS/mtune}" != "${CFLAGS}" ]
151 then
152 for x in ${SPARC64_CPUS}
153 do
154 CFLAGS="${CFLAGS/-mcpu=${x}/-mcpu=v8}"
155 done
156 else
157 for x in ${SPARC64_CPUS}
158 do
159 CFLAGS="${CFLAGS/-mcpu=${x}/-mcpu=v8 -mtune=${x}}"
160 done
161 fi
162
163 if [ "${CXXFLAGS/mtune}" != "${CXXFLAGS}" ]
164 then
165 for x in ${SPARC64_CPUS}
166 do
167 CXXFLAGS="${CXXFLAGS/-mcpu=${x}/-mcpu=v8}"
168 done
169 else
170 for x in ${SPARC64_CPUS}
171 do
172 CXXFLAGS="${CXXFLAGS/-mcpu=${x}/-mcpu=v8 -mtune=${x}}"
173 done
174 fi
175
176}

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

  ViewVC Help
Powered by ViewVC 1.1.20