Makefile 4.5 KB
Newer Older
1
2
# Source directories 

3
DIRS = misc parser typing types runtime driver toplevel
4
CLEAN_DIRS = $(DIRS) tools tests
5
6

# Objects to build
7

8
MISC = misc/state.cmo misc/pool.cmo misc/encodings.cmo misc/bool.cmo
9

10
11
12
PARSER = parser/lexer.cmo parser/location.cmo \
         parser/wlexer.cmo \
         parser/ast.cmo parser/parser.cmo
13

14
TYPING = typing/typed.cmo typing/typer.cmo
15

16
TYPES  = \
17
         types/sortedList.cmo types/sortedMap.cmo types/boolean.cmo \
18
	 types/ident.cmo \
19
         types/intervals.cmo types/chars.cmo types/atoms.cmo \
20
	 types/normal.cmo \
21
         types/types.cmo \
22
         types/patterns.cmo \
23
24
	 types/sequence.cmo \
	 types/builtin.cmo
25

26
27
RUNTIME = runtime/value.cmo \
          runtime/load_xml.cmo runtime/run_dispatch.cmo \
28
          runtime/print_xml.cmo \
29
          runtime/eval.cmo
30

31
32
DRIVER = driver/cduce.cmo

33
OBJECTS = $(MISC) $(TYPES) $(PARSER) $(TYPING) $(RUNTIME)
34
35

CDUCE = $(OBJECTS) $(DRIVER) driver/run.cmo
36
WEBIFACE  = $(OBJECTS) $(DRIVER) driver/examples.cmo driver/webiface.cmo
37
38
TOPLEVEL = $(OBJECTS) toplevel/toploop.cmo

39
XOBJECTS = $(OBJECTS:.cmo=.cmx)
40
XCDUCE = $(CDUCE:.cmo=.cmx)
41
XWEBIFACE =  $(WEBIFACE:.cmo=.cmx)
42

43
44

DEBUG = -g
45
PACKAGES = pxp-engine,pxp-lex-iso88591,wlexing,camlp4,num,cgi
46
47
OCAMLCP = ocamlc
OCAMLC = ocamlfind $(OCAMLCP) -package $(PACKAGES)
48
OCAMLOPT = ocamlfind ocamlopt -package $(PACKAGES)
49
50
51
52
# extra options:  
#    -inline 25 
#    -p (profiling)
#    -noassert
53
54
55
56
57
58
59

