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