Makefile 4.29 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

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
compute_depend:
	@echo "Computing dependencies ..."
98
	ocamldep $(INCLUDES) $(SYNTAX_PARSER) $(DEPEND) > depend
99

100
101
102
parser/wlexer.ml: parser/wlexer.mll
	wlex parser/wlexer.mll

103
run_top: all.cma
104
	ledit ocaml $(INCLUDES) `ocamlfind use pxp` all.cma
105
106

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

117
118
119

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

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

136
.ml.cmo:
137
138
	$(OCAMLC) $(DEBUG) -c $(SYNTAX_PARSER) $(INCLUDES) $<

139
.ml.cmx:
140
	$(OCAMLOPT) -c $(SYNTAX_PARSER) $(INCLUDES) $<
141
142

.mli.cmi:
143
	$(OCAMLC) $(DEBUG) -c $(SYNTAX_PARSER) $(INCLUDES) $<
144
145

# FORTPATH = /users/formel8/frisch/solaris/fort/fort
146
147
148
#FORTPATH = /home/frisch/fort
#FORTBIN = $(FORTPATH)/fort
#FORTLIB = $(FORTPATH)
149
150

test: all.cma
151
	fort all.cma $(INCLUDES) tests/test_fort.ml
152

153
include depend
154
155


156
157
158
driver/examples.ml: cduce tests/web.cd tests/examples.xml
	./cduce -quiet tests/web.cd

159

160
web/files: cduce.opt web/site.cd
161
	(cd web; ../cduce.opt -quiet site.cd)
162

163
164
# Site-specific installation
build_web:
165
	rsh cedre ". .env; cd IMPLEM/CDUCE; make webiface"
166
install_web:
167
	ssh cduce@iris.ens.fr "cp ~frisch/IMPLEM/CDUCE/webiface cgi-bin/cduce2; cp ~frisch/IMPLEM/CDUCE/memento.html public_html/; chmod +s cgi-bin/cduce2"
168
install_web_local:
169
	ssh root@localhost "cp ~beppe/IMPLEM/CDUCE/webiface /var/www/cgi-bin/cduce; cp ~beppe/IMPLEM/CDUCE/web/*.php /var/www/html/; chmod +s /var/www/cgi-bin/cduce;"
170
171

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