DEPEND = $(DIRS:=/*.ml) $(DIRS:=/*.mli)
INCLUDES = $(DIRS:%=-I %)

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

all.cma: $(OBJECTS)
62
	$(OCAMLC) $(DEBUG) -o $@ -linkpkg gramlib.cma -a $(OBJECTS)
63

64
all.cmxa: $(XOBJECTS)
65
	$(OCAMLOPT) -a -o $@ $(XOBJECTS)
66
67


68
69
70
71
72
73
74
75
76
OCAMLDEFUN = /home/frisch/defun/bin/ocamldefun
DEFUN_FILES = $(OBJECTS:%.cmo=%)

build_defun:
	for i in $(DEFUN_FILES); do \
	$(OCAMLDEFUN) $(DIRS:%=-I defun/%) -p -d defun $$i.mli $$i.ml; \
	$(OCAMLDEFUN) $(DIRS:%=-I defun/%) -p -d defun $$i.ml; \
	done

77
78
79
cduce: $(CDUCE)
	$(OCAMLC) $(DEBUG) -linkpkg -o $@ gramlib.cma $(CDUCE)

80
toplevel.out: $(TOPLEVEL)
81
	$(OCAMLC) $(DEBUG) -linkpkg -o $@ gramlib.cma $(TOPLEVEL)
82

83
84
webiface: $(WEBIFACE)
	$(OCAMLC) $(DEBUG) -linkpkg -o $@ gramlib.cma $(WEBIFACE)
85
86


87
88
89
dtd2cduce: tools/dtd2cduce.cmo
	$(OCAMLC) $(DEBUG) -linkpkg -o $@ $<

90
91
92
pull: tools/pull.cmo
	$(OCAMLC) $(DEBUG) -linkpkg -o $@ $<

93
94
cduce.opt: $(XCDUCE)
	$(OCAMLOPT) -linkpkg -o $@ gramlib.cmxa $(XCDUCE)
95

96
97
98
webiface.opt: $(XWEBIFACE)
	$(OCAMLOPT) -linkpkg -o $@ gramlib.cmxa $(XWEBIFACE)

99
100
compute_depend:
	@echo "Computing dependencies ..."
101
	ocamldep $(INCLUDES) $(SYNTAX_PARSER) $(DEPEND) > depend
102

103
104
105
parser/wlexer.ml: parser/wlexer.mll
	wlex parser/wlexer.mll

106
run_top: all.cma
107
	ledit ocaml $(INCLUDES) `ocamlfind use pxp` all.cma
108
109

clean:
110
	for i in $(CLEAN_DIRS); do \
111
112
	(cd $$i; rm -f *.cmi *.cmo *.cma *.cmx *.o *~); \
	done
113
	rm -f parser/wlexer.ml
114
	rm -f *.cmi *.cmo *.cma *.cmx *.a *.cmxa *.o *~
115
	rm -f cduce cduce.opt webiface.opt ocamlprof.dump
116
	rm -f dtd2cduce pool webiface
117
	rm -Rf prepro
118
	rm -f web/*.php web/*~
119

120
121
122

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

123
124
125
126
127
128
129
130
131
132
133
134
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
135
	cp parser/wlexer.mll prepro/parser/
136
137
138
	cp Makefile depend prepro/
	(cd prepro;  make cduce OCAMLCP="ocamlcp -p a" SYNTAX_PARSER=)

139
.ml.cmo:
140
141
	$(OCAMLC) $(DEBUG) -c $(SYNTAX_PARSER) $(INCLUDES) $<

142
.ml.cmx:
143
	$(OCAMLOPT) -c $(SYNTAX_PARSER) $(INCLUDES) $<
144
145

.mli.cmi:
146
	$(OCAMLC) $(DEBUG) -c $(SYNTAX_PARSER) $(INCLUDES) $<
147
148

# FORTPATH = /users/formel8/frisch/solaris/fort/fort
149
150
151
#FORTPATH = /home/frisch/fort
#FORTBIN = $(FORTPATH)/fort
#FORTLIB = $(FORTPATH)
152
153

test: all.cma
154
	fort all.cma $(INCLUDES) tests/test_fort.ml
155

156
include depend
157
158


159
160
driver/examples.ml: cduce.opt web/examples/build.cd web/examples/examples.xml
	(cd web/examples; ../../cduce.opt -quiet build.cd)
161

162

163
web/files: cduce.opt web/site.cd
164
	(cd web; ../cduce.opt -quiet site.cd)
165

166
167
168
169
170
171
172

write_header:
	headache -h header $(DEPEND)

remove_header:
	headache -r $(DEPEND)

173
174
# Site-specific installation
build_web:
175
	rsh cedre ". .env; cd IMPLEM/CDUCE; make webiface.opt"
176
install_web:
177
	ssh cduce@iris.ens.fr "cp ~frisch/IMPLEM/CDUCE/webiface.opt cgi-bin/cduce; chmod +s cgi-bin/cduce"
178
install_web_local:
179
	ssh root@localhost "cp ~beppe/IMPLEM/CDUCE/webiface.opt /var/www/cgi-bin/cduce; cp ~beppe/IMPLEM/CDUCE/web/*.php /var/www/html/; chmod +s /var/www/cgi-bin/cduce;"
180
181

build_website:
182
	rsh cedre ". .env; cd IMPLEM/CDUCE; make web/files"
183
	scp web/*.php web/cduce.css cduce@iris:public_html/
184