Makefile 4.38 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
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
53
54
55

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

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

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

60
all.cmxa: $(XOBJECTS)
61
	$(OCAMLOPT) -a -o $@ $(XOBJECTS)
62
63


64
65
66
67
68
69
70
71
72
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

73
74
75
memento.html: cduce tests/memento.cd tests/memento.xml
	./cduce -quiet tests/memento.cd

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

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

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


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

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

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

95
96
compute_depend:
	@echo "Computing dependencies ..."
97
	ocamldep $(INCLUDES) $(SYNTAX_PARSER) $(DEPEND) > depend
98

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

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

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

116
117
118

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

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

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

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

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

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

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

152
include depend
153
154


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

158
web/index.html: cduce web/macros.cd web/index.xml
159
	(cd web; ../cduce -quiet macros.cd)
160

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

build_website:
	rsh cedre ". .env; cd IMPLEM/CDUCE; make web/index.html"
171
	scp web/index.html web/cduce.css cduce@iris:public_html/
172
173