Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
A Tutorial on GNU Make with OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-05-21 (08:17)
From: David Allsopp <dra-news@m...>
Subject: RE: [Caml-list] A Tutorial on GNU Make with OCaml
Michael Grünewald wrote:
> Dear Jeff,
> Jeff Shaw wrote:
> >
> > Dear OCamlers,
> > I spent quite a lot of time today getting better acquainted with GNU
> > make and decided I to share my experience and results. It's a bit on
> > the newbie friendly side of instruction.
> >
> >
> > _20.html
> ten years ago I learned GNU Make and found it awful to program. I had the
> feeling that it is nit meant to write complex (or mildly complex)
> makefiles.

I could be wrong about the way it's constructed, but I think you'll find
that the Linux kernel build system is *written* (rather than generated) in
GNU make cf. Managing Projects with GNU Make 3rd Ed pp. 218--228.

> Instead makefiles should be written by another program. I may
> be wrong but I think that GNU Make shines when it is used as part of the
> auto-tools chain, that you may also need to learn.

IMO users of auto-tools fall into two categories - users who need Makefiles
that work cross-platform (so package maintainers) and programmers who don't
regard the build system of their code as worth spending any time on. I
similarly 10 years ago (nearly) learned GNU make but my reaction was the
opposite to yours - I now have handwritten Makefiles for quite large
projects which build projects containing only OCaml but C, JavaScript, XHTML
templates and various other text files, maintain patches against 3rd party
libraries. The Makefile for my website is written in GNU make, runs
cross-platform and uses a parallel and distributed build system (distributed
only because it has to compile some programs on BSD and then pull them back
to Windows before uploading) with not an auto-tool in sight (assuming that
we're allowed dependency generators, of course). Granted, I spent a day
writing it but to me that's the divide - are you willing to spend the time
handcrafting a fully optimised (and possibly therefore faster) build system
or stick with something that takes a few seconds in an auto-tool.

> My personal taste goes rather to BSD Make (make in FreeBSD, bsdmake in OS-
> X and bmake in some other places): I found it much mor eeasy to program,
> and the FreeBSD build toolchain and ports collection provide a significant
> amount of Makefile techniques one can draws its inspiration from. I wrote
> my own macros for my OCaml projects.

So essentially you dislike make in general (bmake and gmake aren't *that*
different - though that said on BSD I always use gmake) - simply that on BSD
there are a large number of pre-written Makefiles and Makefile fragments
which allow you to produce your Makefiles more quickly.