Makefile 3.45 KB
Newer Older
1 2
# Source directories 

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

# Objects to build
7

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

10 11 12
PARSER = parser/lexer.cmo parser/location.cmo \
         parser/wlexer.cmo \
         parser/ast.cmo parser/parser.cmo
13

14
TYPING = typing/typed.cmo typing/typer.cmo
15

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

25 26
RUNTIME = runtime/value.cmo \
          runtime/load_xml.cmo runtime/run_dispatch.cmo \
27
          runtime/print_xml.cmo \
28
          runtime/eval.cmo
29

30 31
DRIVER = driver/cduce.cmo

32
OBJECTS = $(MISC) $(TYPES) $(PARSER) $(TYPING) $(RUNTIME)
33 34 35 36 37

CDUCE = $(OBJECTS) $(DRIVER) driver/run.cmo
WEBIFACE  = $(OBJECTS) $(DRIVER) driver/webiface.cmo
TOPLEVEL = $(OBJECTS) toplevel/toploop.cmo

38
XOBJECTS = $(OBJECTS:.cmo=.cmx)
39
XCDUCE = $(CDUCE:.cmo=.cmx)
40

41

42 43

DEBUG = -g
44
PACKAGES = pxp-engine,pxp-lex-iso88591,wlexing,camlp4,num,cgi
45 46 47 48 49 50 51 52 53 54
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
55 56

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

59
all.cmxa: $(XOBJECTS)
60
	$(OCAMLOPT) -a -o $@ $(XOBJECTS)
61 62


63 64 65
cduce: $(CDUCE)
	$(OCAMLC) $(DEBUG) -linkpkg -o $@ gramlib.cma $(CDUCE)

66
toplevel.out: $(TOPLEVEL)
67
	$(OCAMLC) $(DEBUG) -linkpkg -o $@ gramlib.cma $(TOPLEVEL)
68

69 70
webiface: $(WEBIFACE)
	$(OCAMLC) $(DEBUG) -linkpkg -o $@ gramlib.cma $(WEBIFACE)
71 72


73 74 75
dtd2cduce: tools/dtd2cduce.cmo
	$(OCAMLC) $(DEBUG) -linkpkg -o $@ $<

76 77 78
pull: tools/pull.cmo
	$(OCAMLC) $(DEBUG) -linkpkg -o $@ $<

79
cduce.opt: all.cmxa $(XDRIVER)
80
	$(OCAMLOPT) -linkpkg -o $@ gramlib.cmxa $(XOBJECTS) $(XDRIVER)
81

82 83
compute_depend:
	@echo "Computing dependencies ..."
84
	ocamldep $(INCLUDES) $(SYNTAX_PARSER) $(DEPEND) > depend
85

86 87 88
parser/wlexer.ml: parser/wlexer.mll
	wlex parser/wlexer.mll

89
run_top: all.cma
90
	ledit ocaml $(INCLUDES) `ocamlfind use pxp` all.cma
91 92

clean:
93
	for i in $(CLEAN_DIRS); do \
94 95
	(cd $$i; rm -f *.cmi *.cmo *.cma *.cmx *.o *~); \
	done
96
	rm -f parser/wlexer.ml
97
	rm -f *.cmi *.cmo *.cma *.cmx *.a *.cmxa *.o *~
98
	rm -f cduce cduce.opt ocamlprof.dump
99
	rm -f dtd2cduce pool webiface
100 101
	rm -Rf prepro

102 103 104

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

105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
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=)

120
.ml.cmo:
121 122
	$(OCAMLC) $(DEBUG) -c $(SYNTAX_PARSER) $(INCLUDES) $<

123
.ml.cmx:
124
	$(OCAMLOPT) -c $(SYNTAX_PARSER) $(INCLUDES) $<
125 126

.mli.cmi:
127
	$(OCAMLC) $(DEBUG) -c $(SYNTAX_PARSER) $(INCLUDES) $<
128 129

# FORTPATH = /users/formel8/frisch/solaris/fort/fort
130 131 132
#FORTPATH = /home/frisch/fort
#FORTBIN = $(FORTPATH)/fort
#FORTLIB = $(FORTPATH)
133 134

test: all.cma
135
	fort all.cma $(INCLUDES) tests/test_fort.ml
136

137
include depend
138 139 140 141 142 143


# Site-specific installation
build_web:
	rsh cedre ". .env; cd IMPLEM/CDUCE; make webiface"
install_web:
144
	ssh cduce@iris "cp ~frisch/IMPLEM/CDUCE/webiface cgi-bin/cduce2; chmod +s cgi-bin/cduce2"
145 146 147 148 149 150 151 152 153 154 155 156 157 158