caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Building multiple configurations?
@ 2010-03-23  0:35 Grant Olson
  2010-03-23  1:13 ` [Caml-list] " Yoann Padioleau
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Grant Olson @ 2010-03-23  0:35 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-03-23  8:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-23  0:35 Building multiple configurations? 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
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

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).