Makefile 2.93 KB
Newer Older
1
2
# Source directories 

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

# Objects to build
7

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

10
PARSER = parser/lexer.cmo parser/location.cmo parser/ast.cmo parser/parser.cmo
11

12
TYPING = typing/typed.cmo typing/typer.cmo
13

14
15
16
TYPES  = types/recursive.cmo \
         types/recursive_share.cmo types/recursive_noshare.cmo \
         types/sortedList.cmo types/sortedMap.cmo types/boolean.cmo \
17
         types/intervals.cmo types/chars.cmo types/atoms.cmo \
18
         types/types.cmo \
19
         types/patterns.cmo \
20
21
	 types/sequence.cmo \
	 types/builtin.cmo
22

23
24
RUNTIME = runtime/value.cmo \
          runtime/load_xml.cmo runtime/run_dispatch.cmo \
25
          runtime/print_xml.cmo \
26
          runtime/eval.cmo
27

28
29
DRIVER = driver/cduce.cmo

30
31
TOPLEVEL = toplevel/toploop.cmo

32
OBJECTS = $(MISC) $(TYPES) $(PARSER) $(TYPING) $(RUNTIME)
33
34
35
XOBJECTS = $(OBJECTS:.cmo=.cmx)
XDRIVER = $(DRIVER:.cmo=.cmx)

36

37
38
39
40
41
42
43
44
45
46
47
48
49

DEBUG = -g
PACKAGES = pxp-engine,pxp-lex-iso88591,camlp4,num
OCAMLCP = ocamlc
OCAMLC = ocamlfind $(OCAMLCP) -package $(PACKAGES)
OCAMLOPT = ocamlfind ocamlopt  -package $(PACKAGES)

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

SYNTAX = camlp4o pa_extend.cmo
SYNTAX_PARSER = -pp '$(SYNTAX)'
PREPRO = $(SYNTAX) pr_o.cmo
50
51

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

54
all.cmxa: $(XOBJECTS)
55
	$(OCAMLOPT) -a -o $@ $(XOBJECTS)
56
57


58
cduce: $(OBJECTS) $(DRIVER)
59
	$(OCAMLC) $(DEBUG) -linkpkg -o $@ gramlib.cma $(OBJECTS) $(DRIVER)
60

61
62
63
64
toplevel: $(OBJECTS) $(TOPLEVEL)
	$(OCAMLC) $(DEBUG) -linkpkg -o $@ gramlib.cma $(OBJECTS) $(TOPLEVEL)


65
66
67
dtd2cduce: tools/dtd2cduce.cmo
	$(OCAMLC) $(DEBUG) -linkpkg -o $@ $<

68
69
70
pull: tools/pull.cmo
	$(OCAMLC) $(DEBUG) -linkpkg -o $@ $<

71
cduce.opt: all.cmxa $(XDRIVER)
72
	$(OCAMLOPT) -linkpkg -o $@ gramlib.cmxa $(XOBJECTS) $(XDRIVER)
73

74
75
compute_depend:
	@echo "Computing dependencies ..."
76
	ocamldep $(INCLUDES) $(SYNTAX_PARSER) $(DEPEND) > depend
77

78
run_top: all.cma
79
	ledit ocaml $(INCLUDES) `ocamlfind use pxp` all.cma
80
81

clean:
82
	for i in $(CLEAN_DIRS); do \
83
84
85
	(cd $$i; rm -f *.cmi *.cmo *.cma *.cmx *.o *~); \
	done
	rm -f *.cmi *.cmo *.cma *.cmx *.a *.cmxa *.o *~
86
87
	rm -f cduce cduce.opt ocamlprof.dump
	rm -f dtd2cduce pool
88
89
	rm -Rf prepro

90
91
92

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

93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
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 Makefile depend prepro/
	(cd prepro;  make cduce OCAMLCP="ocamlcp -p a" SYNTAX_PARSER=)

108
.ml.cmo:
109
110
	$(OCAMLC) $(DEBUG) -c $(SYNTAX_PARSER) $(INCLUDES) $<

111
.ml.cmx:
112
	$(OCAMLOPT) -c $(SYNTAX_PARSER) $(INCLUDES) $<
113
114

.mli.cmi:
115
	$(OCAMLC) $(DEBUG) -c $(SYNTAX_PARSER) $(INCLUDES) $<
116
117

# FORTPATH = /users/formel8/frisch/solaris/fort/fort
118
119
120
#FORTPATH = /home/frisch/fort
#FORTBIN = $(FORTPATH)/fort
#FORTLIB = $(FORTPATH)
121
122

test: all.cma
123
	fort all.cma $(INCLUDES) tests/test_fort.ml
124

125
include depend