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