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
[Caml-list] Building O'Caml projects properly.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: proff@i...
Subject: Re: [Caml-list] Building O'Caml projects properly.
> I'm not very experienced with make, so I've been using Markus Mottl's 
> OcamlMakefile in my projects so far.  In one of my projects, I use source 
> files from two other small libraries I've written; at present, I just have a 
> whole lot of files in my SOURCES and a bunch of symlinks to the proper files 
> in the proper directories.  However, I'd really like to be able to improve 
> my build process, and I think a good way to do that is to isolate in 
> directories the other libraries I've written.

Just factor out the common code into a seperate directory and use
OcamlMakefile to create a library out of it, for example:

kosha$ ls -F
CVS/            OcamlMakefile   erlang/         prog/
Makefile        doc/            lib/            sql/

kosha$ cat Makefile
SUBDIRS= lib prog/smtp_test prog/kosha

.PHONY: all
        for dir in $(SUBDIRS); do (cd $$dir && $(MAKE)); done

.PHONY: clean
        for dir in $(SUBDIRS); do (cd $$dir && $(MAKE) clean); done

kosha$ cd lib
kosha/lib$ cat Makefile
#Note the two targets library dependencies for "all:"

all:    debug-code-library native-code-library

LIBS=unix str netstring


kosha$ cd prog/kosha
kosha/prog/kosha$ cat Makefile
#Note well the two {LIB,INC}DIRS lines, and "klib" on the LIBS line

LIBDIRS += ../../lib
INCDIRS += ../../lib

SOURCES=$(ocamlnet)\ esmtp_parser.mly esmtp_lexer.mll\


LIBS=unix str dbm pq netstring threads klib

all: dc


 Julian Assange        |If you want to build a ship, don't drum up people
                       |together to collect wood or assign them tasks and          |work, but rather teach them to long for the endless  |immensity of the sea. -- Antoine de Saint Exupery
Bug reports:  FAQ:
To unsubscribe, mail  Archives: