[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] Re: separate build directory support for Chicken
From: |
Peter Bex |
Subject: |
Re: [Chicken-hackers] Re: separate build directory support for Chicken |
Date: |
Sun, 13 Jan 2008 14:44:56 +0100 |
User-agent: |
Mutt/1.4.2.3i |
On Sun, Jan 13, 2008 at 11:26:30AM +0600, Ivan Shmakov wrote:
> And, well, I have some trouble understanding the manageability
> or even readability of the Makefile fragments like the
> following:
>
> --cut--
> FOO-1$(O): FOO-1.c
> COMPILE-IT
> FOO-2$(O): FOO-2.c
> COMPILE-IT
> [ ... 74 lines skipped... ]
> FOO-40$(O): FOO-40.c
> COMPILE-IT
> --cut--
>
> Rather, I'd have:
>
> --cut--
> FOO_SOURCES = FOO-1.c FOO-2.c ... FOO-40.c
> FOO_OBJECTS = $(FOO_SOURCES:.c=$(O))
>
> $(FOO_OBJECTS) : %$(O) : %.c
> COMPILE-IT
> --cut--
With pmake (BSD makefiles), this can be done in an elegant way as well
and without the horrible resulting Makefile.in/configure/Makefile mess
that you get with autofools:
--cut--
PROG=foo
SRCS=foo-1.c foo-2.c foo-3.c ... foo-40.c
.include <bsd.prog.mk>
--cut--
That's it, and that's all you need. No messing about with autohell
versions, no undecipherable configure scripts or Makefile.in files.
Instead of generating a huge standalone build environment with the info
you need to build the program in it, the BSD make system puts this in
a system-wide directory, so your program does not need to carry it.
Politically this might be hard to implement, in this brave GNU world
(I wouldn't care, though).
> Would there be more dependencies for FOO-N objects, I'd add them
> as follows:
>
> $(FOO_OBJECTS) : GENERIC-FOO-DEPENDENCIES
> FOO-X$(O) FOO-Y$(O) : SPECIFIC-FOO-X-Y-DEPENDENCIES
> FOO-Z$(O) : SPECIFIC-FOO-Z-DEPENDENCIES
You can add to the default rules generated by pmake too, like you
would with any regular make script:
foo.c: foo-something.h
> Furthermore, I'd suggest using the C compiler to compute
> dependencies, and not to hardcode them in the makefile.
You can use mkdep(1) for that, which calls the C compiler and outputs
a nice file that pmake can use. Of course pmake comes with default
targets to generate this file automatically.
However, having said all this, I don't think the current Makefile
system is all that complicated. It's pretty redundant but that does
not have to be a problem.
Cheers,
Peter
--
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
is especially attractive, not only because it can be economically
and scientifically rewarding, but also because it can be an aesthetic
experience much like composing poetry or music."
-- Donald Knuth
pgpDVTFxePEUn.pgp
Description: PGP signature
- Re: [Chicken-hackers] Re: separate build directory support for Chicken, (continued)
- Re: [Chicken-hackers] Re: separate build directory support for Chicken, Zbigniew, 2008/01/12
- [Chicken-hackers] Re: separate build directory support for Chicken, Ivan Shmakov, 2008/01/13
- Re: [Chicken-hackers] Re: separate build directory support for Chicken, John Cowan, 2008/01/13
- [Chicken-hackers] Re: separate build directory support for Chicken, Ivan Shmakov, 2008/01/13
- Re: [Chicken-hackers] Re: separate build directory support for Chicken, felix winkelmann, 2008/01/13
- Re: [Chicken-hackers] Re: separate build directory support for Chicken, felix winkelmann, 2008/01/12
- [Chicken-hackers] Re: separate build directory support for Chicken, Ivan Shmakov, 2008/01/12
- [Chicken-hackers] Re: separate build directory support for Chicken, Ivan Shmakov, 2008/01/13
- Re: [Chicken-hackers] Re: separate build directory support for Chicken, Elf, 2008/01/13
- Re: [Chicken-hackers] Re: separate build directory support for Chicken, felix winkelmann, 2008/01/13
- Re: [Chicken-hackers] Re: separate build directory support for Chicken,
Peter Bex <=
- Re: [Chicken-hackers] Re: separate build directory support for Chicken, felix winkelmann, 2008/01/13
- Re: [Chicken-hackers] Re: separate build directory support for Chicken, felix winkelmann, 2008/01/13
- [Chicken-hackers] Re: separate build directory support for Chicken, Ivan Shmakov, 2008/01/14
- [Chicken-hackers] Re: separate build directory support for Chicken, Aleksej Saushev, 2008/01/13
- Re: [Chicken-hackers] Re: separate build directory support for Chicken, Elf, 2008/01/13
- Re: [Chicken-hackers] Re: separate build directory support for Chicken, Peter Bex, 2008/01/13
- Re: [Chicken-hackers] Re: separate build directory support for Chicken, Elf, 2008/01/13
- Re: [Chicken-hackers] Re: separate build directory support for Chicken, Peter Bex, 2008/01/13
- Re: [Chicken-hackers] Re: separate build directory support for Chicken, Elf, 2008/01/13
- Re: [Chicken-hackers] Re: separate build directory support for Chicken, felix winkelmann, 2008/01/13