From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id AAA01287; Sun, 30 Sep 2001 00:08:45 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id AAA01747 for ; Sun, 30 Sep 2001 00:08:45 +0200 (MET DST) Received: from fichte.ai.univie.ac.at (fichte.ai.univie.ac.at [131.130.174.156]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f8TM8ir02867 for ; Sun, 30 Sep 2001 00:08:44 +0200 (MET DST) Received: (from markus@localhost) by fichte.ai.univie.ac.at (8.9.3/8.9.3/Debian 8.9.3-21) id AAA21795; Sun, 30 Sep 2001 00:08:36 +0200 Date: Sun, 30 Sep 2001 00:08:36 +0200 From: Markus Mottl To: Jeremy Fincher Cc: caml-list@pauillac.inria.fr Subject: Re: [Caml-list] Building O'Caml projects properly. Message-ID: <20010930000836.A21582@fichte.ai.univie.ac.at> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from tweedgeezer@hotmail.com on Sat, Sep 29, 2001 at 16:31:39 -0400 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Sat, 29 Sep 2001, Jeremy Fincher wrote: > 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. "make" is notoriously bad at handling project dependencies across several directories. This means that it imposes some work on the developers to behave as they want it to. If you want to do what I usually do, your project tree should look somewhat like this: ./ Makefile OcamlMakefile lib/ libsrc/ lib1/... lib2/... lib3/... src/ Makefile src1.ml src2.ml ... Your Makefile in the toplevel could contain something like this: --------------------------------------------------------------------------- OCAML_LIB_INSTALL := $(shell echo `pwd`/lib) LIBSRC := $(filter-out libsrc/CVS, $(wildcard libsrc/*)) all: libsrc cd src; $(MAKE) all .PHONY: libsrc libsrc: for dir in $(LIBSRC); do (cd $$dir; yes | $(MAKE) install); done --------------------------------------------------------------------------- If all your libraries follow the OcamlMakefile install conventions, they will be installed in directory "lib". Then your Makefile in directory "src" can refer to your libraries as usual: --------------------------------------------------------------------------- OCAMLMAKEFILE = ../OcamlMakefile SOURCES = src1.ml src2.ml ... RESULT = myexe LIBDIRS = ../lib INCDIRS = ../lib -include $(OCAMLMAKEFILE) --------------------------------------------------------------------------- Enter "make" in the toplevel directory of your project, and everything will be compiled. People usually do not edit their libraries all the time so you only need to issue "make" in your "src"-directory in most cases (very efficient). When you change some library, issue a "make" in the toplevel again and make sure that your "src"-tree will be rebuilt correctly. If insure in the last case, a "make clean; make" in directory "src" will do what you want. I hope this will help you getting started with more complex projects! Regards, Markus Mottl -- Markus Mottl markus@oefai.at Austrian Research Institute for Artificial Intelligence http://www.oefai.at/~markus ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr