* ocamlfind + ocamldep + camlp4?
@ 2005-12-05 22:08 Martin Jambon
2005-12-06 8:00 ` [Caml-list] " Alain Frisch
2005-12-06 8:10 ` Gerd Stolpmann
0 siblings, 2 replies; 4+ messages in thread
From: Martin Jambon @ 2005-12-05 22:08 UTC (permalink / raw)
To: caml-list
Hello,
I would like to know if there is a way of using ocamlfind as front-end to
camlp4o alone. Let me explain: the following works nicely since it will
locate the pa_someext package and load its dependencies:
ocamlfind ocamlc -c -syntax camlp4o -package pa_someext file.ml
but how to tell ocamldep to preprocess file.ml using camlp4o and the
wanted syntax modules, without listing all the include directories and
dependencies?
OCamlMakefile solves this by reading the first line of the OCaml files.
That works, but ocamlfind doesn't help here, so all directories of the
camlp4 extensions (direct + dependent) must be specified, which is
impractical. That would be something like:
(*pp ./pp-command *)
where pp-command would be:
#!/bin/sh
camlp4o
-I /path/to/lib1 lib1.cma \
-I /path/to/lib2 lib2.cma \
-I /path/to/pa_someext pa_someext.cmo $*
where lib1 and lib2 are required by pa_someext.
Instead, it would be nice to write only:
(*pp ocamlfind camlp4o -package pa_someext *)
Thanks,
Martin
--
Martin Jambon, PhD
http://martin.jambon.free.fr
Store and share your bioinformatics tips at http://wikiomics.org
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] ocamlfind + ocamldep + camlp4?
2005-12-05 22:08 ocamlfind + ocamldep + camlp4? Martin Jambon
@ 2005-12-06 8:00 ` Alain Frisch
2005-12-06 8:10 ` Gerd Stolpmann
1 sibling, 0 replies; 4+ messages in thread
From: Alain Frisch @ 2005-12-06 8:00 UTC (permalink / raw)
To: Martin Jambon; +Cc: caml-list
Martin Jambon wrote:
> Hello,
>
> I would like to know if there is a way of using ocamlfind as front-end
> to camlp4o alone. Let me explain: the following works nicely since it
> will locate the pa_someext package and load its dependencies:
>
> ocamlfind ocamlc -c -syntax camlp4o -package pa_someext file.ml
>
> but how to tell ocamldep to preprocess file.ml using camlp4o and the
> wanted syntax modules, without listing all the include directories and
> dependencies?
Doesn't
ocamlfind ocamldep -syntax camlp4o -package pa_someext ...
do what you want? Is your question about using a different set of
extensions for each file?
-- Alain
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] ocamlfind + ocamldep + camlp4?
2005-12-05 22:08 ocamlfind + ocamldep + camlp4? Martin Jambon
2005-12-06 8:00 ` [Caml-list] " Alain Frisch
@ 2005-12-06 8:10 ` Gerd Stolpmann
2005-12-06 21:33 ` Martin Jambon
1 sibling, 1 reply; 4+ messages in thread
From: Gerd Stolpmann @ 2005-12-06 8:10 UTC (permalink / raw)
To: Martin Jambon; +Cc: caml-list
Am Montag, den 05.12.2005, 14:08 -0800 schrieb Martin Jambon:
> Hello,
>
> I would like to know if there is a way of using ocamlfind as front-end to
> camlp4o alone. Let me explain: the following works nicely since it will
> locate the pa_someext package and load its dependencies:
>
> ocamlfind ocamlc -c -syntax camlp4o -package pa_someext file.ml
>
> but how to tell ocamldep to preprocess file.ml using camlp4o and the
> wanted syntax modules, without listing all the include directories and
> dependencies?
Why not
ocamlfind ocamldep -syntax camlp4o -package pa_someext *.ml
?
You can also get the options for camlp4o using:
P4_PKG = "pa_someext"
P4_I_OPTIONS = $(shell ocamlfind query -predicates "syntax,preprocessor,camlp4o" \
$(P4_PKG) -i-format)
P4_A_OPTIONS = $(shell ocamlfind query -predicates "syntax,preprocessor,camlp4o" \
$(P4_PKG) -a-format)
then
camlp4 $(P4_I_OPTIONS) $(P4_A_OPTIONS)
should work.
Gerd
>
> OCamlMakefile solves this by reading the first line of the OCaml files.
> That works, but ocamlfind doesn't help here, so all directories of the
> camlp4 extensions (direct + dependent) must be specified, which is
> impractical. That would be something like:
> (*pp ./pp-command *)
>
> where pp-command would be:
> #!/bin/sh
> camlp4o
> -I /path/to/lib1 lib1.cma \
> -I /path/to/lib2 lib2.cma \
> -I /path/to/pa_someext pa_someext.cmo $*
>
> where lib1 and lib2 are required by pa_someext.
>
> Instead, it would be nice to write only:
>
> (*pp ocamlfind camlp4o -package pa_someext *)
>
>
> Thanks,
>
> Martin
>
> --
> Martin Jambon, PhD
> http://martin.jambon.free.fr
>
> Store and share your bioinformatics tips at http://wikiomics.org
>
> _______________________________________________
> 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
>
--
------------------------------------------------------------
Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany
gerd@gerd-stolpmann.de http://www.gerd-stolpmann.de
Telefon: 06151/153855 Telefax: 06151/997714
------------------------------------------------------------
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] ocamlfind + ocamldep + camlp4?
2005-12-06 8:10 ` Gerd Stolpmann
@ 2005-12-06 21:33 ` Martin Jambon
0 siblings, 0 replies; 4+ messages in thread
From: Martin Jambon @ 2005-12-06 21:33 UTC (permalink / raw)
To: Gerd Stolpmann; +Cc: Alain Frisch, Martin Jambon, caml-list
On Tue, 6 Dec 2005, Gerd Stolpmann wrote:
> Am Montag, den 05.12.2005, 14:08 -0800 schrieb Martin Jambon:
>> Hello,
>>
>> I would like to know if there is a way of using ocamlfind as front-end to
>> camlp4o alone. Let me explain: the following works nicely since it will
>> locate the pa_someext package and load its dependencies:
>>
>> ocamlfind ocamlc -c -syntax camlp4o -package pa_someext file.ml
>>
>> but how to tell ocamldep to preprocess file.ml using camlp4o and the
>> wanted syntax modules, without listing all the include directories and
>> dependencies?
>
> Why not
>
> ocamlfind ocamldep -syntax camlp4o -package pa_someext *.ml
>
> ?
>
> You can also get the options for camlp4o using:
>
> P4_PKG = "pa_someext"
> P4_I_OPTIONS = $(shell ocamlfind query -predicates "syntax,preprocessor,camlp4o" \
> $(P4_PKG) -i-format)
> P4_A_OPTIONS = $(shell ocamlfind query -predicates "syntax,preprocessor,camlp4o" \
> $(P4_PKG) -a-format)
>
> then
>
> camlp4 $(P4_I_OPTIONS) $(P4_A_OPTIONS)
>
> should work.
Thanks a lot Gerd (and Alain).
I was really looking for a simple way of performing source-to-source
conversion of OCaml code, from the command-line. So that really helps, and
I derived a shell-script which provides such a command:
http://martin.jambon.free.fr/camlp4find
Martin
--
Martin Jambon, PhD
http://martin.jambon.free.fr
Store and share your bioinformatics tips at http://wikiomics.org
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-12-06 21:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-05 22:08 ocamlfind + ocamldep + camlp4? Martin Jambon
2005-12-06 8:00 ` [Caml-list] " Alain Frisch
2005-12-06 8:10 ` Gerd Stolpmann
2005-12-06 21:33 ` Martin Jambon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox