| 1 | # Copyright 1999-2003 Gentoo Technologies, Inc. |
1 | # Copyright 1999-2003 Gentoo Technologies, Inc. |
| 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.37 2004/02/21 07:19:29 vapier Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.40 2004/03/12 11:21:15 vapier Exp $ |
| 4 | # |
4 | # |
| 5 | # Author Bart Verwilst <verwilst@gentoo.org> |
5 | # Author Bart Verwilst <verwilst@gentoo.org> |
| 6 | |
6 | |
| 7 | ECLASS=flag-o-matic |
7 | ECLASS=flag-o-matic |
| 8 | INHERITED="$INHERITED $ECLASS" |
8 | INHERITED="$INHERITED $ECLASS" |
| … | |
… | |
| 77 | } |
77 | } |
| 78 | |
78 | |
| 79 | filter-flags() { |
79 | filter-flags() { |
| 80 | for x in "$@" ; do |
80 | for x in "$@" ; do |
| 81 | case "${x}" in |
81 | case "${x}" in |
| 82 | -fPIC|-fpic|-fPIE|-fpie) etexec-flags;; |
82 | -fPIC|-fpic|-fPIE|-fpie|-pie) etexec-flags;; |
| 83 | -fstack-protector|-fstack-protector-all) fstack-flags;; |
83 | -fstack-protector|-fstack-protector-all) fstack-flags;; |
| 84 | *) ;; |
84 | *) ;; |
| 85 | esac |
85 | esac |
| 86 | done |
86 | done |
| 87 | |
87 | |
| … | |
… | |
| 94 | CXXFLAGS="${CXXFLAGS// ${x} / }" |
94 | CXXFLAGS="${CXXFLAGS// ${x} / }" |
| 95 | done |
95 | done |
| 96 | CFLAGS="${CFLAGS:1:${#CFLAGS}-2}" |
96 | CFLAGS="${CFLAGS:1:${#CFLAGS}-2}" |
| 97 | CXXFLAGS="${CXXFLAGS:1:${#CXXFLAGS}-2}" |
97 | CXXFLAGS="${CXXFLAGS:1:${#CXXFLAGS}-2}" |
| 98 | return 0 |
98 | return 0 |
|
|
99 | } |
|
|
100 | |
|
|
101 | filter-lfs-flags() { |
|
|
102 | filter-flags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE |
| 99 | } |
103 | } |
| 100 | |
104 | |
| 101 | append-flags() { |
105 | append-flags() { |
| 102 | export CFLAGS="${CFLAGS} $@" |
106 | export CFLAGS="${CFLAGS} $@" |
| 103 | export CXXFLAGS="${CXXFLAGS} $@" |
107 | export CXXFLAGS="${CXXFLAGS} $@" |
| … | |
… | |
| 121 | local newcpu="$1" ; shift |
125 | local newcpu="$1" ; shift |
| 122 | local oldcpu="" |
126 | local oldcpu="" |
| 123 | for oldcpu in "$@" ; do |
127 | for oldcpu in "$@" ; do |
| 124 | replace-flags -march=${oldcpu} -march=${newcpu} |
128 | replace-flags -march=${oldcpu} -march=${newcpu} |
| 125 | replace-flags -mcpu=${oldcpu} -mcpu=${newcpu} |
129 | replace-flags -mcpu=${oldcpu} -mcpu=${newcpu} |
|
|
130 | replace-flags -mtune=${oldcpu} -mtune=${newcpu} |
| 126 | done |
131 | done |
| 127 | return 0 |
132 | return 0 |
| 128 | } |
133 | } |
| 129 | |
134 | |
| 130 | is-flag() { |
135 | is-flag() { |