]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/Makefile
- degree assignment, static type assignment, iterated static type
[helm.git] / matita / matita / contribs / lambdadelta / Makefile
1 OPEN := (
2 H    := @
3
4 TRIM := sed "s/ \\+$$//"
5
6 XOA_CONF     := ground_2/xoa.conf.xml
7 XOA_TARGETS  := ground_2/xoa_notation.ma ground_2/xoa.ma
8
9 XOA_DIR      := ../../../components/binaries/xoa
10 XOA          := xoa.native
11 XOA_OPTS     := ../../matita.conf.xml $(XOA_CONF)
12
13 XOA2_CONF    := ground_2/xoa2.conf.xml
14 XOA2_TARGETS := ground_2/xoa2_notation.ma ground_2/xoa2.ma
15 XOA2_OPTS    := ../../matita.conf.xml $(XOA2_CONF)
16
17 DEP_DIR      := ../../../components/binaries/matitadep
18 DEP          := matitadep.native
19
20 MAC_DIR      := ../../../components/binaries/mac
21 MAC          := mac.native
22 MAC_OPTS     :=
23
24 PRB_DIR      := ../../../components/binaries/probe
25 PRB          := probe.native
26 PRB_OPTS     := $(XOA_OPTS) -g 
27
28 ORIG         := . ./orig.sh 
29 ORIGS        := basic_2/basic_1.orig
30
31 TAGS := all xoa xoa2 orig elim deps top stats tbls trim
32
33 PACKAGES := ground_2 basic_2 apps_2
34
35 LDWS := $(shell find -name "*.ldw.xml")
36 TBLS := $(shell find -name "*.tbl")
37
38 all:
39         ../../matitac.opt
40
41 # MAS ########################################################################
42
43 define MAS_TEMPLATE
44   MAS_$(1) := $$(shell find $(1) -name "*.ma")
45   MAS      += $$(MAS_$(1))
46
47 $(1)/$(1)_probe.txt: $$(MAS_$(1))
48         @echo "  PROBE $(1)"
49         $$(H)$$(PRB_DIR)/$$(PRB) $$(PRB_OPTS) $(1) -sn -on -i > $$@
50
51 $(1)/$(1)_mac.txt: $$(MAS_$(1))
52         @echo "  MAC $(1)"
53         $$(H)$$(MAC_DIR)/$$(MAC) $$(MAC_OPTS) $$^ > $$@
54 endef
55
56 $(foreach PKG, $(PACKAGES), $(eval $(call MAS_TEMPLATE,$(PKG))))
57
58 # xoa ########################################################################
59
60 xoa: $(XOA_TARGETS)
61
62 $(XOA_TARGETS): $(XOA_CONF)
63         @echo "  EXEC $(XOA) $(XOA_CONF)"
64         $(H)MATITA_RT_BASE_DIR=../.. $(XOA_DIR)/$(XOA) $(XOA_OPTS)
65
66 # xoa2 #######################################################################
67
68 xoa2: $(XOA2_TARGETS)
69
70 $(XOA2_TARGETS): $(XOA2_CONF)
71         @echo "  EXEC $(XOA) $(XOA2_CONF)"
72         $(H)MATITA_RT_BASE_DIR=../.. $(XOA_DIR)/$(XOA) $(XOA2_OPTS)
73
74 # elim #######################################################################
75
76 elim:
77         @echo "  GREP elim"
78         $(H)grep "elim (.*?)" $(MAS) || true
79
80 # orig #######################################################################
81
82 orig: $(ORIGS)
83         @echo "  ORIG basic_2"
84         $(H)$(ORIG) basic_2 < $<
85
86 # dep ########################################################################
87
88 deps: $(DEP_DIR)/$(DEP)
89         @echo "  MATITADEP"
90         $(H)grep "include \"" $(MAS) | $<
91
92 # top ########################################################################
93
94 top: $(DEP_DIR)/$(DEP)
95         @echo "  MATITADEP -t"
96         $(H)grep "include \"" $(MAS) | $< -t
97
98 # stats ######################################################################
99
100 define STATS_TEMPLATE
101   STT_$(1) := $(1).stats
102   STTS     += $$(STT_$(1))
103
104   $$(STT_$(1)): S0  = $$(shell cat $(1)/$(1)_probe.txt)    
105   $$(STT_$(1)): S1  = $$(shell cat $(1)/$(1)_mac.txt)
106   $$(STT_$(1)): S4  = $$(shell ls $$(MAS_$(1)) | wc -l)
107   $$(STT_$(1)): P1  = $$(shell grep "theorem " $$(MAS_$(1)) | wc -l)
108   $$(STT_$(1)): P2  = $$(shell grep "lemma " $$(MAS_$(1)) | wc -l)
109   $$(STT_$(1)): P3  = $$(shell grep "fact " $$(MAS_$(1)) | wc -l)
110   $$(STT_$(1)): P4  = $$(shell grep qed $$(MAS_$(1)) | wc -l)
111   $$(STT_$(1)): C1  = $$(shell grep "inductive \|record " $$(MAS_$(1)) | wc -l)
112   $$(STT_$(1)): C2  = $$(shell grep "definition \|let rec " $$(MAS_$(1)) | wc -l)
113   $$(STT_$(1)): M1  = $$(shell grep "axiom " $$(MAS_$(1)) | wc -l)
114   $$(STT_$(1)): M2  = $$(shell grep "$$(OPEN)\*[^*:]*$$$$" $$(MAS_$(1)) | wc -l)
115   $$(STT_$(1)): M3  = $$(shell grep "(\*\*)" $$(MAS_$(1)) | wc -l)
116
117 $$(STT_$(1)): $$(MAS_$(1)) $(1)/$(1)_probe.txt $(1)/$(1)_mac.txt
118         @printf '\x1B[1;40;37m'
119         @printf '%-15s %-47s' 'Statistics for:' $(1)
120         @printf '\x1B[0m\n'
121         @printf '\x1B[1;40;35m'
122         @printf '%-8s %6i' Chars $$(word 1, $$(S1))
123         @printf '   %-8s %4i' Pages $$(word 2, $$(S1))
124         @printf '   %-7s %7i' Nodes $$(word 3, $$(S0))
125         @printf '   %-11s' ''
126         @printf '\x1B[0m\n'
127         @printf '\x1B[1;40;36m'
128         @printf '%-8s %6i' Files $$(S4)
129         @printf '   %-8s %4i' Sources $$(word 1, $$(S0))
130         @printf '   %-7s %7i' Objects $$(word 2, $$(S0))
131         @printf '   %-11s' ''
132         @printf '\x1B[0m\n'     
133         @printf '\x1B[1;40;32m'
134         @printf '%-8s %6i' Theorems $$(P1)
135         @printf '   %-8s %4i' Lemmas $$(P2)
136         @printf '   %-7s %7i' Facts $$(P3)
137         @printf '   %-6s %4i' Proofs $$(P4)
138         @printf '\x1B[0m\n'     
139         @printf '\x1B[1;40;33m'
140         @printf '%-8s %6i' Declared $$(C1)
141         @printf '   %-8s %4i' Defined $$(C2)    
142         @printf '   %-29s' ''
143         @printf '\x1B[0m\n'
144         @printf '\x1B[1;40;31m'
145         @printf '%-8s %6i' Axioms $$(M1)
146         @printf '   %-8s %4i' Comments $$(M2)
147         @printf '   %-7s %7i' Marks $$(M3)
148         @printf '   %-11s' ''
149         @printf '\x1B[0m\n'
150
151 .PHONY: $$(STT_$(1))
152 endef
153
154 ifeq ($(MAKECMDGOALS), stats)
155    $(foreach PKG, $(PACKAGES), $(eval $(call STATS_TEMPLATE,$(PKG))))
156 endif
157
158 stats: $(STTS)
159
160 # summary ####################################################################
161
162 define SUMMARY_TEMPLATE
163   SUM_$(1) := $(1)/web/$(1)_sum.tbl  
164   SUMS     += $$(SUM_$(1))
165
166   $$(SUM_$(1)): S0 = $$(shell cat $(1)/$(1)_probe.txt)  
167   $$(SUM_$(1)): S1 = $$(shell cat $(1)/$(1)_mac.txt)
168   $$(SUM_$(1)): S4 = $$(shell ls $$(MAS_$(1)) | wc -l)  
169   $$(SUM_$(1)): C1 = $$(shell grep "inductive \|record " $$(MAS_$(1)) | wc -l)
170   $$(SUM_$(1)): C2 = $$(shell grep "definition \|let rec " $$(MAS_$(1)) | wc -l)
171   $$(SUM_$(1)): C3 = $$(shell grep "inductive \|record \|definition \|let rec " $$(MAS_$(1)) | wc -l)
172   $$(SUM_$(1)): P1 = $$(shell grep "theorem " $$(MAS_$(1)) | wc -l)
173   $$(SUM_$(1)): P2 = $$(shell grep "lemma " $$(MAS_$(1)) | wc -l)
174   $$(SUM_$(1)): P3 = $$(shell grep "lemma \|theorem " $$(MAS_$(1)) | wc -l)
175
176   $$(SUM_$(1)): $$(MAS_$(1)) $(1)/$(1)_probe.txt $(1)/$(1)_mac.txt
177         @printf '  SUMMARY $(1)\n'
178         @printf 'name "$$(basename $$(@F))"\n\n'                >  $$@
179         @printf 'table {\n'                                     >> $$@
180         @printf '   class "grey"   [ "category"\n'              >> $$@
181         @printf '      [ "objects" * ]\n'                       >> $$@
182         @printf '   ]\n'                                        >> $$@
183         @printf '   class "cyan"   [ "sizes"\n'                 >> $$@
184         @printf '      [ "files"      "$$(S4)" ]\n'             >> $$@
185         @printf '      [ "characters" "$$(word 1, $$(S1))" ]\n' >> $$@
186         @printf '      [ "nodes"      "$$(word 3, $$(S0))" ]\n' >> $$@
187         @printf '   ]\n'                                        >> $$@  
188         @printf '   class "green"  [ "propositions"\n'          >> $$@
189         @printf '      [ "theorems" "$$(P1)" ]\n'               >> $$@
190         @printf '      [ "lemmas"   "$$(P2)" ]\n'               >> $$@
191         @printf '      [ "total"    "$$(P3)" ]\n'               >> $$@
192         @printf '   ]\n'                                        >> $$@
193         @printf '   class "yellow" [ "concepts"\n'              >> $$@
194         @printf '      [ "declared" "$$(C1)" ]\n'               >> $$@
195         @printf '      [ "defined"  "$$(C2)" ]\n'               >> $$@
196         @printf '      [ "total"    "$$(C3)" ]\n'               >> $$@
197         @printf '   ]\n'                                        >> $$@
198         @printf '}\n\n'                                         >> $$@
199         @printf 'class "component" { 0 }\n\n'                   >> $$@
200         @printf 'class "plane"     { 1 } { 3 } { 5 }\n\n'       >> $$@
201         @printf 'class "number"    { 2 } { 4 } { 6 }\n'         >> $$@
202
203 .PHONY: $$(SUM_$(1))
204 endef
205
206 ifeq ($(MAKECMDGOALS), tbls)
207    $(foreach PKG, $(PACKAGES), $(eval $(call SUMMARY_TEMPLATE,$(PKG))))
208 endif
209
210 tbls: $(SUMS)
211
212 # trim #######################################################################
213
214 TRIMS := $(MAS) $(TBLS) $(LDWS)
215
216 %.trimmed: %
217         $(H)expand $< | $(TRIM) > $@
218         $(H)if diff $< $@ > /dev/null; then $(RM) $@; else echo "  TRIM $<" & mv $@ $<; fi
219
220 trim: $(TRIMS:%=%.trimmed)
221
222 ##############################################################################
223
224 .PHONY: $(TAGS)
225
226 .SUFFIXES: