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 WAA18038; Sun, 30 Sep 2001 22:40:45 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA18003 for caml-list@pauillac.inria.fr; Sun, 30 Sep 2001 22:40:45 +0200 (MET DST) 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 XAA01524 for ; Sat, 29 Sep 2001 23:48:21 +0200 (MET DST) Received: from suburbia.net (suburbia.net [203.4.184.1]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f8TLmIr02630 for ; Sat, 29 Sep 2001 23:48:19 +0200 (MET DST) Received: by suburbia.net (Postfix, from userid 110) id EB0EA259EF; Sun, 30 Sep 2001 07:48:08 +1000 (EST) Subject: Re: [Caml-list] Building O'Caml projects properly. In-Reply-To: To: Jeremy Fincher Date: Sun, 30 Sep 2001 07:48:08 +1000 (EST) Cc: caml-list@pauillac.inria.fr X-Mailer: ELM [version 2.4ME+ PL93 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Message-Id: <20010929214808.EB0EA259EF@suburbia.net> From: proff@iq.org (Julian Assange) Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > 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 all: for dir in $(SUBDIRS); do (cd $$dir && $(MAKE)); done .PHONY: clean 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:" OCAMLMAKEFILE=../OcamlMakefile SOURCES=utils.ml mylist.ml mylist_test.ml io.ml RESULT=klib THREADS=yes all: debug-code-library native-code-library LIBS=unix str netstring -include $(OCAMLMAKEFILE) kosha$ cd prog/kosha kosha/prog/kosha$ cat Makefile #Note well the two {LIB,INC}DIRS lines, and "klib" on the LIBS line OCAMLMAKEFILE=../../OcamlMakefile ocamlnet=ocnMisc.ml tokenize.ml mailmessage.ml LIBDIRS += ../../lib INCDIRS += ../../lib SOURCES=$(ocamlnet) opt.ml match.ml db.ml canary.ml mailtype.ml\ spamdb.ml mail.ml esmtp_parser.mly esmtp_lexer.mll\ smtp_server.ml main.ml RESULT=kosha THREADS=yes LIBS=unix str dbm pq netstring threads klib all: dc -include $(OCAMLMAKEFILE) -- Julian Assange |If you want to build a ship, don't drum up people |together to collect wood or assign them tasks and proff@iq.org |work, but rather teach them to long for the endless proff@gnu.ai.mit.edu |immensity of the sea. -- Antoine de Saint Exupery ------------------- 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