/[gentoo-x86]/eclass/flag-o-matic.eclass
Gentoo

Contents of /eclass/flag-o-matic.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (hide annotations) (download)
Sun Sep 8 08:43:36 2002 UTC (11 years, 10 months ago) by danarmak
Branch: MAIN
Changes since 1.6: +15 -1 lines
add an is-flag function that returns true if its parameter exists in  or

1 verwilst 1.1 # Copyright 1999-2002 Gentoo Technologies, Inc.
2     # Distributed under the terms of the GNU General Public License v2
3     # Author Bart Verwilst <verwilst@gentoo.org>
4     # /space/gentoo/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass
5     ECLASS=flag-o-matic
6 danarmak 1.6 INHERITED="$INHERITED $ECLASS"
7 verwilst 1.2 #
8 verwilst 1.3 #### filter-flags <flag> ####
9     # Remove particular flags from C[XX]FLAGS
10 verwilst 1.2 #
11 verwilst 1.3 #### append-flags <flag> ####
12     # Add extra flags to your current C[XX]FLAGS
13     #
14 verwilst 1.4 #### replace-flags <orig.flag> <new.flag> ###
15 verwilst 1.3 # Replace a flag by another one
16     #
17 danarmak 1.7 #### is-flag <flag> ####
18     # Returns "true" if flag is set in C[XX]FLAGS
19     # Matches only complete flag
20     #
21 verwilst 1.3
22 verwilst 1.1 filter-flags () {
23    
24     for x in $1; do
25     CFLAGS="${CFLAGS/$x}"
26     CXXFLAGS="${CXXFLAGS/$x}"
27     done
28 verwilst 1.2
29     }
30    
31     append-flags () {
32    
33    
34     CFLAGS="$CFLAGS $1"
35     CXXFLAGS="$CXXFLAGS $1"
36 verwilst 1.1
37     }
38    
39 verwilst 1.4 replace-flags () {
40 verwilst 1.1
41 drobbins 1.5 CFLAGS="${CFLAGS/${1}/${2}}"
42     CXXFLAGS="${CXXFLAGS/${1}/${2}}"
43 danarmak 1.7
44     }
45    
46     is-flag() {
47    
48     for x in $CFLAGS $CXXFLAGS; do
49     if [ "$x" == "$1" ]; then
50     echo true
51     break
52     fi
53     done
54 verwilst 1.1
55     }

  ViewVC Help
Powered by ViewVC 1.1.20