Makefile 2.85 KB
Newer Older
1
2
3
# Source directories 

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

# Objects to build
7

8
PARSER = parser/lexer.cmo parser/location.cmo parser/ast.cmo parser/parser.cmo
9

10
TYPING = typing/typed.cmo typing/typer.cmo
11

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

21
22
23
RUNTIME = runtime/value.cmo \
          runtime/load_xml.cmo runtime/run_dispatch.cmo \
          runtime/eval.cmo
24

25
26
DRIVER = driver/cduce.cmo

27
28
TOPLEVEL = toplevel/toploop.cmo

29
OBJECTS = $(TYPES) $(PARSER) $(TYPING) $(RUNTIME)
30
31
32
XOBJECTS = $(OBJECTS:.cmo=.cmx)
XDRIVER = $(DRIVER:.cmo=.cmx)

33

34
35
36
37
38
39
40
41
42
43
44
45
46

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
47
48

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

51
all.cmxa: $(XOBJECTS)
52
	$(OCAMLOPT) -a -o $@ $(XOBJECTS)
53
54


55
cduce: $(OBJECTS) $(DRIVER)
56
	$(OCAMLC) $(DEBUG) -linkpkg -o $@ gramlib.cma $(OBJECTS) $(DRIVER)
57

58
59
60
61
toplevel: $(OBJECTS) $(TOPLEVEL)
	$(OCAMLC) $(DEBUG) -linkpkg -o $@ gramlib.cma $(OBJECTS) $(TOPLEVEL)


62
63
64
dtd2cduce: tools/dtd2cduce.cmo
	$(OCAMLC) $(DEBUG) -linkpkg -o $@ $<

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

68
cduce.opt: all.cmxa $(XDRIVER)
69
	$(OCAMLOPT) -linkpkg -o $@ gramlib.cmxa $(XOBJECTS) $(XDRIVER)
70

71
72
compute_depend:
	@echo "Computing dependencies ..."
73
	ocamldep $(INCLUDES) $(SYNTAX_PARSER) $(DEPEND) > depend
74

75
run_top: all.cma
76
	ledit ocaml $(INCLUDES) `ocamlfind use pxp` all.cma
77
78

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

87
88
89

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

90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
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=)

105
.ml.cmo:
106
107
	$(OCAMLC) $(DEBUG) -c $(SYNTAX_PARSER) $(INCLUDES) $<

108
.ml.cmx:
109
	$(OCAMLOPT) -c $(SYNTAX_PARSER) $(INCLUDES) $<
110
111

.mli.cmi:
112
	$(OCAMLC) $(DEBUG) -c $(SYNTAX_PARSER) $(INCLUDES) $<
113
114

# FORTPATH = /users/formel8/frisch/solaris/fort/fort
115
116
117
#FORTPATH = /home/frisch/fort
#FORTBIN = $(FORTPATH)/fort
#FORTLIB = $(FORTPATH)
118
119

test: all.cma
120
	fort all.cma $(INCLUDES) tests/test_fort.ml
121

122
include depend