/[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.157 Revision 1.159
1# Copyright 1999-2011 Gentoo Foundation 1# Copyright 1999-2011 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.157 2011/11/11 07:06:25 dirtyepic Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.159 2011/12/07 06:42:40 vapier Exp $
4 4
5# @ECLASS: flag-o-matic.eclass 5# @ECLASS: flag-o-matic.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# toolchain@gentoo.org 7# toolchain@gentoo.org
8# @BLURB: common functions to manipulate and query toolchain flags 8# @BLURB: common functions to manipulate and query toolchain flags
49 -mips1 -mips2 -mips3 -mips4 -mips32 -mips64 -mips16 -mplt \ 49 -mips1 -mips2 -mips3 -mips4 -mips32 -mips64 -mips16 -mplt \
50 -msoft-float -mno-soft-float -mhard-float -mno-hard-float -mfpu \ 50 -msoft-float -mno-soft-float -mhard-float -mno-hard-float -mfpu \
51 -mieee -mieee-with-inexact -mschedule -mfloat-gprs -mspe -mno-spe \ 51 -mieee -mieee-with-inexact -mschedule -mfloat-gprs -mspe -mno-spe \
52 -mtls-direct-seg-refs -mno-tls-direct-seg-refs \ 52 -mtls-direct-seg-refs -mno-tls-direct-seg-refs \
53 -mflat -mno-flat -mno-faster-structs -mfaster-structs \ 53 -mflat -mno-flat -mno-faster-structs -mfaster-structs \
54 -m32 -m64 -mabi -mlittle-endian -mbig-endian -EL -EB -fPIC \ 54 -m32 -m64 -mx32 -mabi -mlittle-endian -mbig-endian -EL -EB -fPIC \
55 -mlive-g0 -mcmodel -mstack-bias -mno-stack-bias \ 55 -mlive-g0 -mcmodel -mstack-bias -mno-stack-bias \
56 -msecure-plt -m*-toc -D* -U*" 56 -msecure-plt -m*-toc -D* -U*"
57 57
58 # 4.5 58 # 4.5
59 ALLOWED_FLAGS="${ALLOWED_FLAGS} -mno-fma4 -mno-movbe -mno-xop -mno-lwp" 59 ALLOWED_FLAGS="${ALLOWED_FLAGS} -mno-fma4 -mno-movbe -mno-xop -mno-lwp"
141# @FUNCTION: append-cppflags 141# @FUNCTION: append-cppflags
142# @USAGE: <flags> 142# @USAGE: <flags>
143# @DESCRIPTION: 143# @DESCRIPTION:
144# Add extra <flags> to the current CPPFLAGS. 144# Add extra <flags> to the current CPPFLAGS.
145append-cppflags() { 145append-cppflags() {
146 [[ -z $* ]] && return 0 146 [[ $# -eq 0 ]] && return 0
147 export CPPFLAGS="${CPPFLAGS} $*" 147 export CPPFLAGS="${CPPFLAGS} $*"
148 return 0 148 return 0
149} 149}
150 150
151# @FUNCTION: append-cflags 151# @FUNCTION: append-cflags
152# @USAGE: <flags> 152# @USAGE: <flags>
153# @DESCRIPTION: 153# @DESCRIPTION:
154# Add extra <flags> to the current CFLAGS. 154# Add extra <flags> to the current CFLAGS.
155append-cflags() { 155append-cflags() {
156 [[ -z $* ]] && return 0 156 [[ $# -eq 0 ]] && return 0
157 export CFLAGS=$(test-flags-CC ${CFLAGS} $*) 157 export CFLAGS=$(test-flags-CC ${CFLAGS} "$@")
158 return 0 158 return 0
159} 159}
160 160
161# @FUNCTION: append-cxxflags 161# @FUNCTION: append-cxxflags
162# @USAGE: <flags> 162# @USAGE: <flags>
163# @DESCRIPTION: 163# @DESCRIPTION:
164# Add extra <flags> to the current CXXFLAGS. 164# Add extra <flags> to the current CXXFLAGS.
165append-cxxflags() { 165append-cxxflags() {
166 [[ -z $* ]] && return 0 166 [[ $# -eq 0 ]] && return 0
167 export CXXFLAGS=$(test-flags-CXX ${CXXFLAGS} $*) 167 export CXXFLAGS=$(test-flags-CXX ${CXXFLAGS} "$@")
168 return 0 168 return 0
169} 169}
170 170
171# @FUNCTION: append-fflags 171# @FUNCTION: append-fflags
172# @USAGE: <flags> 172# @USAGE: <flags>
173# @DESCRIPTION: 173# @DESCRIPTION:
174# Add extra <flags> to the current {F,FC}FLAGS. 174# Add extra <flags> to the current {F,FC}FLAGS.
175append-fflags() { 175append-fflags() {
176 [[ -z $* ]] && return 0 176 [[ $# -eq 0 ]] && return 0
177 export FFLAGS=$(test-flags-F77 ${FFLAGS} $*) 177 export FFLAGS=$(test-flags-F77 ${FFLAGS} "$@")
178 export FCFLAGS=$(test-flags-FC ${FCFLAGS} $*) 178 export FCFLAGS=$(test-flags-FC ${FCFLAGS} "$@")
179 return 0 179 return 0
180} 180}
181 181
182# @FUNCTION: append-lfs-flags 182# @FUNCTION: append-lfs-flags
183# @DESCRIPTION: 183# @DESCRIPTION:
191# @FUNCTION: append-flags 191# @FUNCTION: append-flags
192# @USAGE: <flags> 192# @USAGE: <flags>
193# @DESCRIPTION: 193# @DESCRIPTION:
194# Add extra <flags> to your current {C,CXX,F,FC}FLAGS. 194# Add extra <flags> to your current {C,CXX,F,FC}FLAGS.
195append-flags() { 195append-flags() {
196 [[ -z $* ]] && return 0 196 [[ $# -eq 0 ]] && return 0
197 append-cflags "$@" 197 append-cflags "$@"
198 append-cxxflags "$@" 198 append-cxxflags "$@"
199 append-fflags "$@" 199 append-fflags "$@"
200 return 0 200 return 0
201} 201}
448 448
449 shift 449 shift
450 450
451 [[ -z ${comp} ]] && return 1 451 [[ -z ${comp} ]] && return 1
452 452
453 x=""
454 for x in "$@" ; do 453 for x in "$@" ; do
455 test-flag-${comp} "${x}" && flags="${flags}${flags:+ }${x}" 454 test-flag-${comp} "${x}" && flags="${flags}${flags:+ }${x}"
456 done 455 done
457 456
458 echo "${flags}" 457 echo "${flags}"
620# @FUNCTION: append-libs 619# @FUNCTION: append-libs
621# @USAGE: <libs> 620# @USAGE: <libs>
622# @DESCRIPTION: 621# @DESCRIPTION:
623# Add extra <libs> to the current LIBS. 622# Add extra <libs> to the current LIBS.
624append-libs() { 623append-libs() {
625 [[ -z $* ]] && return 0 624 [[ $# -eq 0 ]] && return 0
626 local flag 625 local flag
627 for flag in "$@"; do 626 for flag in "$@"; do
628 [[ ${flag} == -l* ]] && flag=${flag#-l} 627 [[ ${flag} == -l* ]] && flag=${flag#-l}
629 export LIBS="${LIBS} -l${flag}" 628 export LIBS="${LIBS} -l${flag}"
630 done 629 done
635# @FUNCTION: append-ldflags 634# @FUNCTION: append-ldflags
636# @USAGE: <flags> 635# @USAGE: <flags>
637# @DESCRIPTION: 636# @DESCRIPTION:
638# Add extra <flags> to the current LDFLAGS. 637# Add extra <flags> to the current LDFLAGS.
639append-ldflags() { 638append-ldflags() {
640 [[ -z $* ]] && return 0 639 [[ $# -eq 0 ]] && return 0
641 local flag 640 local flag
642 for flag in "$@"; do 641 for flag in "$@"; do
643 [[ ${flag} == -l* ]] && \ 642 [[ ${flag} == -l* ]] && \
644 ewarn "Appending a library link instruction (${flag}); libraries to link to should not be passed through LDFLAGS" 643 ewarn "Appending a library link instruction (${flag}); libraries to link to should not be passed through LDFLAGS"
645 done 644 done

Legend:
Removed from v.1.157  
changed lines
  Added in v.1.159

  ViewVC Help
Powered by ViewVC 1.1.20