Makefile 2.65 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
13
TYPES  = types/recursive.cmo \
         types/recursive_share.cmo types/recursive_noshare.cmo \
         types/sortedList.cmo 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
22
RUNTIME = runtime/value.cmo \
          runtime/load_xml.cmo runtime/run_dispatch.cmo \
          runtime/eval.cmo
23

24
25
DRIVER = driver/cduce.cmo

26
27
TOPLEVEL = toplevel/toploop.cmo

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

32

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

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

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

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


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

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


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

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

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

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

79
80
81

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

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

97
.ml.cmo:
98
99
	$(OCAMLC) $(DEBUG) -c $(SYNTAX_PARSER) $(INCLUDES) $<

100
.ml.cmx:
101
	$(OCAMLOPT) -c $(SYNTAX_PARSER) $(INCLUDES) $<
102
103

.mli.cmi:
104
	$(OCAMLC) $(DEBUG) -c $(SYNTAX_PARSER) $(INCLUDES) $<
105
106

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

test: all.cma
112
	fort all.cma $(INCLUDES) tests/test_fort.ml
113

114
include depend