From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 901A6BBAF for ; Tue, 23 Mar 2010 02:37:51 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkMCABu4p0tQW+UMmWdsb2JhbACbKhUBAQEBAQgLCgcTIr1fhH0Egx4 X-IronPort-AV: E=Sophos;i="4.51,291,1267398000"; d="scan'208";a="47311800" Received: from lo.gmane.org ([80.91.229.12]) by mail3-smtp-sop.national.inria.fr with ESMTP; 23 Mar 2010 02:37:51 +0100 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Ntt3x-0007c3-QM for caml-list@inria.fr; Tue, 23 Mar 2010 02:37:45 +0100 Received: from elehack.net ([216.243.177.100]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 23 Mar 2010 02:37:45 +0100 Received: from michael by elehack.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 23 Mar 2010 02:37:45 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: caml-list@inria.fr From: Michael Ekstrand Subject: Re: Building multiple configurations? Date: Mon, 22 Mar 2010 20:37:34 -0500 Message-ID: References: <4BA80CB5.4080402@grant-olson.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: elehack.net User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Lightning/1.0b1 Thunderbird/3.0.3 In-Reply-To: <4BA80CB5.4080402@grant-olson.net> X-Enigmail-Version: 1.0.1 X-Spam: no; 0.00; runtime:01 ifdef:01 ifdef:01 camlp:01 syntax:01 sub-module:01 symlink:01 config:01 wrote:01 compile:01 define:02 linking:02 module:03 module:03 macro:03 On 03/22/2010 07:35 PM, Grant Olson wrote: > I'm doing something weird here and I'm thinking there has to be a better > way. > > I've got a configuration file that's a .ml file. And I do want it to be > an .ml file that gets included at compile time, not some .txt config > file that gets read in at runtime. I'm building two different versions > of my app, with two different configurations. > > Basically, I want to do the same thing as a C #ifdef: > > #ifdef VERSION2 > ... include version one > #else > ... include version two > #endif You can get that kind of behavior, albeit in a bit more restricted fashion, with the camlp4.macro syntax extension. It provides DEFINE, IFDEF, etc. > And then the two different builds link in two different object files > that have the same interface, creating the two different versions of the > app. > > At first I thought I could write out the "module" and "module type" > stuff manually, giving the same module name in two differently named > files. But this of course creates a sub-module that isn't bound to the > right namespace, and linking fails. You could also have the two different module implementations under different names and have the build system symlink or copy the correct one in place prior to building. In OMake, this is easy with the 'ln-or-cp' command. - Michael