]> matita.cs.unibo.it Git - helm.git/blob - helm/gTopLevel/Makefile
8b89d823a18cd92a894456d40d1d7977ea9e8ffd
[helm.git] / helm / gTopLevel / Makefile
1 BIN_DIR = /usr/local/bin
2 TEST_REQUIRES = \
3         helm-mathql_interpreter \
4         helm-mathql_generator \
5         helm-tactics \
6         helm-cic_transformations \
7         helm-cic_textual_parser2 \
8         helm-cic_textual_parser \
9         helm-tex_cic_textual_parser \
10         mathml-editor \
11         lablgtkmathview \
12         helm-cic_cache
13 REQUIRES = \
14         $(TEST_REQUIRES) \
15         gdome2-xslt \
16         hbugs-client \
17         helm-cic_cache
18 PREDICATES = "gnome,init,glade"
19 OCAMLOPTIONS = -package "$(REQUIRES)" -predicates "$(PREDICATES)" -pp camlp4o
20 OCAMLFIND = ocamlfind
21 OCAMLDEBUGOPTIONS = -g
22 OCAMLC = $(OCAMLFIND) ocamlc $(OCAMLDEBUGOPTIONS) $(OCAMLOPTIONS)
23 OCAMLOPT = $(OCAMLFIND) opt $(OCAMLOPTIONS)
24 OCAMLDEP = $(OCAMLFIND) ocamldep -pp camlp4o
25 OCAMLDEBUG = wowcamldebug
26
27 LIBRARIES = $(shell $(OCAMLFIND) query -recursive -predicates "byte $(PREDICATES)" -format "%d/%a" $(REQUIRES))
28 LIBRARIES_OPT = $(shell $(OCAMLFIND) query -recursive -predicates "native $(PREDICATES)" -format "%d/%a" $(REQUIRES))
29 TEST_LIBRARIES = $(shell $(OCAMLFIND) query -recursive -predicates "byte $(PREDICATES)" -format "%d/%a" $(TEST_REQUIRES))
30 TEST_LIBRARIES_OPT = $(shell $(OCAMLFIND) query -recursive -predicates "native $(PREDICATES)" -format "%d/%a" $(TEST_REQUIRES))
31
32 all: styles gTopLevel
33 opt: styles gTopLevel.opt
34
35 start:
36         $(MAKE) -C ../hbugs/ start
37 stop:
38         $(MAKE) -C ../hbugs/ stop
39
40 INTERFACE_FILES = \
41         proofEngine.mli \
42         logicalOperations.mli \
43         oldDisambiguate.mli \
44         disambiguatingParser.mli \
45         termEditor.mli \
46         texTermEditor.mli \
47         xmlDiff.mli \
48         chosenTransformer.mli \
49         termViewer.mli \
50         invokeTactics.mli \
51         hbugs.mli \
52         chosenTermEditor.mli 
53
54 DEPOBJS = \
55         $(INTERFACE_FILES) $(INTERFACE_FILES:%.mli=%.ml) \
56         gTopLevel.ml regtest.ml testlibrary.ml batchParser.ml batchParser.mli
57
58 TOPLEVELOBJS = $(INTERFACE_FILES:%.mli=%.cmo) gTopLevel.cmo
59 TESTOBJS = \
60         oldDisambiguate.cmo \
61         disambiguatingParser.cmo \
62         batchParser.cmo
63 REGTESTOBJS = $(TESTOBJS) regtest.cmo
64 TESTLIBOBJS = $(TESTOBJS) testlibrary.cmo
65
66 $(INTERFACE_FILES:%.mli=%.cmo): $(LIBRARIES)
67 $(INTERFACE_FILES:%.mli=%.cmx): $(LIBRARIES_OPT)
68
69 styles:
70         @echo "***********************************************************************"
71         @if [ -d stylesheets -a -d meta_stylesheets ] ; then echo -e "* stylesheets and metastylesheets found:                              *\\n* I will create the request hyperlinks in styles                      *" ; else echo -e "* stylesheets or meta_stylesheets not found:                          *\\n* you should check-out the two directories from the MoWGLI repository *" ; exit -1 ; fi
72         @echo "***********************************************************************"
73         mkdir styles
74         (cd styles && for i in ../stylesheets/*.xsl ; do ln -s $$i; done)
75         (cd styles && for i in ../stylesheets/generated/*.xsl ; do ln -s $$i; done)
76         (cd styles && rm rootcontent.xsl && ln -s ../rootcontent.xsl)
77         
78 depend:
79         $(OCAMLDEP) $(DEPOBJS) > .depend
80
81 gTopLevel: $(TOPLEVELOBJS) $(LIBRARIES)
82         $(OCAMLC) -thread -linkpkg -o $@ $(TOPLEVELOBJS)
83 gTopLevel.opt: $(TOPLEVELOBJS:.cmo=.cmx) $(LIBRARIES_OPT)
84         $(OCAMLOPT) -thread -linkpkg -o $@ $(TOPLEVELOBJS:.cmo=.cmx)
85
86 testlibrary: $(TESTLIBOBJS) $(TEST_LIBRARIES)
87         $(OCAMLFIND) ocamlc $(OCAMLDEBUGOPTIONS) -linkpkg \
88                 -package "$(TEST_REQUIRES)" -o $@ $(TESTLIBOBJS)
89 testlibrary.opt: $(TESTLIBOBJS:.cmo=.cmx) $(TEST_LIBRARIES_OPT)
90         $(OCAMLFIND) opt -linkpkg -package "$(TEST_REQUIRES)" -o $@ \
91                 $(TESTLIBOBJS:.cmo=.cmx)
92
93 regtest: $(REGTESTOBJS) $(TEST_LIBRARIES)
94         $(OCAMLFIND) ocamlc $(OCAMLDEBUGOPTIONS) -linkpkg \
95                 -package "$(TEST_REQUIRES)" -o $@ $(REGTESTOBJS)
96 regtest.opt: $(REGTESTOBJS:.cmo=.cmx) $(TEST_LIBRARIES_OPT)
97         $(OCAMLOPT) opt -linkpkg -package "$(TEST_REQUIRES)" -o $@ \
98                 $(REGTESTOBJS:.cmo=.cmx)
99
100 .SUFFIXES: .ml .mli .cmo .cmi .cmx
101 .ml.cmo:
102         $(OCAMLC) -c $<
103 .mli.cmi:
104         $(OCAMLC) -c $<
105 .ml.cmx:
106         $(OCAMLOPT) -c $<
107
108 $(TOPLEVELOBJS): $(LIBRARIES)
109 $(TOPLEVELOBJS:.cmo=.cmx)): $(LIBRARIES_OPT)
110
111 clean:
112         rm -f *.cm[iox] *.o gTopLevel{,.opt} regtest{,.opt} testlibrary{,.opt}
113 install:
114         cp gTopLevel gTopLevel.opt $(BIN_DIR)
115 uninstall:
116         rm -f $(BIN_DIR)/gTopLevel $(BIN_DIR)/gTopLevel.opt
117
118 .PHONY: install uninstall clean test
119
120 INTESTS := $(wildcard tests/*.cic)
121 OUTTESTS := $(patsubst %, %.test, $(INTESTS))
122 gentest: $(OUTTESTS)
123 cleantest:
124         rm -f $(OUTTESTS)
125 tests/%.cic.test: tests/%.cic regtest
126         time ./regtest -gen $<
127 test: regtest
128         ./regtest $(INTESTS) 2> /dev/null
129 envtest: regtest
130         ./regtest -dump $(INTESTS) 2> /dev/null
131 librarytest: testlibrary.opt
132         ./testlibrary.opt index.txt 2>/dev/null >LOG &
133
134 MAIN = ./gTopLevel
135 ARGS =
136 debug:
137         $(OCAMLFIND) query -recursive -predicates byte -a-format \
138                 helm-cic_unification | \
139                 sed 's/\(.*\)/load_printer "\1"/' \
140                 > .debug_script
141         echo "install_printer CicMetaSubst.fppsubst" >> .debug_script
142         echo "install_printer CicMetaSubst.fppterm" >> .debug_script
143         echo "install_printer CicMetaSubst.fppmetasenv" >> .debug_script
144         ledit $(OCAMLDEBUG) \
145                 -source .debug_script \
146                 $(shell $(OCAMLFIND) query -recursive -i-format $(REQUIRES)) \
147                 $(MAIN) $(ARGS)
148
149 ifneq ($(MAKECMDGOALS), depend)
150    include .depend   
151 endif
152