/[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.106 Revision 1.111
1# Copyright 1999-2005 Gentoo Foundation 1# Copyright 1999-2006 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.106 2006/02/19 23:18:30 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.111 2006/10/14 20:27:21 swegener Exp $
4 4#
5# Maintainer: base-system@gentoo.org
5 6
6# need access to emktemp() 7# need access to emktemp()
7inherit eutils toolchain-funcs multilib 8inherit eutils toolchain-funcs multilib
8 9
9# 10#
97 export ALLOWED_FLAGS="${ALLOWED_FLAGS} -O -O0 -O1 -O2 -mcpu -march -mtune" 98 export ALLOWED_FLAGS="${ALLOWED_FLAGS} -O -O0 -O1 -O2 -mcpu -march -mtune"
98 export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fstack-protector -fstack-protector-all" 99 export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fstack-protector -fstack-protector-all"
99 export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fbounds-checking -fno-bounds-checking" 100 export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fbounds-checking -fno-bounds-checking"
100 export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-PIE -fno-pie -fno-unit-at-a-time" 101 export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-PIE -fno-pie -fno-unit-at-a-time"
101 export ALLOWED_FLAGS="${ALLOWED_FLAGS} -g -g0 -g1 -g2 -g3 -ggdb -ggdb0 -ggdb1 -ggdb2 -ggdb3" 102 export ALLOWED_FLAGS="${ALLOWED_FLAGS} -g -g0 -g1 -g2 -g3 -ggdb -ggdb0 -ggdb1 -ggdb2 -ggdb3"
103 export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-ident"
102 fi 104 fi
103 # allow a bunch of flags that negate features / control ABI 105 # allow a bunch of flags that negate features / control ABI
104 ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-stack-protector -fno-stack-protector-all" 106 ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-stack-protector -fno-stack-protector-all"
105 ALLOWED_FLAGS="${ALLOWED_FLAGS} -mregparm -mno-app-regs -mapp-regs \ 107 ALLOWED_FLAGS="${ALLOWED_FLAGS} -mregparm -mno-app-regs -mapp-regs \
106 -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow \ 108 -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow \
107 -mips1 -mips2 -mips3 -mips4 -mips32 -mips64 -mips16 \ 109 -mips1 -mips2 -mips3 -mips4 -mips32 -mips64 -mips16 \
108 -msoft-float -mno-soft-float -mhard-float -mno-hard-float -mfpu \ 110 -msoft-float -mno-soft-float -mhard-float -mno-hard-float -mfpu \
109 -mieee -mieee-with-inexact \ 111 -mieee -mieee-with-inexact -mschedule \
110 -mtls-direct-seg-refs -mno-tls-direct-seg-refs \ 112 -mtls-direct-seg-refs -mno-tls-direct-seg-refs \
111 -mflat -mno-flat -mno-faster-structs -mfaster-structs \ 113 -mflat -mno-flat -mno-faster-structs -mfaster-structs \
112 -m32 -m64 -mabi -mlittle-endian -mbig-endian -EL -EB -fPIC \ 114 -m32 -m64 -mabi -mlittle-endian -mbig-endian -EL -EB -fPIC \
113 -mlive-g0 -mcmodel -mstack-bias -mno-stack-bias" 115 -mlive-g0 -mcmodel -mstack-bias -mno-stack-bias"
114 116
263 265
264filter-mfpmath() { 266filter-mfpmath() {
265 local orig_mfpmath new_math prune_math 267 local orig_mfpmath new_math prune_math
266 268
267 # save the original -mfpmath flag 269 # save the original -mfpmath flag
268 orig_mfpmath="`get-flag -mfpmath`" 270 orig_mfpmath=$(get-flag -mfpmath)
269 # get the value of the current -mfpmath flag 271 # get the value of the current -mfpmath flag
270 new_math=" `get-flag mfpmath | tr , ' '` " 272 new_math=$(get-flag mfpmath)
273 new_math=" ${new_math//,/ } "
271 # figure out which math values are to be removed 274 # figure out which math values are to be removed
272 prune_math="" 275 prune_math=""
273 for prune_math in "$@" ; do 276 for prune_math in "$@" ; do
274 new_math="${new_math/ ${prune_math} / }" 277 new_math=${new_math/ ${prune_math} / }
275 done 278 done
276 new_math="`echo ${new_math:1:${#new_math}-2} | tr ' ' ,`" 279 new_math=$(echo ${new_math})
280 new_math=${new_math// /,}
277 281
278 if [ -z "${new_math}" ] ; then 282 if [[ -z ${new_math} ]] ; then
279 # if we're removing all user specified math values are 283 # if we're removing all user specified math values are
280 # slated for removal, then we just filter the flag 284 # slated for removal, then we just filter the flag
281 filter-flags ${orig_mfpmath} 285 filter-flags ${orig_mfpmath}
282 else 286 else
283 # if we only want to filter some of the user specified 287 # if we only want to filter some of the user specified
522 if [ "${CFLAGS/mtune}" != "${CFLAGS}" ]; then 526 if [ "${CFLAGS/mtune}" != "${CFLAGS}" ]; then
523 for x in ${SPARC64_CPUS}; do 527 for x in ${SPARC64_CPUS}; do
524 CFLAGS="${CFLAGS/-mcpu=${x}/-mcpu=v8}" 528 CFLAGS="${CFLAGS/-mcpu=${x}/-mcpu=v8}"
525 done 529 done
526 else 530 else
527 for x in ${SPARC64_CPUS}; do 531 for x in ${SPARC64_CPUS}; do
528 CFLAGS="${CFLAGS/-mcpu=${x}/-mcpu=v8 -mtune=${x}}" 532 CFLAGS="${CFLAGS/-mcpu=${x}/-mcpu=v8 -mtune=${x}}"
529 done 533 done
530 fi 534 fi
531 535
532 if [ "${CXXFLAGS/mtune}" != "${CXXFLAGS}" ]; then 536 if [ "${CXXFLAGS/mtune}" != "${CXXFLAGS}" ]; then
533 for x in ${SPARC64_CPUS}; do 537 for x in ${SPARC64_CPUS}; do
534 CXXFLAGS="${CXXFLAGS/-mcpu=${x}/-mcpu=v8}" 538 CXXFLAGS="${CXXFLAGS/-mcpu=${x}/-mcpu=v8}"
535 done 539 done
536 else 540 else
537 for x in ${SPARC64_CPUS}; do 541 for x in ${SPARC64_CPUS}; do
538 CXXFLAGS="${CXXFLAGS/-mcpu=${x}/-mcpu=v8 -mtune=${x}}" 542 CXXFLAGS="${CXXFLAGS/-mcpu=${x}/-mcpu=v8 -mtune=${x}}"
539 done 543 done
540 fi 544 fi
541 545
542 export CFLAGS CXXFLAGS 546 export CFLAGS CXXFLAGS

Legend:
Removed from v.1.106  
changed lines
  Added in v.1.111

  ViewVC Help
Powered by ViewVC 1.1.20