| 1 | # Copyright 1999-2004 Gentoo Foundation |
1 | # Copyright 1999-2002 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/makeedit.eclass,v 1.1.1.1 2005/11/30 09:59:23 chriswhite Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/makeedit.eclass,v 1.4 2002/08/29 23:56:15 azarah Exp $ |
| 4 | # |
4 | |
| 5 | # Author: Spider |
5 | # Author: Spider |
| 6 | # |
6 | # makeedit eclass, will remove -Wreturn-type and -Wall from compiling, this will reduce the RAM requirements. |
| 7 | # To use this eclass, do 2 things: |
|
|
| 8 | # 1. append-flags "$MAKEEDIT_FLAGS". If you filter-flags, make sure to do |
|
|
| 9 | # the append-flags afterward, otherwise you'll lose them. |
|
|
| 10 | # 2. after running configure or econf, call edit_makefiles to remove |
|
|
| 11 | # extraneous CFLAGS from your Makefiles. |
|
|
| 12 | # |
|
|
| 13 | # This combination should reduce the RAM requirements of your build, and maybe |
|
|
| 14 | # even speed it up a bit. |
|
|
| 15 | |
7 | |
|
|
8 | # Debug ECLASS |
|
|
9 | ECLASS="makeedit" |
|
|
10 | INHERITED="$INHERITED $ECLASS" |
| 16 | |
11 | |
| 17 | MAKEEDIT_FLAGS="-Wno-return-type -w" |
12 | export CFLAGS="${CFLAGS} -Wno-return-type -w" |
|
|
13 | export CXXFLAGS="${CXXFLAGS} -Wno-return-type -w" |
| 18 | |
14 | |
| 19 | edit_makefiles() { |
15 | edit_makefiles () { |
|
|
16 | einfo "Parsing Makefiles..." |
|
|
17 | find . -iname makefile | while read MAKEFILE |
|
|
18 | do |
|
|
19 | cp ${MAKEFILE} ${MAKEFILE}.old |
| 20 | # We already add "-Wno-return-type -w" to compiler flags, so |
20 | # We already add "-Wno-return-type -w" to compiler flags, so |
| 21 | # no need to replace "-Wall" and "-Wreturn-type" with them. |
21 | # no need to replace "-Wall" and "-Wreturn-type" with them. |
| 22 | einfo "Parsing Makefiles ..." |
|
|
| 23 | find . \( -iname makefile -o -name \*.mk -o -name GNUmakefile \) -print0 | \ |
|
|
| 24 | xargs -0 sed -i \ |
|
|
| 25 | -e 's:-Wall::g' \ |
22 | sed -e 's:-Wall::g' \ |
| 26 | -e 's:-Wreturn-type::g' \ |
23 | -e 's:-Wreturn-type::g' \ |
| 27 | -e 's:-pedantic::g' |
24 | -e 's:-pedantic::g' ${MAKEFILE}.old > ${MAKEFILE} |
|
|
25 | rm -f ${MAKEFILE}.old |
|
|
26 | done |
|
|
27 | # Mozilla use .mk includes |
|
|
28 | find . -name '*.mk' | while read MAKEFILE |
|
|
29 | do |
|
|
30 | cp ${MAKEFILE} ${MAKEFILE}.old |
|
|
31 | sed -e 's:-Wall::g' \ |
|
|
32 | -e 's:-Wreturn-type::g' \ |
|
|
33 | -e 's:-pedantic::g' ${MAKEFILE}.old > ${MAKEFILE} |
|
|
34 | rm -f ${MAKEFILE}.old |
|
|
35 | done |
| 28 | } |
36 | } |