]> matita.cs.unibo.it Git - helm.git/blob - helm/ocaml/hbugs/Makefile
test branch
[helm.git] / helm / ocaml / hbugs / Makefile
1
2 # Targets description:
3 #       all (default) -> builds hbugs bytecode library hbugs.cma
4 #       opt           -> builds hbugs native library hbugs.cmxa
5 #       daemons       -> builds hbugs broker and tutors executables
6 #
7 #       start         -> starts up broker and tutors
8 #       stop          -> stop broker and tutors
9 #
10 #       broker        -> builds broker executable
11 #       tutors        -> builds tutors executables
12 #       client        -> builds hbugs client
13
14 PACKAGE = hbugs
15
16 IMPLEMENTATION_FILES =                  \
17         hbugs_misc.ml                   \
18         hbugs_common.ml                 \
19         hbugs_id_generator.ml           \
20         hbugs_messages.ml               \
21         hbugs_client_gui.ml             \
22         hbugs_client.ml
23 INTERFACE_FILES = \
24         hbugs_types.mli \
25         $(patsubst %.ml, %.mli, $(IMPLEMENTATION_FILES))
26
27 include ../Makefile.common
28 include .tutors.ml
29 include .generated_tutors.ml
30
31 .tutors.ml:
32         echo -n "TUTORS_ML = " > $@
33         scripts/ls_tutors.ml | xargs >> $@
34 .generated_tutors.ml:
35         echo -n "GENERATED_TUTORS_ML = " > $@
36         scripts/ls_tutors.ml -auto | xargs >> $@
37
38 TUTORS = $(patsubst %.ml, %, $(TUTORS_ML))
39 TUTORS_OPT = $(patsubst %, %.opt, $(TUTORS))
40 GENERATED_TUTORS = $(patsubst %.ml, %, $(GENERATED_TUTORS_ML))
41
42 hbugs_client_gui.ml hbugs_client_gui.mli: hbugs_client_gui.glade
43         lablgladecc2 $< > hbugs_client_gui.ml
44         $(OCAMLC) -i hbugs_client_gui.ml > hbugs_client_gui.mli
45
46 clean: clean_mains
47 .PHONY: clean_mains
48 clean_mains:
49         rm -f $(TUTORS) $(TUTORS_OPT) broker{,.opt} client{,.opt}
50 distclean: clean
51         rm -f $(GENERATED_TUTORS_ML) hbugs_client_gui.ml{,i}
52         rm -f .tutors.ml .generated_tutors.ml
53
54 MAINS_DEPS =                            \
55         hbugs_misc.cmo                  \
56         hbugs_messages.cmo              \
57         hbugs_id_generator.cmo
58 TUTOR_DEPS = $(MAINS_DEPS)              \
59         hbugs_tutors.cmo
60 BROKER_DEPS = $(MAINS_DEPS)             \
61         hbugs_broker_registry.cmo
62 CLIENT_DEPS = $(MAINS_DEPS)             \
63         hbugs_client_gui.cmo            \
64         hbugs_common.cmo                \
65         hbugs_client.cmo
66 TUTOR_DEPS_OPT = $(patsubst %.cmo, %.cmx, $(TUTOR_DEPS))
67 BROKER_DEPS_OPT = $(patsubst %.cmo, %.cmx, $(BROKER_DEPS))
68 CLIENT_DEPS_OPT = $(patsubst %.cmo, %.cmx, $(CLIENT_DEPS))
69 $(GENERATED_TUTORS_ML): scripts/build_tutors.ml data/tutors_index.xml data/hbugs_tutor.TPL.ml
70         scripts/build_tutors.ml
71 hbugs_tutors.cmo: hbugs_tutors.cmi
72 hbugs_broker_registry.cmo: hbugs_broker_registry.cmi
73 .PHONY: daemons
74 daemons: tutors broker
75 .PHONY: tutors
76 tutors: all $(TUTORS)
77 %_tutor: $(TUTOR_DEPS) %_tutor.ml
78         $(OCAMLC) -linkpkg -o $@ $^
79 %_tutor.opt: $(TUTOR_DEPS_OPT) %_tutor.ml
80         $(OCAMLOPT) -linkpkg -o $@ $^
81 broker: $(BROKER_DEPS) broker.ml
82         $(OCAMLC) -linkpkg -o $@ $^
83 broker.opt: $(BROKER_DEPS_OPT) broker.ml
84         $(OCAMLOPT) -linkpkg -o $@ $^
85 client: $(CLIENT_DEPS) client.ml
86         $(OCAMLC) -linkpkg -o $@ $^
87 client.opt: $(CLIENT_DEPS_OPT) client.ml
88         $(OCAMLOPT) -linkpkg -o $@ $^
89
90 .PHONY: start stop
91 start:
92         scripts/brokerctl.sh start
93         scripts/sabba.sh start
94 stop:
95         scripts/brokerctl.sh stop
96         scripts/sabba.sh stop
97