]> matita.cs.unibo.it Git - helm.git/blob - components/Makefile
- Procedural: moved in a directory on its own
[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         acic_procedural         \
28         content_pres            \
29         cic_unification         \
30         whelp                   \
31         tactics                 \
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 $(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: $(MODULES:%=rec@install@%)
59 uninstall: $(MODULES:%=rec@uninstall@%)
60 clean: $(MODULES:%=rec@clean@%) clean_metas
61
62 .stats: $(MODULES:%=rec@.stats@%)
63         $(H)(for m in $(MODULES); do echo -n "$$m:"; cat $$m/.stats; done) \
64          | sort -t : -k 2 -n -r > .stats
65
66 rec@%:
67         $(H)$(MAKE) -C $(word 2, $(subst @, ,$*)) $(word 1, $(subst @, ,$*))
68
69 EXTRA_DIST_CLEAN = \
70         libraries-clusters.ps   \
71         libraries-clusters.pdf  \
72         libraries-ext.ps        \
73         libraries.ps            \
74         .dep.dot                \
75         .extdep.dot             \
76         .clustersdep.dot        \
77         $(NULL)
78
79 distclean: clean clean_metas
80         $(H)rm -f $(METAS)
81         $(H)rm -f configure config.log config.cache config.status
82         $(H)rm -f $(EXTRA_DIST_CLEAN)
83
84 .PHONY: all opt world metas depend install uninstall clean clean_metas distclean
85
86 METAS/META.helm-%: METAS/meta.helm-%.src
87         $(H)cp $< $@ && echo "directory=\"$(shell pwd)/$*\"" >> $@
88
89 SIMPLIFYDEPS = ../daemons/graphs/tools/simplify_deps/simplify_deps
90 $(SIMPLIFYDEPS):
91         $(H)$(MAKE) -C $(dir $(SIMPLIFYDEPS))
92
93 .PHONY: .dep.dot
94 .dep.dot: $(SIMPLIFYDEPS)
95         $(H)echo "digraph G {" > $@
96         $(H)echo "   rankdir = TB ;" >> $@
97         $(H)for i in $(MODULES); do \
98                 $(OCAMLFIND) query helm-$$i -recursive -p-format | \
99                 grep helm | \
100                 sed "s/^helm-/ \"$$i\" -> \"/g" | \
101                 sed "s/$$/\";/g" >> $@ ; \
102         done
103         $(H)mv $@ $@.old ; $(SIMPLIFYDEPS) < $@.old > $@ ; rm $@.old
104         $(H)echo "}" >> $@
105
106 .PHONY: .alldep.dot
107 .alldep.dot:
108         $(H)echo "digraph G {" > $@
109         $(H)echo "   rankdir = TB ;" >> $@
110         $(H)for i in $(MODULES); do \
111                 $(OCAMLFIND) query helm-$$i -recursive -p-format | \
112                         grep -v "pxp-" | \
113                         sed "s/^pxp/pxp[-*]/g" | \
114                         sed "s/^/ \"helm-$$i\" -> \"/g" | \
115                         sed "s/$$/\";/g" >> $@ ; \
116         done
117         $(H)mv $@ $@.old ; \
118                 ./simplify_deps/simplify_deps.opt < $@.old > $@ ; \
119                 rm $@.old
120         $(H)for i in $(MODULES); do \
121                 echo "\"helm-$$i\" [shape=box,style=filled,fillcolor=yellow];"\
122                         >> $@ ; \
123         done
124         $(H)echo "}" >> $@
125
126 .extdep.dot: .dep.dot
127         $(H)STATS/patch_deps.sh $< $@
128 .clustersdep.dot: .dep.dot
129         $(H)USE_CLUSTERS=yes STATS/patch_deps.sh $< $@
130
131 libraries.ps: .dep.dot
132         $(H)dot -Tps -o $@ $<
133 libraries-ext.ps: .extdep.dot
134         $(H)dot -Tps -o $@ $<
135 libraries-clusters.ps: .clustersdep.dot
136         $(H)dot -Tps -o $@ $<
137 libraries-complete.ps: .alldep.dot
138         $(H)dot -Tps -o $@ $<
139
140 ps: libraries.ps libraries-ext.ps libraries-clusters.ps
141
142 tags: TAGS
143 .PHONY: TAGS
144 TAGS:
145         $(H)otags -vi -r .
146
147 metas: $(filter-out METAS/META.helm-binaries, $(METAS))