Makefile 3.98 KB
Newer Older
1
2
3
4
5
6
DEBUG = -g
OCAMLCP = ocamlc
OCAMLC = ocamlfind $(OCAMLCP) -package $(PACKAGES)
OCAMLOPT = ocamlfind ocamlopt -inline 25 -package $(PACKAGES)
# extra options:  
#    -p (profiling)
7

8
PACKAGES = "pxp-engine pxp-lex-iso88591 wlexing camlp4 num,cgi"
9

10
DISTRIB = $(DIRS) tools web depend INSTALL Makefile
11

12
all: cduce.opt dtd2cduce web/files
13

14
# Source directories 
15

16
17
DIRS = misc parser typing types runtime driver
CLEAN_DIRS = $(DIRS) tools tests
18

19
# Objects to build
20

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
OBJECTS = \
 misc/state.cmo misc/pool.cmo misc/encodings.cmo misc/bool.cmo \
 misc/pretty.cmo \
 \
 types/sortedList.cmo types/boolean.cmo types/ident.cmo \
 types/intervals.cmo types/chars.cmo types/atoms.cmo types/normal.cmo \
 types/types.cmo types/patterns.cmo types/sequence.cmo types/builtin.cmo \
 \
 parser/location.cmo parser/wlexer.cmo parser/ast.cmo parser/parser.cmo \
 \
 typing/typed.cmo typing/typer.cmo \
 \
 runtime/value.cmo runtime/load_xml.cmo runtime/run_dispatch.cmo \
 runtime/print_xml.cmo runtime/eval.cmo \
 \
 driver/cduce.cmo

CDUCE = $(OBJECTS) driver/run.cmo
WEBIFACE  = $(OBJECTS) driver/examples.cmo driver/webiface.cmo
40
41

XCDUCE = $(CDUCE:.cmo=.cmx)
42
XWEBIFACE =  $(WEBIFACE:.cmo=.cmx)
43

44
45
46
47
48
49
DEPEND = $(DIRS:=/*.ml) $(DIRS:=/*.mli)
INCLUDES = $(DIRS:%=-I %)

SYNTAX = camlp4o pa_extend.cmo
SYNTAX_PARSER = -pp '$(SYNTAX)'
PREPRO = $(SYNTAX) pr_o.cmo
50

51
cduce: $(CDUCE)
52
	$(OCAMLC) $(DEBUG) -linkpkg -o $@ gramlib.cma $^
53

54
webiface: $(WEBIFACE)
55
	$(OCAMLC) $(DEBUG) -linkpkg -o $@ gramlib.cma $^
56

57
dtd2cduce: tools/dtd2cduce.cmo
58
	$(OCAMLC) $(DEBUG) -linkpkg -o $@ $^
59

60
cduce.opt: $(XCDUCE)
61
	$(OCAMLOPT) -linkpkg -o $@ gramlib.cmxa $^
62

63
webiface.opt: $(XWEBIFACE)
64
	$(OCAMLOPT) -linkpkg -o $@ gramlib.cmxa $^
65

66
67
compute_depend:
	@echo "Computing dependencies ..."
68
	ocamldep $(INCLUDES) $(SYNTAX_PARSER) $(DEPEND) > depend
69

70
71
72
parser/wlexer.ml: parser/wlexer.mll
	wlex parser/wlexer.mll

73
clean:
74
	for i in $(CLEAN_DIRS); do \
75
76
	(cd $$i; rm -f *.cmi *.cmo *.cma *.cmx *.o *~); \
	done
77
	rm -f parser/wlexer.ml
78
	rm -f *.cmi *.cmo *.cma *.cmx *.a *.cmxa *.o *~
79
	rm -f cduce cduce.opt webiface.opt ocamlprof.dump
80
	rm -f dtd2cduce pool webiface
81
	rm -Rf prepro package
82
	rm -f web/*.php web/*~
83

84
85
86
87

.SUFFIXES: .ml .mli .cmo .cmi .cmx

.ml.cmo:
88
89
	$(OCAMLC) $(DEBUG) -c $(SYNTAX_PARSER) $(INCLUDES) $<

90
.ml.cmx:
91
	$(OCAMLOPT) -c $(SYNTAX_PARSER) $(INCLUDES) $<
92
93

.mli.cmi:
94
	$(OCAMLC) $(DEBUG) -c $(SYNTAX_PARSER) $(INCLUDES) $<
95

96
include depend
97

98
# CDuce-generated files
99

100
101
driver/examples.ml: cduce.opt web/examples/build.cd web/examples/examples.xml
	(cd web/examples; ../../cduce.opt -quiet build.cd)
102

103
web/files: cduce.opt web/site.cd
104
	(cd web; ../cduce.opt -quiet site.cd -- site.xml)
105

106
# Packaging
107
108
109
110
111
112
113

write_header:
	headache -h header $(DEPEND)

remove_header:
	headache -r $(DEPEND)

114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# 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

profile:
	rm -Rf prepro
	mkdir prepro
	for i in $(DIRS); do \
	mkdir prepro/$$i; \
	for j in $$i/*.ml $$i/*.mli; do \
	if [ -f "$$j" ]; then \
	 echo $$j; \
	 $(PREPRO) $$j -o prepro/$$j; \
	fi; \
	done; \
	done
	cp parser/wlexer.mll prepro/parser/
	cp Makefile depend prepro/
	(cd prepro;  make cduce OCAMLCP="ocamlcp -p a" SYNTAX_PARSER=)

144
145
# Site-specific installation
build_web:
146
	rsh cedre ". .env; cd IMPLEM/CDUCE; make webiface.opt"
147
install_web:
148
	ssh cduce@iris.ens.fr "cp ~frisch/IMPLEM/CDUCE/webiface.opt cgi-bin/cduce; chmod +s cgi-bin/cduce"
149
install_web_local:
150
	ssh root@localhost "cp -f ~beppe/IMPLEM/CDUCE/webiface.opt /var/www/cgi-bin/cduce; cp -f ~beppe/IMPLEM/CDUCE/web/*.php /var/www/html/; chmod +s /var/www/cgi-bin/cduce;"
151
152

build_website:
153
	rsh cedre ". .env; cd IMPLEM/CDUCE; make web/files"
154
	scp web/*.php web/cduce.css cduce@iris:public_html/
155

156
157
build_website_local: web/files
	scp web/*.php web/cduce.css cduce@iris:public_html/
158
159
160
161
162
163
164
165

# Distribution

.PHONY: package
package:
	rm -Rf package
	mkdir package
	cp -R $(DISTRIB) package/