]> matita.cs.unibo.it Git - helm.git/blob - components/Makefile
d30e63dcdd84b116564fba3cbf06457c301201ea
[helm.git] / components / Makefile
1 H=@
2 export SHELL=/bin/bash
3
4 include ../Makefile.defs
5
6 # Warning: the modules must be in compilation order
7 NULL =
8 MODULES =                       \
9         extlib                  \
10         xml                     \
11         hgdome                  \
12         registry                \
13         hmysql                  \
14         syntax_extensions \
15         thread                  \
16         xmldiff                 \
17         urimanager              \
18         logger                  \
19         getter                  \
20         cic                     \
21         cic_proof_checking      \
22         cic_acic                \
23         metadata                \
24         library                 \
25         acic_content            \
26         grafite                 \
27         content_pres            \
28         cic_unification         \
29         whelp                   \
30         tactics                 \
31         acic_procedural         \
32         cic_disambiguation      \
33         lexicon                 \
34         grafite_engine          \
35         grafite_parser          \
36         tptp_grafite            \
37         $(NULL)
38
39 METAS = $(MODULES:%=METAS/META.helm-%)
40
41 ifeq ($(DISTRIBUTED),no)
42         MODULES+=binaries
43 endif
44
45 all: metas $(MODULES:%=rec@all@%) 
46 opt: metas syntax-extensions $(MODULES:%=rec@opt@%)
47
48 ifeq ($(HAVE_OCAMLOPT),yes)
49 world: opt
50 else
51 world: all
52 endif
53 syntax-extensions:
54         $(H)$(MAKE) -C syntax_extensions depend
55         $(H)$(MAKE) -C syntax_extensions
56 depend: syntax-extensions $(MODULES:%=rec@depend@%)
57 depend.opt: syntax-extensions $(MODULES:%=rec@depend.opt@%)
58 install-arch: $(MODULES:%=rec@install@%)
59 install-indep:
60 uninstall: $(MODULES:%=rec@uninstall@%)
61 clean: $(MODULES:%=rec@clean@%) clean_metas
62
63 .stats: $(MODULES:%=rec@.stats@%)
64         $(H)(for m in $(MODULES); do echo -n "$$m:"; cat $$m/.stats; done) \
65          | sort -t : -k 2 -n -r > .stats
66
67 rec@%:
68         $(H)$(MAKE) -C $(word 2, $(subst @, ,$*)) $(word 1, $(subst @, ,$*))
69
70 EXTRA_DIST_CLEAN = \
71         libraries-clusters.ps   \
72         libraries-clusters.pdf  \
73         libraries-ext.ps        \
74         libraries.ps            \
75         .dep.dot                \
76         .extdep.dot             \
77         .clustersdep.dot        \
78         $(NULL)
79
80 distclean: clean clean_metas
81         $(H)rm -f $(METAS)
82         $(H)rm -f configure config.log config.cache config.status
83         $(H)rm -f $(EXTRA_DIST_CLEAN)
84
85 .PHONY: all opt world metas depend install uninstall clean clean_metas distclean
86
87 METAS/META.helm-%: METAS/meta.helm-%.src
88         $(H)cp $< $@ && echo "directory=\"$(shell pwd)/$*\"" >> $@
89
90 SIMPLIFYDEPS = ../daemons/graphs/tools/simplify_deps/simplify_deps
91 $(SIMPLIFYDEPS):
92         $(H)$(MAKE) -C $(dir $(SIMPLIFYDEPS))
93
94 .PHONY: .dep.dot
95 .dep.dot: $(SIMPLIFYDEPS)
96         $(H)echo "digraph G {" > $@
97         $(H)echo "   rankdir = TB ;" >> $@
98         $(H)for i in $(MODULES); do \
99                 $(OCAMLFIND) query helm-$$i -recursive -p-format | \
100                 grep helm | \
101                 sed "s/^helm-/ \"$$i\" -> \"/g" | \
102                 sed "s/$$/\";/g" >> $@ ; \
103         done
104         $(H)mv $@ $@.old ; $(SIMPLIFYDEPS) < $@.old > $@ ; rm $@.old
105         $(H)echo "}" >> $@
106
107 .PHONY: .alldep.dot
108 .alldep.dot:
109         $(H)echo "digraph G {" > $@
110         $(H)echo "   rankdir = TB ;" >> $@
111         $(H)for i in $(MODULES); do \
112                 $(OCAMLFIND) query helm-$$i -recursive -p-format | \
113                         grep -v "pxp-" | \
114                         sed "s/^pxp/pxp[-*]/g" | \
115                         sed "s/^/ \"helm-$$i\" -> \"/g" | \
116                         sed "s/$$/\";/g" >> $@ ; \
117         done
118         $(H)mv $@ $@.old ; \
119                 ./simplify_deps/simplify_deps.opt < $@.old > $@ ; \
120                 rm $@.old
121         $(H)for i in $(MODULES); do \
122                 echo "\"helm-$$i\" [shape=box,style=filled,fillcolor=yellow];"\
123                         >> $@ ; \
124         done
125         $(H)echo "}" >> $@
126
127 .extdep.dot: .dep.dot
128         $(H)STATS/patch_deps.sh $< $@
129 .clustersdep.dot: .dep.dot
130         $(H)USE_CLUSTERS=yes STATS/patch_deps.sh $< $@
131
132 libraries.ps: .dep.dot
133         $(H)dot -Tps -o $@ $<
134 libraries-ext.ps: .extdep.dot
135         $(H)dot -Tps -o $@ $<
136 libraries-clusters.ps: .clustersdep.dot
137         $(H)dot -Tps -o $@ $<
138 libraries-complete.ps: .alldep.dot
139         $(H)dot -Tps -o $@ $<
140
141 ps: libraries.ps libraries-ext.ps libraries-clusters.ps
142
143 tags: TAGS
144 .PHONY: TAGS
145 TAGS:
146         $(H)otags -vi -r .
147
148 metas: $(filter-out METAS/META.helm-binaries, $(METAS))