From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.2 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE, SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 232CBBB83 for ; Wed, 23 Aug 2006 22:07:06 +0200 (CEST) Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.233]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k7NK75Zb008697 for ; Wed, 23 Aug 2006 22:07:05 +0200 Received: by wr-out-0506.google.com with SMTP id i3so98005wra for ; Wed, 23 Aug 2006 13:07:02 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Mb4d8C1ofw6jkjp+RHZ7VWGJQKtorjueXUnCFKlHSx5mwV3UDJ0av30NmOnSPAHrLUFhjqGmRXZUmeDfFs/RcBBa8JhGk6mIu+67DeeowGj63RpBKgqOw6WqpE7xRlX7PnatjdEHoV2OlagKt2cROoYifIVPGjr4mZ//ux1HsEo= Received: by 10.90.116.6 with SMTP id o6mr286730agc; Wed, 23 Aug 2006 13:07:02 -0700 (PDT) Received: by 10.90.106.19 with HTTP; Wed, 23 Aug 2006 13:07:02 -0700 (PDT) Message-ID: Date: Wed, 23 Aug 2006 13:07:02 -0700 From: "Nathaniel Gray" To: "Renald Buter" Subject: Re: [Caml-list] Building projects written in OCaml Cc: caml-list@yquem.inria.fr In-Reply-To: <20060823152412.GA7453@infinite.fsw.leidenuniv.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20060823152412.GA7453@infinite.fsw.leidenuniv.nl> X-j-chkmail-Score: MSGID : 44ECB569.000 on nez-perce : j-chkmail score : X : 0/20 1 X-Miltered: at nez-perce with ID 44ECB569.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; ocaml:01 makefile:01 'make:01 ml':01 'make:01 test':01 subdirectory:01 lexers:01 parsers:01 modular:01 byte:01 foo:01 baz:01 subdirectory:01 cheers:01 On 8/23/06, Renald Buter wrote: > Hello list, > > Coming from an Ant/Java world, I am usually working in projects that have the > following directory structure: > > project > |---src ("plain" source files) > |---test (unit testing) > > What would a Makefile (possibly using OCamlMakefile) or OMakefile look > like that would allow me to: > > 1. 'make XXX.ml' to compile XXX.ml into an object file > 2. 'make some-target' to build the executable some-target, depending on > given object files > 3. 'make test' to build the test suite, depending on object files in > the 'src' directory. > > Any help is much appreciated! I'm somewhat experienced with OMake for small projects, so I'll try to help with that. You have lots of options, depending on if you want a single OMakefile or one in each subdirectory, whether or not you're using lexers and parsers, how modular you want things to be, and so on. To give you some idea, a quick single-file OMakefile like this in the root directory would probably work. ######## .PHONY all test NATIVE_ENABLED = true BYTE_ENABLED = false .SUBDIRS src FILES = foo bar bat baz OCamlProgram(some-target, $(FILES)) all: some-target targetExe = $(file src/some-target$(EXE)) .SUBDIRS test test1: $(targetExe) $(targetExe) ./test1-input > ./test1-output test: test1 ######## If you want an OMakefile in each subdirectory, just cut the bodies of the .SUBDIRS blocks and put them into the corresponding OMakefile's, then use a single .SUBDIRS line like this: .SUBDIRS src test I'm sure there are others on this list with more OMake experience, so if I've got something wrong please speak up! Cheers, -n8 -- >>>-- Nathaniel Gray -- Caltech Computer Science ------> >>>-- Mojave Project -- http://mojave.cs.caltech.edu -->