Version française
Home     About     Download     Resources     Contact us    
Browse thread
yet another silly question on PXP
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Paul Argentoff <argentoff@r...>
Subject: Re: [Caml-list] yet another silly question on PXP
Dear Paul Argentoff,

Let PA = "Paul Argentoff" in
  written_by PA => 

 PA> But I can't compile it with OCamlMakeFile. Is there any way to do
 PA> that?

Here's the workaround I found:

In the first line of preprocessed file I write (*pp sh pp.sh *) -- that's
OCamlMakefile standard except that I use as a preprocesssor a custom sh
script which is generated from within Makefile as a .PHONY target. Here's
an example of my Makefile fragment:

PACKS= zip \
       equeue \
       netclient \
       pxp-engine \
       pxp-ulex-utf8 \
       pxp-pp \
       annexlib \
       postgresql \
       dbi

PPPACKS= netstring \
	 pcre

USE_CAMLP4 = yes
PPLIBS = unix.cma \
	 pcre.cma \
	 netstring.cma \
	 pxp_pp.cma

PRE_TARGETS = pp.sh

.PHONY: pp.sh

pp.sh:
	echo -n "camlp4o" >pp.sh
	$(foreach pack, ${PACKS}, echo -n " -I `ocamlfind query ${pack}`" >>pp.sh;) \
	$(foreach pack, ${PPPACKS}, echo -n " -I `ocamlfind query ${pack}`" >>pp.sh;) \
	echo -n " -I `ocamlc -where`" >>pp.sh
	$(foreach lib, ${PPLIBS}, echo -n " ${lib}" >>pp.sh;) \
	echo -n " "$$\1 >>pp.sh

The latter part may not seem that elegant, but it's what I could do at last
last night after reading those gnu make manuals...

-- 
Yours truly, WBR, Paul Argentoff.
Jabber:	paul@jabber.rtelekom.ru
RIPE:	PA1291-RIPE