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