1 |
On Wed, 2 Jun 2010 03:16:12 -0400 |
2 |
Mike Frysinger <vapier@g.o> wrote: |
3 |
|
4 |
> On Monday, May 31, 2010 15:12:46 Michał Górny wrote: |
5 |
> > There are many simple applications which come without neither a |
6 |
> > sophisticated build system or even a tiny Makefile. In some cases, |
7 |
> > such applications aren't even packages as tarball -- a single, |
8 |
> > compressed source file is published instead. |
9 |
> > |
10 |
> > In case of these applications, ebuilds inherit |
11 |
> > toolchain-funcs.eclass to retrieve compiler information |
12 |
> > (tc-getCC/tc-getCXX) and call compiler manually, passing |
13 |
> > appropriate flags. |
14 |
> |
15 |
> use emake then and leverage make's implicit rules. |
16 |
|
17 |
The implicit make rules are less universal and -- in the fact -- pretty |
18 |
poor. They're strictly make-dependant, which reduces the amount of |
19 |
control over their behavior. In my opinion, if we should ever use such |
20 |
behavior, it should be rather technical implementation of the functions |
21 |
I'm proposing instead of inline use. |
22 |
|
23 |
POSIX (man 1p make) defines only simple rule for C files: |
24 |
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< |
25 |
|
26 |
I wasn't able to find a rule for C++ files. GNU Make seems a little |
27 |
better but it's documentation is blurry. Although it supports both C |
28 |
and C++, and pretty wide set of variables, it's still less than |
29 |
solution proposed by me. And it's only 'de-facto standard', which isn't |
30 |
guaranteed to be kept unchanged in the future. |
31 |
|
32 |
Namely, advantages of my solution over directly calling emake is: |
33 |
1) direct control over how compiler will be called == better |
34 |
portability, |
35 |
2) possibility of using any output filename (with emake we'd have to |
36 |
rename), |
37 |
3) possibility of clearly using multiple input files, |
38 |
4) possibility of using any input file suffix, |
39 |
5) clear separation between user-specified and ebuild-specified flags |
40 |
(yes, I'm aware of '+=' GNU make extension). |
41 |
|
42 |
And after all, starting a make jobserver for a single compiler process |
43 |
doesn't seem really useful. |
44 |
|
45 |
> sys-apps/unscd is a pretty straight forward example. |
46 |
|
47 |
In my opinion it's rather a poor example. It's the simplest case |
48 |
possible -- single file, no additional flags, no libs. |
49 |
|
50 |
-- |
51 |
Best regards, |
52 |
Michał Górny |
53 |
|
54 |
<http://mgorny.alt.pl> |
55 |
<xmpp:mgorny@××××××.ru> |