Commit d890640f authored by Pietro Abate's avatar Pietro Abate

[r2003-05-23 18:41:10 by cvscast] Makefile and co

Original author: cvscast
Date: 2003-05-23 18:41:11+00:00
parent ddc258c0
......@@ -54,19 +54,14 @@ Important notes:
CDuce requires a development version >= 1.1.93.
Less important:
Efficiency issues:
- OCamlnet: if you plan to load XML file with encodings other than
UTF-8, it is advised to used to CVS version of OCamlnet:
UTF-8, it is advised to use the CVS version of OCamlnet:
http://sourceforge.net/cvs/?group_id=19774
Indeed, the netconversion module in the lastest release (0.95) was
very slow, and it has been rewritten since then.
- PXP: you don't need to build all the encodings.
./configure -lexlist iso88591 -with-wlex
should be enough in general.
------------------------------------------------------------------------------
Compilation
------------------------------------------------------------------------------
......@@ -74,15 +69,33 @@ Compilation
You need a GNU Make (or equivalent) to use the Makefile from the
distribution. It defines the following goals:
- make cduce / cduce.opt
- make cduce
compiles the CDuce command line interpreter
- make dtd2cduce
compiles the dtd2cduce tools (converts DTD to CDuce types)
- make webiface / webiface.opt
- make webiface
compiles the CDuce web interface interpreter (to be used as a CGI script)
- make local_website
compiles in the web/ directory the HTML files of CDuce website
compiles in the web/www/ subdirectory the HTML files of CDuce website
(including the tutorial)
- make all
equivalent to (make cduce; make dtd2cduce; make local_website)
Makefile accepts the following options, which can take the values
true or false.
NATIVE=true : use the OCaml native code compiler (ocamlopt) to build CDuce
NATIVE=false : use the OCaml bytecode compiler (ocamlc)
default: true (the native code version is much faster)
PXP_WLEX=true : use wlex for parsing UTF-8 XML files
PXP_WLEX=false: use ocamllex for parsing UTF-8 XML files
default: false (ocamllex is faster; wlex is more compact)
E.g.:
make cduce NATIVE=false
\ No newline at end of file
DEBUG = -g
OCAMLCP = ocamlc
OCAMLC = ocamlfind $(OCAMLCP) -package $(PACKAGES)
OCAMLOPT = ocamlfind ocamlopt -package $(PACKAGES)
# extra options:
# -p (profiling)
# -inline 25
NATIVE = true
PROFILE = false
PXP_WLEX = false
PACKAGES = "pxp-engine pxp-lex-iso88591 pxp-lex-utf8 wlexing camlp4 num,cgi"
PACKAGES = -package "pxp-engine pxp-lex-iso88591 wlexing camlp4 num cgi"
ifeq ($(PXP_WLEX), true)
PACKAGES += -package pxp-wlex-utf8
else
PACKAGES += -package pxp-lex-utf8
endif
DISTRIB = $(DIRS) tools web depend INSTALL LICENSE README Makefile
SYNTAX = camlp4o pa_extend.cmo
all: cduce.opt dtd2cduce local_website
ifeq ($(PROFILE), true)
CAMLC_P = ocamlcp -p a
CAMLOPT_P = ocamlopt -p
SYNTAX_PARSER =
else
CAMLC_P = ocamlc
CAMLOPT_P = ocamlopt
SYNTAX_PARSER = -pp '$(SYNTAX)'
endif
CAMLC = ocamlfind $(CAMLC_P) $(PACKAGES)
CAMLOPT = ocamlfind $(CAMLOPT_P) $(PACKAGES)
ifeq ($(NATIVE), true)
EXTENSION = cmx
LINK = $(CAMLOPT) -linkpkg gramlib.cmxa
else
EXTENSION = cmo
LINK = $(CAMLC) -custom -linkpkg gramlib.cma
endif
all: cduce dtd2cduce local_website
# Source directories
......@@ -38,32 +60,23 @@ OBJECTS = \
CDUCE = $(OBJECTS) driver/run.cmo
WEBIFACE = $(OBJECTS) driver/examples.cmo driver/webiface.cmo
XCDUCE = $(CDUCE:.cmo=.cmx)
XWEBIFACE = $(WEBIFACE:.cmo=.cmx)
DTD2CDUCE = tools/dtd2cduce.cmo
DEPEND = $(DIRS:=/*.ml) $(DIRS:=/*.mli)
INCLUDES = $(DIRS:%=-I %)
SYNTAX = camlp4o pa_extend.cmo
SYNTAX_PARSER = -pp '$(SYNTAX)'
PREPRO = $(SYNTAX) pr_o.cmo
cduce: $(CDUCE)
$(OCAMLC) $(DEBUG) -linkpkg -o $@ gramlib.cma $^
webiface: $(WEBIFACE)
$(OCAMLC) $(DEBUG) -linkpkg -o $@ gramlib.cma $^
dtd2cduce: tools/dtd2cduce.cmo
$(OCAMLC) $(DEBUG) -linkpkg -o $@ $^
cduce: $(CDUCE:.cmo=.$(EXTENSION))
$(LINK) -o $@ $^
cduce.opt: $(XCDUCE)
$(OCAMLOPT) -linkpkg -o $@ gramlib.cmxa $^
webiface: $(WEBIFACE:.cmo=.$(EXTENSION))
$(LINK) -o $@ $^
webiface.opt: $(XWEBIFACE)
$(OCAMLOPT) -linkpkg -o $@ gramlib.cmxa $^
dtd2cduce: $(DTD2CDUCE:.cmo=.$(EXTENSION))
$(LINK) -o $@ $^
.PHONY: compute_depend
compute_depend:
@echo "Computing dependencies ..."
ocamldep $(INCLUDES) $(SYNTAX_PARSER) $(DEPEND) > depend
......@@ -76,7 +89,7 @@ clean:
(cd $$i; rm -f *.cmi *.cmo *.cma *.cmx *.o *~); \
done
rm -f *.cmi *.cmo *.cma *.cmx *.a *.cmxa *.o *~
rm -f cduce cduce.opt webiface.opt ocamlprof.dump
rm -f cduce ocamlprof.dump
rm -f dtd2cduce pool webiface
rm -Rf prepro package
rm -f web/www/*.php web/www/*.html web/*~
......@@ -85,23 +98,23 @@ clean:
.SUFFIXES: .ml .mli .cmo .cmi .cmx
.ml.cmo:
$(OCAMLC) $(DEBUG) -c $(SYNTAX_PARSER) $(INCLUDES) $<
$(CAMLC) -c $(SYNTAX_PARSER) $(INCLUDES) $<
.ml.cmx:
$(OCAMLOPT) -c $(SYNTAX_PARSER) $(INCLUDES) $<
$(CAMLOPT) -c $(SYNTAX_PARSER) $(INCLUDES) $<
.mli.cmi:
$(OCAMLC) $(DEBUG) -c $(SYNTAX_PARSER) $(INCLUDES) $<
$(CAMLC) -c $(SYNTAX_PARSER) $(INCLUDES) $<
include depend
# CDuce-generated files
driver/examples.ml: cduce.opt web/examples/build.cd web/examples/examples.xml
(cd web/examples; ../../cduce.opt -quiet build.cd)
driver/examples.ml: cduce web/examples/build.cd web/examples/examples.xml
(cd web/examples; ../../cduce -quiet build.cd)
web/files: cduce.opt web/site.cd
(cd web; ../cduce.opt -quiet site.cd -- -php site.xml)
web/files: cduce web/site.cd
(cd web; ../cduce -quiet site.cd -- -php site.xml)
# Packaging
......@@ -113,17 +126,8 @@ remove_header:
# For development
pull: tools/pull.cmo
$(OCAMLC) $(DEBUG) -linkpkg -o $@ $^
all.cma: $(OBJECTS)
$(OCAMLC) $(DEBUG) -o $@ -linkpkg gramlib.cma -a $(OBJECTS)
test: all.cma
fort all.cma -I +fort $(INCLUDES) tests/test_fort.ml
run_top: all.cma
ledit ocaml $(INCLUDES) `ocamlfind use pxp` all.cma
pull: tools/pull.$(EXTENSION)
$(LINK) -o $@ $^
profile:
rm -Rf prepro
......@@ -139,28 +143,30 @@ profile:
done
cp parser/wlexer.mll prepro/parser/
cp Makefile depend prepro/
(cd prepro; make cduce OCAMLCP="ocamlcp -p a" SYNTAX_PARSER=)
(cd prepro; make cduce PROFILE=true SYNTAX_PARSER= NATIVE=false)
# Site-specific installation
cedre_build:
rsh cedre ". .env; cd IMPLEM/CDUCE; make webiface.opt; make web/files"
rsh cedre ". .env; cd IMPLEM/CDUCE; make webiface; make web/files"
install_web:
scp web/www/*.php web/cduce.css cduce@iris:public_html/
scp webiface.opt cduce@iris:cgi-bin/cduce
scp webiface cduce@iris:cgi-bin/cduce
ssh cduce@iris "chmod +s cgi-bin/cduce"
install_web_local:
ssh root@localhost "cp -f ~beppe/IMPLEM/CDUCE/webiface.opt /var/www/cgi-bin/cduce; cp -f ~beppe/IMPLEM/CDUCE/web/www/*.php /var/www/html/; chmod +s /var/www/cgi-bin/cduce;"
ssh root@localhost "cp -f ~beppe/IMPLEM/CDUCE/webiface /var/www/cgi-bin/cduce; cp -f ~beppe/IMPLEM/CDUCE/web/www/*.php /var/www/html/; chmod +s /var/www/cgi-bin/cduce;"
website: web/files
scp web/www/*.php web/cduce.css cduce@iris:public_html/
local_website: cduce.opt webiface.opt
(cd web; ../cduce.opt -quiet site.cd -- site.xml)
local_website: cduce
(cd web; ../cduce -quiet site.cd -- site.xml)
# Distribution
DISTRIB = $(DIRS) tools web depend INSTALL CHANGES LICENSE README Makefile
.PHONY: package
package:
rm -Rf package
......
......@@ -49,7 +49,9 @@ let attrib att =
let elem tag att child =
Xml (Atom (Atoms.mk (U.mk tag)), Pair (Record (attrib att), child))
(*
class warner = object method warn w = print_endline ("PXP WARNING: " ^ w) end
*)
type token =
| Element of Value.t
......
......@@ -87,7 +87,7 @@ let import_dtd ppf name filename =
content (e # content_model)
in
let dtd = parse_dtd_entity default_config (from_file filename) in
let dtd = parse_dtd_entity { default_config with encoding = `Enc_utf8 } (from_file filename) in
Format.fprintf ppf
"(* This type has been automatically generated from %s by dtd2cduce *)@\n"
filename;
......
......@@ -94,13 +94,14 @@ let fun split_comma (String -> [String*])
The function patch_css search for the textual representation of this
element and replace it with the PHP code. **)
let css : String =
let css : Latin1 =
['<link rel="stylesheet" href="cduce.css" type="text/css">'];;
let fun protect_quote (s : String) : String =
let fun protect_quote (s : Latin1) : Latin1 =
transform s with '"' -> [ '\\"' ] | c -> [c];;
let php_css : Latin1 =
if php then
[' <?php
$browser = getenv("HTTP_USER_AGENT");
if (preg_match("/MSIE/i", "$browser")) {
......@@ -117,7 +118,8 @@ type=\\"text/css\\">";
type=\\"text/css\\">";
}
echo "$css";
?> '];;
?> ']
else css;;
(** It does not work with IE
if php then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment