caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] A useful Makefile collection for OCaml projects
@ 2013-10-29 21:45 Michael Grünewald
       [not found] ` <52706214.8090504@riken.jp>
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Grünewald @ 2013-10-29 21:45 UTC (permalink / raw)
  To: caml-list

Dear Ocamllers!


I use a moderately sophisticated collection of Makefile to build my
OCaml-based projects. I recently decided to polish its organisation and
documentation, because it might be useful to someone else. If you are
interested in trying it, check your backups and visit

https://bitbucket.org/michipili/bsdmakepscripts

Installation instructions are found on this page and an example for a
simple ocaml program.

Of course, your feedback would be much appreciated and I would try to
answer questions that you may have!

It is usable with BSD Make and some variants. On FreeBSD it is `make`,
on other BSDs it is probably `make` as well, on Mac OS X it is `bsdmake`
and on Debian it is `pmake`. If you do not have any of these programs,
you may install bmake, see
https://bitbucket.org/michipili/bsdmakepscripts/wiki/BMake.


FEATURES OVERVIEW

- It is written for make(1) and it is thus easy to extend or to
integrate in a typical unixish workflow.
- It supports OBJDIRPREFIX, which means you can separate sources and
object files and implement “compilation profiles” having products stored
in different directories.
- It supports parallel build at the “directory granularity level”.
- It supports ocamlfind, ocamldoc, ocamldepends, ocamllex and ocamlyacc.
- It supports the production of GPG-signed distfile tarballs.

Aside from compiling OCaml programs, it can do many more useful things
(typeset with TeX, weave and tangle with noweb).


EXAMPLES & DOCUMENTATION

There are examples in the `test/ocaml' subdirectory, each subdirectory
is a toy product demonstrating some features. The `miniproj-3' displays
use of the most advanced features.

Recipes for building OCaml based products are found in the Wiki:

https://bitbucket.org/michipili/bsdmakepscripts/wiki/DevelopOCamlSoftware


HEY, I THOUGHT MAKEFILES WERE OBSOLETE!

Makefile-based build systems might have limitations and shortcomings[*],
but:

- Writing Makefiles is a *generic* competence useful to all *NIX users,
so these build systems rely on something you more or less already know
or want to learn.

- Since Makefile are *generic* you can also build non-OCaml pieces of
your system with them, so these build systems rely on a single tool.

- There are ambitious build systems relying exclusively on makefiles, as
FreeBSD's (and other BSD's I guess), so these build systems have a
proved ability to scale to very large projects.

[*] It requires a suitable architecture and organisation to support
dependencies across directories.


OCAMLBUILD

Since I started my education at the university of Montpellier where I
met Berke Durak, one of the authors of `ocamlbuild`, I feel appropriate
to stress that ***this is not a concurrent project to ocamlbuild***! :-)


Have fun with these make macros!

-- 
Michael



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] A useful Makefile collection for OCaml projects
       [not found] ` <52706214.8090504@riken.jp>
@ 2013-10-30  6:55   ` Michael
  0 siblings, 0 replies; 2+ messages in thread
From: Michael @ 2013-10-30  6:55 UTC (permalink / raw)
  To: Francois Berenger; +Cc: caml-list

Francois Berenger wrote:
> Do you know obuild?
> https://github.com/vincenthz/obuild
There is a lot of other systems that can be used to drive the build of
OCaml projects: obuild, ocamlbuild, omake, OMakefile and probably
others. I find it valuable to use a Makefile-based approach, because:

- It is not specific to OCaml, so I can use the same tool to drive the
development cycle of a heterogeneous project. (I can, and I do!)

- It is easy to extend, because it focuses on workflows (targets and
prerequisites are elements of simple workflows).

- It can be tweaked so I can include any custom step I want in my
workflow, because it is based on the UNIX shell.

So for instance, if I want to do plop plop fizz fizz after the build
step, I only need to add

do-build-after: do-plop-plop-fizz-fizz
do-plop-plop-fizz-fizz:
     : Shell commands that plop plop fizz fizz

at the end of the Makefile. And it does not involve a special feature of
the tool but instead, it is just the normal way to do things with make.

Also, as I started in 2005, I selected the BSD flavour of make because
it has a canonical clear, short and to the point documentation (Adam de
Boor's tutorial), an equally good reference (the man page) and has a
large literature corpus (BSD's build systems) I could take inspiration
from. (I actually started with GNU make and switched because its
documentation fails to be so useful as BSD's, despite its length, and
because it is hard to find useful examples is the sea of
automake-generated files.)

Regards,
Michael


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-10-30  6:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-29 21:45 [Caml-list] A useful Makefile collection for OCaml projects Michael Grünewald
     [not found] ` <52706214.8090504@riken.jp>
2013-10-30  6:55   ` Michael

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).