From: Gregory Malecha <gmalecha@cs.harvard.edu>
To: caml-list@inria.fr
Subject: [Caml-list] ocamlbuild plugins and external libraries
Date: Tue, 10 Dec 2013 17:20:42 -0500 [thread overview]
Message-ID: <CAGraiHJiA5mG8HGz8ShjmPgaOXsydpgPK6Orbamu4tnx9cBy3g@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1456 bytes --]
Hello --
I have several ocamlbuild plugins that are very similar and I'm trying to
figure out how to refactor them. I pulled out a bunch of definitions into
another file (coq_paths.ml) and then said 'open Coq_paths' in '
myocamlbuild.ml'. But when I do this, ocamlbuild can no longer build the
plugin, not even if foo.cmo already exists in the _build directory.
After hacking on this for a long time (and digging through the ocamlbuild
sources) I found that you can write a Makefile that will build
myocamlbuild.cmo using ocamlbuild without a plugin, and then manually link
this against ocamlbuild.cmo and to produce a custom version of ocamlbuild
that uses the plugin (this is exactly what ocamlbuild does). My question
is: 'is there any nicer way to do this?' I'm including my Makefile below:
OCAMLBUILDDIR=$(shell ocamlfind query ocamlbuild)
all: _build/coq_builder
@ ./_build/coq_builder -no-plugin coq.otarget
_build/coq_builder: myocamlbuild.ml coq_paths.ml
@ echo "building builder...."
@ ocamlbuild -cflags -I,`ocamlfind query ocamlbuild` -no-plugin
myocamlbuild.cmo
@ ocamlc.opt unix.cma -I $(OCAMLBUILDDIR)
$(OCAMLBUILDDIR)/ocamlbuildlib.cma \
_build/coq_paths.cmo _build/myocamlbuild.cmo \
$(OCAMLBUILDDIR)/ocamlbuild.cmo -o _build/coq_builder
@ echo "done"
clean:
ocamlbuild -clean
Thanks in advance.
--
gregory malecha
http://www.people.fas.harvard.edu/~gmalecha/
[-- Attachment #2: Type: text/html, Size: 2863 bytes --]
next reply other threads:[~2013-12-10 22:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-10 22:20 Gregory Malecha [this message]
2013-12-11 6:03 ` Gabriel Scherer
2013-12-11 20:27 ` Gregory Malecha
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=CAGraiHJiA5mG8HGz8ShjmPgaOXsydpgPK6Orbamu4tnx9cBy3g@mail.gmail.com \
--to=gmalecha@cs.harvard.edu \
--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