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