* [Caml-list] pre-process myocamlbuild.ml with ocamlbuild ...
@ 2015-06-30 17:08 Pietro Abate
2015-06-30 18:03 ` ygrek
0 siblings, 1 reply; 4+ messages in thread
From: Pietro Abate @ 2015-06-30 17:08 UTC (permalink / raw)
To: caml-list
Hi all,
maybe, not the best subject of the week, I know . I'd like to
pre-process the file myocamlbuild.ml with cppo before building it. The
reason is that I have a few unused ocamlbuild tags in my _tags file
(that is auto generated by a script ...), and I'd like to remove all
warnings using
#ifdef OCAML4022
Ocamlbuild_pack.Flags.mark_tag_used "use_" ;;
Ocamlbuild_pack.Flags.mark_tag_used "pkg_" ;;
Ocamlbuild_pack.Flags.mark_tag_used "link_" ;;
#endif
The problem is that Ocamlbuild_pack.Flags.mark_tag_used exists only
with ocamlbuild < 4.02 .
my naive idea is to pass ocamlbuild a preprocessing tag of the form
-plugin-tag "pp(cppo)" and then let it handle the rest.
But apparently this does not work. How can I convince ocamlbuild to
build my plugin using a preprocessing step ?
Instead of this :
e$ocamlbuild
+ /usr/bin/ocamlopt.opt unix.cmxa -I /usr/lib/ocaml/ocamlbuild /usr/lib/ocaml/ocamlbuild/ocamlbuildlib.cmxa myocamlbuild.ml /usr/lib/ocaml/ocamlbuild/ocamlbuild.cmx -o myocamlbuild
File "myocamlbuild.ml", line 5, characters 0-1:
Error: Syntax error
I'd like to build it as :
$/usr/bin/ocamlopt.opt unix.cmxa -I /usr/lib/ocaml/ocamlbuild /usr/lib/ocaml/ocamlbuild/ocamlbuildlib.cmxa -pp "cppo" myocamlbuild.ml /usr/lib/ocaml/ocamlbuild/ocamlbuild.cmx -o myocamlbuild
what is the magic ocamlbuild incantation ? Or alternatively, Do you
see another solution to my small problem ?
thanks,
p
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] pre-process myocamlbuild.ml with ocamlbuild ...
2015-06-30 17:08 [Caml-list] pre-process myocamlbuild.ml with ocamlbuild Pietro Abate
@ 2015-06-30 18:03 ` ygrek
2015-06-30 20:12 ` Pietro Abate
0 siblings, 1 reply; 4+ messages in thread
From: ygrek @ 2015-06-30 18:03 UTC (permalink / raw)
To: caml-list
Hi,
Probably you are not calling ocamlbuild directly, but through make or shell script, so just put
preprocessing step there to generate real myocamlbuild.ml
--
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] pre-process myocamlbuild.ml with ocamlbuild ...
2015-06-30 18:03 ` ygrek
@ 2015-06-30 20:12 ` Pietro Abate
2015-06-30 20:20 ` ygrek
0 siblings, 1 reply; 4+ messages in thread
From: Pietro Abate @ 2015-06-30 20:12 UTC (permalink / raw)
To: caml-list
On 30/06/15 11:03, ygrek wrote:
> Probably you are not calling ocamlbuild directly, but through make or shell script, so just put
> preprocessing step there to generate real myocamlbuild.ml
You are suggesting something along these lines :
-------------- Makefile snippet
ocamlbuild:
mkdir -p _build
cp myocamlbuild.ml _build
cd _build ; /usr/bin/ocamlopt.opt unix.cmxa -I /usr/lib/ocaml/ocamlbuild /usr/lib/ocaml/ocamlbuild/ocamlbuildlib.cmxa -pp "cppo -D OCAML4022" myocamlbuild.ml /usr/lib/ocaml/ocamlbuild/ocamlbuild.cmx -o myocamlbuild
cd ..
OCAMLBUILD=_build/myocamlbuild
all: ocamlbuild
everything else ...
------------- Makefile snippet
Yes, your solution works, but it's extremely hackish !
I was hoping for something more clean. Is it possible to
accomplish this with ocamlbuild ?
p
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] pre-process myocamlbuild.ml with ocamlbuild ...
2015-06-30 20:12 ` Pietro Abate
@ 2015-06-30 20:20 ` ygrek
0 siblings, 0 replies; 4+ messages in thread
From: ygrek @ 2015-06-30 20:20 UTC (permalink / raw)
To: caml-list
On Tue, 30 Jun 2015 22:12:02 +0200
Pietro Abate <Pietro.Abate@pps.univ-paris-diderot.fr> wrote:
> On 30/06/15 11:03, ygrek wrote:
> > Probably you are not calling ocamlbuild directly, but through make or shell script, so just put
> > preprocessing step there to generate real myocamlbuild.ml
>
> You are suggesting something along these lines :
No, I thought of something like:
myocamlbuild.ml: myocamlbuild.ml.pp
cppo $< -o $@
build: myocamlbuild.ml
ocamlbuild ...
--
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-06-30 20:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-30 17:08 [Caml-list] pre-process myocamlbuild.ml with ocamlbuild Pietro Abate
2015-06-30 18:03 ` ygrek
2015-06-30 20:12 ` Pietro Abate
2015-06-30 20:20 ` ygrek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox