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 374D8BBAF for ; Tue, 23 Mar 2010 02:13:58 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkYDAPOyp0tQDPIagmdsb2JhbACPHIwOFQEBCwsIBxUDH710hH0Egx4 X-IronPort-AV: E=Sophos;i="4.51,291,1267398000"; d="scan'208";a="59527574" Received: from smtp20.orange.fr ([80.12.242.26]) by mail4-smtp-sop.national.inria.fr with ESMTP; 23 Mar 2010 02:13:57 +0100 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2026.orange.fr (SMTP Server) with ESMTP id A46D42000777; Tue, 23 Mar 2010 02:13:57 +0100 (CET) Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2026.orange.fr (SMTP Server) with ESMTP id 9543E200086F; Tue, 23 Mar 2010 02:13:57 +0100 (CET) Received: from [192.168.1.102] (c-67-188-233-64.hsd1.ca.comcast.net [67.188.233.64]) by mwinf2026.orange.fr (SMTP Server) with ESMTP id A79FA2000781; Tue, 23 Mar 2010 02:13:56 +0100 (CET) X-ME-UUID: 20100323011356686.A79FA2000781@mwinf2026.orange.fr X-ME-User-Auth: padator@wanadoo.fr Subject: Re: [Caml-list] Building multiple configurations? Mime-Version: 1.0 (Apple Message framework v1077) Content-Type: text/plain; charset=us-ascii From: Yoann Padioleau In-Reply-To: <4BA80CB5.4080402@grant-olson.net> Date: Mon, 22 Mar 2010 18:13:54 -0700 Cc: caml-list@inria.fr Content-Transfer-Encoding: quoted-printable Message-Id: References: <4BA80CB5.4080402@grant-olson.net> To: kgo@grant-olson.net X-Mailer: Apple Mail (2.1077) X-Spam: no; 0.00; runtime:01 flags:01 ifdef:01 ifdef:01 dependencies:01 sub-module:01 -impl:01 -impl:01 ocamlopt:01 beginner's:01 ocaml:01 bug:01 config:01 config:01 beginners:01 On Mar 22, 2010, at 5:35 PM, Grant Olson wrote: >=20 > I'm doing something weird here and I'm thinking there has to be a = better > way. >=20 > 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. Why ? Why ? Why not having your app configurable with a txt file or some command line flags like every other programs ? >=20 > Basically, I want to do the same thing as a C #ifdef: >=20 > #ifdef VERSION2 > ... include version one > #else > ... include version two > #endif People use that because they want to do different things depending on = the architecture, or if some dependencies are present or not. Do you have the same = requirement here ? >=20 > 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. >=20 > 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. >=20 > 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" >=20 > This works, but it just seems wrong. Is there a better way for me to = do > this? >=20 > -Grant >=20 > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >=20