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 mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id F0709BBAF for ; Tue, 23 Mar 2010 01:35:09 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqgCAFapp0vRVdK1kGdsb2JhbACTJYd9CBUBAQEBCQkMBxMDH74AhH0E X-IronPort-AV: E=Sophos;i="4.51,291,1267398000"; d="scan'208";a="59526793" Received: from mail-yx0-f181.google.com ([209.85.210.181]) by mail4-smtp-sop.national.inria.fr with ESMTP; 23 Mar 2010 01:35:09 +0100 Received: by yxe11 with SMTP id 11so1886037yxe.1 for ; Mon, 22 Mar 2010 17:35:08 -0700 (PDT) Received: by 10.150.47.19 with SMTP id u19mr6157187ybu.160.1269304508566; Mon, 22 Mar 2010 17:35:08 -0700 (PDT) Received: from [192.168.1.182] (pool-71-182-209-171.pitbpa.east.verizon.net [71.182.209.171]) by mx.google.com with ESMTPS id d2sm2005967ibr.15.2010.03.22.17.35.06 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 22 Mar 2010 17:35:07 -0700 (PDT) Message-ID: <4BA80CB5.4080402@grant-olson.net> Date: Mon, 22 Mar 2010 20:35:01 -0400 From: Grant Olson Reply-To: kgo@grant-olson.net User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 MIME-Version: 1.0 To: caml-list@inria.fr Subject: Building multiple configurations? X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; runtime:01 ifdef:01 ifdef:01 sub-module:01 -impl:01 -impl:01 ocamlopt:01 config:01 config:01 compile:01 linking:02 seems:03 module:03 module:03 fails:05 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 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. What I'm doing now is using the -impl flag. I've got two files: config.ml, and config.alt. The second version builds with "-impl config.alt" in the list of files passed to ocamlopt instead of "config.ml" This works, but it just seems wrong. Is there a better way for me to do this? -Grant