Makefile 2.56 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/recursive_share.cmo types/recursive_noshare.cmo \
         types/sortedList.cmo \
13
         types/sortedMap.cmo types/boolean.cmo \
14
         types/intervals.cmo types/chars.cmo types/atoms.cmo \
15
         types/types.cmo \
16
         types/patterns.cmo \
17
18
	 types/sequence.cmo \
	 types/builtin.cmo
19

20
21
RUNTIME = runtime/value.cmo

22
23
DRIVER = driver/cduce.cmo

24
25
TOPLEVEL = toplevel/toploop.cmo

26
OBJECTS = $(TYPES) $(PARSER) $(TYPING) $(RUNTIME)
27
28
29
XOBJECTS = $(OBJECTS:.cmo=.cmx)
XDRIVER = $(DRIVER:.cmo=.cmx)

30

31
32
33
34
35
36
37
38
39
40
41
42
43

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
44
45

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

48
all.cmxa: $(XOBJECTS)
49
	$(OCAMLOPT) -a -o $@ $(XOBJECTS)
50
51


52
cduce: $(OBJECTS) $(DRIVER)
53
	$(OCAMLC) $(DEBUG) -linkpkg -o $@ gramlib.cma $(OBJECTS) $(DRIVER)
54

55
56
57
58
toplevel: $(OBJECTS) $(TOPLEVEL)
	$(OCAMLC) $(DEBUG) -linkpkg -o $@ gramlib.cma $(OBJECTS) $(TOPLEVEL)


59
cduce.opt: all.cmxa $(XDRIVER)
60
	$(OCAMLOPT) -linkpkg -o $@ gramlib.cmxa $(XOBJECTS) $(XDRIVER)
61

62
63
compute_depend:
	@echo "Computing dependencies ..."
64
	ocamldep $(INCLUDES) $(SYNTAX_PARSER) $(DEPEND) > depend
65

66
run_top: all.cma
67
	ledit ocaml $(INCLUDES) `ocamlfind use pxp` all.cma
68
69

clean:
70
71
72
73
74
	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
75
76
	rm -Rf prepro

77
78
79

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

80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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=)

95
.ml.cmo:
96
97
	$(OCAMLC) $(DEBUG) -c $(SYNTAX_PARSER) $(INCLUDES) $<

98
.ml.cmx:
99
	$(OCAMLOPT) -c $(SYNTAX_PARSER) $(INCLUDES) $<
100
101

.mli.cmi:
102
	$(OCAMLC) $(DEBUG) -c $(SYNTAX_PARSER) $(INCLUDES) $<
103
104

# FORTPATH = /users/formel8/frisch/solaris/fort/fort
105
106
107
#FORTPATH = /home/frisch/fort
#FORTBIN = $(FORTPATH)/fort
#FORTLIB = $(FORTPATH)
108
109

test: all.cma
110
	fort all.cma $(INCLUDES) tests/test_fort.ml
111

112
include depend