Makefile 2.36 KB
Newer Older
1
2
3
4
5
# Source directories 

DIRS = parser typing types runtime driver

# Objects to build
6

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

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

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

19
20
RUNTIME = runtime/value.cmo

21
22
DRIVER = driver/cduce.cmo

23
OBJECTS = $(TYPES) $(PARSER) $(TYPING) $(RUNTIME)
24
25
26
XOBJECTS = $(OBJECTS:.cmo=.cmx)
XDRIVER = $(DRIVER:.cmo=.cmx)

27

28
29
30
31
32
33
34
35
36
37
38
39
40

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
41
42

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

45
all.cmxa: $(XOBJECTS)
46
	$(OCAMLOPT) -a -o $@ $(XOBJECTS)
47
48


49
cduce: $(OBJECTS) $(DRIVER)
50
	$(OCAMLC) $(DEBUG) -linkpkg -o $@ gramlib.cma $(OBJECTS) $(DRIVER)
51

52
cduce.opt: all.cmxa $(XDRIVER)
53
	$(OCAMLOPT) -linkpkg -o $@ gramlib.cmxa $(XOBJECTS) $(XDRIVER)
54

55
56
compute_depend:
	@echo "Computing dependencies ..."
57
	ocamldep $(INCLUDES) $(SYNTAX_PARSER) $(DEPEND) > depend
58

59
run_top: all.cma
60
	ledit ocaml $(INCLUDES) `ocamlfind use pxp` all.cma
61
62

clean:
63
64
65
66
67
	for i in $(DIRS); do \
	(cd $$i; rm -f *.cmi *.cmo *.cma *.cmx *.o *~); \
	done
	rm -f *.cmi *.cmo *.cma *.cmx *.a *.cmxa *.o *~
	rm -f cduce cduce.opt
68
69
	rm -Rf prepro

70
71
72

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

73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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=)

88
.ml.cmo:
89
90
	$(OCAMLC) $(DEBUG) -c $(SYNTAX_PARSER) $(INCLUDES) $<

91
.ml.cmx:
92
	$(OCAMLOPT) -c $(SYNTAX_PARSER) $(INCLUDES) $<
93
94

.mli.cmi:
95
	$(OCAMLC) $(DEBUG) -c $(SYNTAX_PARSER) $(INCLUDES) $<
96
97

# FORTPATH = /users/formel8/frisch/solaris/fort/fort
98
99
100
#FORTPATH = /home/frisch/fort
#FORTBIN = $(FORTPATH)/fort
#FORTLIB = $(FORTPATH)
101
102

test: all.cma
103
	fort all.cma $(INCLUDES) tests/test_fort.ml
104

105
include depend