[erlang-questions] Use of makefiles

Joe Armstrong <>
Fri Feb 29 22:17:21 CET 2008


Perhaps I should explain why I use make and why I added a section on
Makefiles in the Erlang book.

To start with I use makefiles for *all* project irrespective of the language.

No matter how small a project is, if I suspend the project and start
working on it months or
years later I will have forgotten how to build the project.

I always try to make the same targets for *every* project.

   make - makes the system
   make debug - make a debug system
   make clean - deletes all object code and tempory files
   make dist - maks a distribution

Other targets are *explicitly* documented in the Makefile

The advantages of make are

   - It's not going to go away
   - It's available on all platforms I use
   - It works with *all* languages (C, erlang, perl, python, ...)

In general I try to use *generic* tools for all programing tasks, for
me this means that
make, emacs, bash, and xterm are constants for all projects. The only
bit that varies is the choice
of programming language.

When I learn a new language all I have to do is learn the language -
all the other tools say the same -
in the long term this is far better than learning specific tools for
each language - it allows me to concentrate
on the important details (learning the new language) and not get
bogged down in the details of the support
system. (This is also why I *hate* visual environments - each one is
*different*, text tools stay the same
across machine and time boundaries). I can (and do) run makefiles that
are 15 years old - the same cannot be said for visual build
environments.

The few hours spent learning some basic makefile syntax is well worth
the investment - you can amortorise
the investment in time over the next twenty years - so it's well worth doing.

Well written makefiles a part of good programming practice.

To me a project is not complete until there is beautiful code,
beautiful makefiles and beautiful documentation.

A project without documentation and makefiles is a mess and will be
very difficult to maintain.

In the lifecyle of a project more times goes into maintenance than in
the initial coding, at this stage
makefiles are essential - I know of no realistic alternative.

/Joe Armstrong





On Fri, Feb 29, 2008 at 9:41 PM, Brian Cully <> wrote:
> On 29-Feb-2008, at 14:56, Toby Thain wrote:
>  >> Makefiles are declarative, so in theory they should be really neat
>  >> and
>  >> the Erlang world should love them. There are two flies in the
>  >> ointment. One is that the syntax is batshit crazy.
>  >
>  > i.e. Nobody reads the manual.
>
>         Having a manual doesn't make make's syntax any less batshit crazy.
>
>
>  >
>  >> The other is that
>  >> people tend to force large doses of imperativeness into Makefiles,
>  >> which defeats half the point. One widespread example is recursive
>  >> makefiles.
>  >
>  > i.e. Nobody learns how to use it properly.
>
>         Or: make isn't suitable for large classes of useful work and
>  thinking, but given its predominance it is forced into these roles by
>  hook and crook.
>
>  -bjc
>
>
> _______________________________________________
>  erlang-questions mailing list
>  
>  http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list