/[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.170 Revision 1.173
1# Copyright 1999-2011 Gentoo Foundation 1# Copyright 1999-2012 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.170 2012/05/26 02:55:02 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.173 2012/05/31 00:29:06 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
121 # _LARGEFILE64_SOURCE: enable support for 64bit variants (off64_t/fseeko64/etc...) 121 # _LARGEFILE64_SOURCE: enable support for 64bit variants (off64_t/fseeko64/etc...)
122 # _FILE_OFFSET_BITS: default to 64bit variants (off_t is defined as off64_t) 122 # _FILE_OFFSET_BITS: default to 64bit variants (off_t is defined as off64_t)
123 filter-flags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE 123 filter-flags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
124} 124}
125 125
126# @FUNCTION: filter-ldflags
127# @USAGE: <flags>
128# @DESCRIPTION:
129# Remove particular <flags> from LDFLAGS. Accepts shell globs.
130filter-ldflags() {
131 _filter-var LDFLAGS "$@"
132 return 0
133}
134
126# @FUNCTION: append-cppflags 135# @FUNCTION: append-cppflags
127# @USAGE: <flags> 136# @USAGE: <flags>
128# @DESCRIPTION: 137# @DESCRIPTION:
129# Add extra <flags> to the current CPPFLAGS. 138# Add extra <flags> to the current CPPFLAGS.
130append-cppflags() { 139append-cppflags() {
171 [[ $# -ne 0 ]] && die "append-lfs-flags takes no arguments" 180 [[ $# -ne 0 ]] && die "append-lfs-flags takes no arguments"
172 # see comments in filter-lfs-flags func for meaning of these 181 # see comments in filter-lfs-flags func for meaning of these
173 append-cppflags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE 182 append-cppflags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
174} 183}
175 184
185# @FUNCTION: append-ldflags
186# @USAGE: <flags>
187# @DESCRIPTION:
188# Add extra <flags> to the current LDFLAGS.
189append-ldflags() {
190 [[ $# -eq 0 ]] && return 0
191 local flag
192 for flag in "$@"; do
193 [[ ${flag} == -l* ]] && \
194 ewarn "Appending a library link instruction (${flag}); libraries to link to should not be passed through LDFLAGS"
195 done
196
197 export LDFLAGS="${LDFLAGS} $*"
198 return 0
199}
200
176# @FUNCTION: append-flags 201# @FUNCTION: append-flags
177# @USAGE: <flags> 202# @USAGE: <flags>
178# @DESCRIPTION: 203# @DESCRIPTION:
179# Add extra <flags> to your current {C,CXX,F,FC}FLAGS. 204# Add extra <flags> to your current {C,CXX,F,FC}FLAGS.
180append-flags() { 205append-flags() {
181 [[ $# -eq 0 ]] && return 0 206 [[ $# -eq 0 ]] && return 0
182 case " $* " in 207 case " $* " in
183 *' '-[DIU]*) eqawarn 'please use append-cppflags for preprocessor flags' ;; 208 *' '-[DIU]*) eqawarn 'please use append-cppflags for preprocessor flags' ;;
209 *' '-L*|\
184 *' '-L*) eqawarn 'please use append-ldflags for linker flags' ;; 210 *' '-Wl,*) eqawarn 'please use append-ldflags for linker flags' ;;
185 esac 211 esac
186 append-cflags "$@" 212 append-cflags "$@"
187 append-cxxflags "$@" 213 append-cxxflags "$@"
188 append-fflags "$@" 214 append-fflags "$@"
189 return 0 215 return 0
547 for flag in "$@"; do 573 for flag in "$@"; do
548 [[ ${flag} == -l* ]] && flag=${flag#-l} 574 [[ ${flag} == -l* ]] && flag=${flag#-l}
549 export LIBS="${LIBS} -l${flag}" 575 export LIBS="${LIBS} -l${flag}"
550 done 576 done
551 577
552 return 0
553}
554
555# @FUNCTION: append-ldflags
556# @USAGE: <flags>
557# @DESCRIPTION:
558# Add extra <flags> to the current LDFLAGS.
559append-ldflags() {
560 [[ $# -eq 0 ]] && return 0
561 local flag
562 for flag in "$@"; do
563 [[ ${flag} == -l* ]] && \
564 ewarn "Appending a library link instruction (${flag}); libraries to link to should not be passed through LDFLAGS"
565 done
566
567 export LDFLAGS="${LDFLAGS} $*"
568 return 0
569}
570
571# @FUNCTION: filter-ldflags
572# @USAGE: <flags>
573# @DESCRIPTION:
574# Remove particular <flags> from LDFLAGS. Accepts shell globs.
575filter-ldflags() {
576 _filter-var LDFLAGS "$@"
577 return 0 578 return 0
578} 579}
579 580
580# @FUNCTION: raw-ldflags 581# @FUNCTION: raw-ldflags
581# @USAGE: [flags] 582# @USAGE: [flags]

Legend:
Removed from v.1.170  
changed lines
  Added in v.1.173

  ViewVC Help
Powered by ViewVC 1.1.20