/[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.154 Revision 1.159
1# Copyright 1999-2009 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.154 2011/08/17 17:59:35 vapier 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="${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="${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="${FFLAGS} $*" 177 export FFLAGS=$(test-flags-F77 ${FFLAGS} "$@")
178 export FCFLAGS="${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:
184# Add flags that enable Large File Support. 184# Add flags that enable Large File Support.
185append-lfs-flags() { 185append-lfs-flags() {
186 [[ $# -ne 0 ]] && die "append-lfs-flags takes no arguments" 186 [[ $# -ne 0 ]] && die "append-lfs-flags takes no arguments"
187 # see comments in filter-lfs-flags func for meaning of these
187 append-cppflags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE 188 append-cppflags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
188} 189}
189 190
190# @FUNCTION: append-flags 191# @FUNCTION: append-flags
191# @USAGE: <flags> 192# @USAGE: <flags>
192# @DESCRIPTION: 193# @DESCRIPTION:
193# Add extra <flags> to your current {C,CXX,F,FC}FLAGS. 194# Add extra <flags> to your current {C,CXX,F,FC}FLAGS.
194append-flags() { 195append-flags() {
195 [[ -z $* ]] && return 0 196 [[ $# -eq 0 ]] && return 0
196 append-cflags "$@" 197 append-cflags "$@"
197 append-cxxflags "$@" 198 append-cxxflags "$@"
198 append-fflags "$@" 199 append-fflags "$@"
199 return 0 200 return 0
200} 201}
447 448
448 shift 449 shift
449 450
450 [[ -z ${comp} ]] && return 1 451 [[ -z ${comp} ]] && return 1
451 452
452 x=""
453 for x in "$@" ; do 453 for x in "$@" ; do
454 test-flag-${comp} "${x}" && flags="${flags}${flags:+ }${x}" 454 test-flag-${comp} "${x}" && flags="${flags}${flags:+ }${x}"
455 done 455 done
456 456
457 echo "${flags}" 457 echo "${flags}"
619# @FUNCTION: append-libs 619# @FUNCTION: append-libs
620# @USAGE: <libs> 620# @USAGE: <libs>
621# @DESCRIPTION: 621# @DESCRIPTION:
622# Add extra <libs> to the current LIBS. 622# Add extra <libs> to the current LIBS.
623append-libs() { 623append-libs() {
624 [[ -z $* ]] && return 0 624 [[ $# -eq 0 ]] && return 0
625 local flag 625 local flag
626 for flag in "$@"; do 626 for flag in "$@"; do
627 [[ ${flag} == -l* ]] && flag=${flag#-l} 627 [[ ${flag} == -l* ]] && flag=${flag#-l}
628 export LIBS="${LIBS} -l${flag}" 628 export LIBS="${LIBS} -l${flag}"
629 done 629 done
634# @FUNCTION: append-ldflags 634# @FUNCTION: append-ldflags
635# @USAGE: <flags> 635# @USAGE: <flags>
636# @DESCRIPTION: 636# @DESCRIPTION:
637# Add extra <flags> to the current LDFLAGS. 637# Add extra <flags> to the current LDFLAGS.
638append-ldflags() { 638append-ldflags() {
639 [[ -z $* ]] && return 0 639 [[ $# -eq 0 ]] && return 0
640 local flag 640 local flag
641 for flag in "$@"; do 641 for flag in "$@"; do
642 [[ ${flag} == -l* ]] && \ 642 [[ ${flag} == -l* ]] && \
643 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"
644 done 644 done
655 _filter-var LDFLAGS "$@" 655 _filter-var LDFLAGS "$@"
656 return 0 656 return 0
657} 657}
658 658
659# @FUNCTION: raw-ldflags 659# @FUNCTION: raw-ldflags
660# @USAGE: <flags> 660# @USAGE: [flags]
661# @DESCRIPTION: 661# @DESCRIPTION:
662# Turn C style ldflags (-Wl,-foo) into straight ldflags - the results 662# Turn C style ldflags (-Wl,-foo) into straight ldflags - the results
663# are suitable for passing directly to 'ld'; note LDFLAGS is usually passed 663# are suitable for passing directly to 'ld'; note LDFLAGS is usually passed
664# to gcc where it needs the '-Wl,'. 664# to gcc where it needs the '-Wl,'.
665#
666# If no flags are specified, then default to ${LDFLAGS}.
665raw-ldflags() { 667raw-ldflags() {
666 local x input="$@" 668 local x input="$@"
667 [[ -z ${input} ]] && input=${LDFLAGS} 669 [[ -z ${input} ]] && input=${LDFLAGS}
668 set -- 670 set --
669 for x in ${input} ; do 671 for x in ${input} ; do

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

  ViewVC Help
Powered by ViewVC 1.1.20