1 |
Chris, |
2 |
|
3 |
Chris White wrote: [Sat Nov 20 2004, 01:14:46AM EST] |
4 |
> Go ahead and flame, just thought I'd toss it here to make people's lives |
5 |
> 2% easier :). |
6 |
|
7 |
As was mentioned later in the thread, this is not the right approach. |
8 |
Sedding the Makefiles is error-prone because you use a variable in the |
9 |
RHS of the sed expression. Whether it works for you in your limited |
10 |
tests is irrelevant. You shouldn't be willingly inserting error-prone |
11 |
code into ebuilds. |
12 |
|
13 |
There are two different ways you can deal with the CFLAGS issue |
14 |
instead. Both are better than the sed method. |
15 |
|
16 |
1. If the Makefiles are well-constructed and flags are appropriate |
17 |
passed to sub-makes, then you can do: |
18 |
|
19 |
emake CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" |
20 |
|
21 |
2. If the Makefiles do lazy assignment of variables instead of |
22 |
immediate assignment, then you can simply append a new assignment |
23 |
to the bottom of the ebuild. Here is the comparison of lazy vs. |
24 |
immediately assignment: |
25 |
|
26 |
# lazy assignment |
27 |
CFLAGS = -g |
28 |
|
29 |
# immediate assignment |
30 |
CFLAGS := -g |
31 |
|
32 |
Almost all Makefiles use lazy assignment. In that case you can use |
33 |
a snippet like the following which will override all previous |
34 |
assignments in the ebuild: |
35 |
|
36 |
find "${S}" -name Makefile | while read mf; do |
37 |
printf "\n\nCFLAGS = %s\nCXXFLAGS = %s\n" \ |
38 |
"${CFLAGS}" "${CXXFLAGS}" >> "$mf" |
39 |
done |
40 |
|
41 |
Regards, |
42 |
Aron |
43 |
|
44 |
-- |
45 |
Aron Griffis |
46 |
Gentoo Linux Developer |