From: Michael Ekstrand <michael@elehack.net>
To: caml-list@inria.fr
Subject: Re: Building multiple configurations?
Date: Mon, 22 Mar 2010 20:37:34 -0500 [thread overview]
Message-ID: <ho960u$b9v$1@dough.gmane.org> (raw)
In-Reply-To: <4BA80CB5.4080402@grant-olson.net>
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
next prev parent reply other threads:[~2010-03-23 1:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-23 0:35 Grant Olson
2010-03-23 1:13 ` [Caml-list] " Yoann Padioleau
2010-03-23 1:32 ` Grant Olson
2010-03-23 1:56 ` Yoann Padioleau
2010-03-23 3:06 ` Grant Olson
2010-03-23 1:37 ` Michael Ekstrand [this message]
2010-03-23 1:47 ` [Caml-list] " Grant Olson
2010-03-23 8:54 ` Daniel Bünzli
2010-03-23 5:50 ` [Caml-list] " Martin Jambon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='ho960u$b9v$1@dough.gmane.org' \
--to=michael@elehack.net \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).