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