| 1 | # Copyright 1999-2002 Gentoo Technologies, Inc. |
1 | # Copyright 1999-2004 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/makeedit.eclass,v 1.4 2002/08/29 23:56:15 azarah Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/makeedit.eclass,v 1.11 2005/09/26 22:22:08 azarah Exp $ |
|
|
4 | # |
|
|
5 | # Author: Spider |
|
|
6 | # |
|
|
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. |
| 4 | |
15 | |
| 5 | # Author: Spider |
|
|
| 6 | # makeedit eclass, will remove -Wreturn-type and -Wall from compiling, this will reduce the RAM requirements. |
|
|
| 7 | |
16 | |
| 8 | # Debug ECLASS |
17 | MAKEEDIT_FLAGS="-Wno-return-type -w" |
| 9 | ECLASS="makeedit" |
|
|
| 10 | INHERITED="$INHERITED $ECLASS" |
|
|
| 11 | |
18 | |
| 12 | export CFLAGS="${CFLAGS} -Wno-return-type -w" |
|
|
| 13 | export CXXFLAGS="${CXXFLAGS} -Wno-return-type -w" |
|
|
| 14 | |
|
|
| 15 | edit_makefiles () { |
19 | 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 \ |
| 22 | sed -e 's:-Wall::g' \ |
25 | -e 's:-Wall::g' \ |
| 23 | -e 's:-Wreturn-type::g' \ |
26 | -e 's:-Wreturn-type::g' \ |
| 24 | -e 's:-pedantic::g' ${MAKEFILE}.old > ${MAKEFILE} |
27 | -e 's:-pedantic::g' |
| 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 |
|
|
| 36 | } |
28 | } |