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

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

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

12
all: cduce.opt dtd2cduce local_website
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
77
	(cd $$i; rm -f *.cmi *.cmo *.cma *.cmx *.o *~); \
	done
	rm -f *.cmi *.cmo *.cma *.cmx *.a *.cmxa *.o *~
78
	rm -f cduce cduce.opt webiface.opt ocamlprof.dump
79
	rm -f dtd2cduce pool webiface
80
	rm -Rf prepro package
81
	rm -f web/*.php web/*.html web/*~
82

83
84
85
86

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

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

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

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

95
include depend
96

97
# CDuce-generated files
98

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

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

105
# Packaging
106
107
108
109
110
111
112

write_header:
	headache -h header $(DEPEND)

remove_header:
	headache -r $(DEPEND)

113
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
# 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=)

143
# Site-specific installation
144
145
146

cedre_build:
	rsh cedre ". .env; cd IMPLEM/CDUCE; make webiface.opt; make web/files"
147
install_web:
148
149
150
151
	scp web/*.php web/cduce.css cduce@iris:public_html/
	scp webiface.opt cduce@iris:cgi-bin/cduce
	ssh cduce@iris "chmod +s cgi-bin/cduce"

152
install_web_local:
153
	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;"
154

155
website: web/files
156
	scp web/*.php web/cduce.css cduce@iris:public_html/
157

158
159
160
local_website: cduce.opt webiface.opt
	(cd web; ../cduce.opt -quiet site.cd -- site.xml)

161
162
163
164
165
166
167
# Distribution

.PHONY: package
package:
	rm -Rf package
	mkdir package
	cp -R $(DISTRIB) package/
168
169
	(cd package; headache -h ../header $(DEPEND))