Makefile 4.57 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 9
MISC = misc/state.cmo misc/pool.cmo misc/encodings.cmo misc/bool.cmo \
	misc/pretty.cmo
10

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

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

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

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

32 33
DRIVER = driver/cduce.cmo

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

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

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

44 45

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

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

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

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

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


69 70 71 72 73 74 75 76 77
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

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

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

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


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

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

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

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

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

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

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

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

121 122 123

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

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

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

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

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

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

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

157
include depend
158 159


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

163

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

167 168 169 170 171 172 173

write_header:
	headache -h header $(DEPEND)

remove_header:
	headache -r $(DEPEND)

174 175
# Site-specific installation
build_web:
176
	rsh cedre ". .env; cd IMPLEM/CDUCE; make webiface.opt"
177
install_web:
178
	ssh cduce@iris.ens.fr "cp ~frisch/IMPLEM/CDUCE/webiface.opt cgi-bin/cduce; chmod +s cgi-bin/cduce"
179
install_web_local:
180
	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;"
181 182

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

186 187
build_website_local: web/files
	scp web/*.php web/cduce.css cduce@iris:public_html/