]> matita.cs.unibo.it Git - helm.git/blob - helm/ocaml/mathql_test/Makefile
MathQL query generator: new interface
[helm.git] / helm / ocaml / mathql_test / Makefile
1 BIN_DIR = /usr/local/bin
2 REQUIRES = unix helm-cic helm-cic_textual_parser helm-mathql helm-mathql_interpreter helm-mquery_generator 
3 PREDICATES =
4 OCAMLOPTIONS = -package "$(REQUIRES)" -predicates "$(PREDICATES)"
5 OCAMLC = ocamlfind ocamlc $(OCAMLOPTIONS)
6 OCAMLOPT = ocamlfind ocamlopt $(OCAMLOPTIONS)
7 OCAMLDEP = ocamldep
8 OCAMLYACC = ocamlyacc
9 OCAMLLEX = ocamllex
10
11 LIBRARIES = $(shell ocamlfind query -recursive -predicates "byte $(PREDICATES)" -format "%d/%a" $(REQUIRES))
12 LIBRARIES_OPT = $(shell ocamlfind query -recursive -predicates "native $(PREDICATES)" -format "%d/%a" $(REQUIRES))
13
14 MQTOP = mqtop.ml
15 MQITOP = mqitop.ml
16 MQGTOP = mqgtop.ml
17
18 DEPOBJS = $(MQTOP) $(MQITOP) $(MQGTOP)
19 AUXOBJS = mQGTopParser.ml mQGTopLexer.ml 
20
21 all: $(DEPOBJS:.ml=)
22 opt: $(DEPOBJS:.ml=.opt)
23
24 depend: $(AUXOBJS)
25         $(OCAMLDEP) $(DEPOBJS) > .depend
26
27 mqtop: $(MQTOP:.ml=.cmo) $(LIBRARIES)
28         $(OCAMLC) -linkpkg -o mqtop $(MQTOP:.ml=.cmo)
29
30 mqtop.opt: $(MQTOP:.ml=.cmx) $(LIBRARIES_OPT)
31         $(OCAMLOPT) -linkpkg -o mqtop.opt $(MQTOP:.ml=.cmx)
32
33 mqitop: $(MQITOP:.ml=.cmo) $(LIBRARIES)
34         $(OCAMLC) -linkpkg -o mqitop $(MQITOP:.ml=.cmo)
35
36 mqitop.opt: $(MQITOP:.ml=.cmx) $(LIBRARIES_OPT)
37         $(OCAMLOPT) -linkpkg -o mqitop.opt $(MQITOP:.ml=.cmx)
38
39 mqgtop: mQGTopParser.cmi $(AUXOBJS:.ml=.cmo) $(MQGTOP:.ml=.cmo) $(LIBRARIES)
40         $(OCAMLC) -linkpkg -o mqgtop $(AUXOBJS:.ml=.cmo) $(MQGTOP:.ml=.cmo)
41
42 mqgtop.opt: $(AUXOBJS:.ml=.cmx) $(MQGTOP:.ml=.cmx) $(LIBRARIES_OPT)
43         $(OCAMLOPT) -linkpkg -o mqgtop.opt $(AUXOBJS:.ml=.cmx) $(MQGTOP:.ml=.cmx)
44
45 .SUFFIXES: .ml .mli .cmo .cmi .cmx .mly .mll
46 .ml.cmo: $(LIBRARIES)
47         $(OCAMLC) -c $<
48 .mli.cmi: $(LIBRARIES)
49         $(OCAMLC) -c $<
50 .ml.cmx: $(LIBRARIES_OPT)
51         $(OCAMLOPT) -c $<
52 .mly.ml: 
53         $(OCAMLYACC) $<
54 .mly.mli:
55         $(OCAMLYACC) $<
56 .mll.ml:
57         $(OCAMLLEX) $<
58
59 $(DEPOBJS:%.ml=%.cmo): $(LIBRARIES)
60 $(DEPOBJS:%.ml=%.cmx): $(LIBRARIES_OPT)
61
62 clean:
63         rm -f *.cm[iox] *.o $(DEPOBJS:.ml=) $(DEPOBJS:.ml=.opt) \
64         mQGTopParser.ml mQGTopParser.mli mQGTopLexer.ml
65
66 install:
67         cp $(DEPOBJS:.ml=) $(DEPOBJS:.ml=.opt) $(BIN_DIR)
68
69 uninstall:
70         cd $(BIN_DIR)
71         rm -f $(DEPOBJS:.ml=) $(DEPOBJS:.ml=.opt)
72
73 .PHONY: install uninstall clean
74
75 ifneq ($(MAKECMDGOALS), depend)
76    include .depend   
77 endif
78