4 TRIM := sed "s/ \\+$$//"
6 XOA_DIR := ../../../components/binaries/xoa
8 XOA_CONF := ground_2/xoa.conf.xml
9 XOA_TARGETS := ground_2/xoa_notation.ma ground_2/xoa.ma
11 DEP_DIR := ../../../components/binaries/matitadep
12 DEP := matitadep.native
14 MAC_DIR := ../../../components/binaries/mac
17 PRB_DIR := ../../../components/binaries/probe
19 PRB_OPTS := ../../matita.conf.xml $(XOA_CONF) -g
22 ORIGS := basic_2/basic_1.orig
24 TAGS := all xoa orig deps stats tbls trim
26 PACKAGES := ground_2 basic_2 apps_2
28 LDWS := $(shell find -name "*.ldw.xml")
29 TBLS := $(shell find -name "*.tbl")
34 # MAS ########################################################################
37 MAS_$(1) := $$(shell find $(1) -name "*.ma")
40 $(1)/$(1)_probe.txt: $$(MAS_$(1))
42 $$(H)$$(PRB_DIR)/$$(PRB) $$(PRB_OPTS) $(1) -sn -on -i > $$@
45 $(foreach PKG, $(PACKAGES), $(eval $(call MAS_TEMPLATE,$(PKG))))
47 # xoa ########################################################################
51 $(XOA_TARGETS): $(XOA_CONF)
52 @echo " EXEC $(XOA) $(XOA_CONF)"
53 $(H)MATITA_RT_BASE_DIR=../.. $(XOA_DIR)/$(XOA) $(XOA_CONF)
55 # orig #######################################################################
59 $(H)$(ORIG) basic_2 < $<
61 # dep ########################################################################
63 deps: $(DEP_DIR)/$(DEP)
65 $(H)grep "include \"" $(MAS) | $<
67 # stats ######################################################################
70 STT_$(1) := $(1).stats
73 $$(STT_$(1)): S0 = $$(shell cat $(1)/$(1)_probe.txt)
74 $$(STT_$(1)): S1 := $$(shell $$(MAC_DIR)/$$(MAC) $$(MAS_$(1)))
75 $$(STT_$(1)): S3 = $$(shell echo $$$$(($$(S1) / 5120)))
76 $$(STT_$(1)): S4 = $$(shell ls $$(MAS_$(1)) | wc -l)
77 $$(STT_$(1)): P1 = $$(shell grep "theorem " $$(MAS_$(1)) | wc -l)
78 $$(STT_$(1)): P2 = $$(shell grep "lemma " $$(MAS_$(1)) | wc -l)
79 $$(STT_$(1)): P3 = $$(shell grep "fact " $$(MAS_$(1)) | wc -l)
80 $$(STT_$(1)): P4 = $$(shell grep qed $$(MAS_$(1)) | wc -l)
81 $$(STT_$(1)): C1 = $$(shell grep "inductive \|record " $$(MAS_$(1)) | wc -l)
82 $$(STT_$(1)): C2 = $$(shell grep "definition \|let rec " $$(MAS_$(1)) | wc -l)
83 $$(STT_$(1)): M1 = $$(shell grep "axiom " $$(MAS_$(1)) | wc -l)
84 $$(STT_$(1)): M2 = $$(shell grep "$$(OPEN)\*[^*:]*$$$$" $$(MAS_$(1)) | wc -l)
85 $$(STT_$(1)): M3 = $$(shell grep "(\*\*)" $$(MAS_$(1)) | wc -l)
87 $$(STT_$(1)): $$(MAS_$(1)) $(1)/$(1)_probe.txt
88 @printf '\x1B[1;40;37m'
89 @printf '%-15s %-47s' 'Statistics for:' $(1)
91 @printf '\x1B[1;40;35m'
92 @printf '%-8s %6i' Chars $$(S1)
93 @printf ' %-8s %4i' Pages $$(S3)
94 @printf ' %-7s %7i' Nodes $$(word 3, $$(S0))
97 @printf '\x1B[1;40;36m'
98 @printf '%-8s %6i' Files $$(S4)
99 @printf ' %-8s %4i' Sources $$(word 1, $$(S0))
100 @printf ' %-7s %7i' Objects $$(word 2, $$(S0))
103 @printf '\x1B[1;40;32m'
104 @printf '%-8s %6i' Theorems $$(P1)
105 @printf ' %-8s %4i' Lemmas $$(P2)
106 @printf ' %-7s %7i' Facts $$(P3)
107 @printf ' %-6s %4i' Proofs $$(P4)
109 @printf '\x1B[1;40;33m'
110 @printf '%-8s %6i' Declared $$(C1)
111 @printf ' %-8s %4i' Defined $$(C2)
114 @printf '\x1B[1;40;31m'
115 @printf '%-8s %6i' Axioms $$(M1)
116 @printf ' %-8s %4i' Comments $$(M2)
117 @printf ' %-7s %7i' Marks $$(M3)
124 ifeq ($(MAKECMDGOALS), stats)
125 $(foreach PKG, $(PACKAGES), $(eval $(call STATS_TEMPLATE,$(PKG))))
130 # summary ####################################################################
132 define SUMMARY_TEMPLATE
133 SUM_$(1) := $(1)/web/$(1)_sum.tbl
136 $$(SUM_$(1)): S0 = $$(shell cat $(1)/$(1)_probe.txt)
137 $$(SUM_$(1)): S1 = $$(shell $$(MAC_DIR)/$$(MAC) $$(MAS_$(1)))
138 $$(SUM_$(1)): S4 = $$(shell ls $$(MAS_$(1)) | wc -l)
139 $$(SUM_$(1)): C1 = $$(shell grep "inductive \|record " $$(MAS_$(1)) | wc -l)
140 $$(SUM_$(1)): C2 = $$(shell grep "definition \|let rec " $$(MAS_$(1)) | wc -l)
141 $$(SUM_$(1)): C3 = $$(shell grep "inductive \|record \|definition \|let rec " $$(MAS_$(1)) | wc -l)
142 $$(SUM_$(1)): P1 = $$(shell grep "theorem " $$(MAS_$(1)) | wc -l)
143 $$(SUM_$(1)): P2 = $$(shell grep "lemma " $$(MAS_$(1)) | wc -l)
144 $$(SUM_$(1)): P3 = $$(shell grep "lemma \|theorem " $$(MAS_$(1)) | wc -l)
146 $$(SUM_$(1)): $$(MAS_$(1)) $(1)/$(1)_probe.txt
147 @printf ' SUMMARY $(1)\n'
148 @printf 'name "$$(basename $$(@F))"\n\n' > $$@
149 @printf 'table {\n' >> $$@
150 @printf ' class "grey" [ "category"\n' >> $$@
151 @printf ' [ "objects" * ]\n' >> $$@
152 @printf ' ]\n' >> $$@
153 @printf ' class "cyan" [ "sizes"\n' >> $$@
154 @printf ' [ "files" "$$(S4)" ]\n' >> $$@
155 @printf ' [ "characters" "$$(S1)" ]\n' >> $$@
156 @printf ' [ "nodes" "$$(word 3, $$(S0))" ]\n' >> $$@
157 @printf ' ]\n' >> $$@
158 @printf ' class "green" [ "propositions"\n' >> $$@
159 @printf ' [ "theorems" "$$(P1)" ]\n' >> $$@
160 @printf ' [ "lemmas" "$$(P2)" ]\n' >> $$@
161 @printf ' [ "total" "$$(P3)" ]\n' >> $$@
162 @printf ' ]\n' >> $$@
163 @printf ' class "yellow" [ "concepts"\n' >> $$@
164 @printf ' [ "declared" "$$(C1)" ]\n' >> $$@
165 @printf ' [ "defined" "$$(C2)" ]\n' >> $$@
166 @printf ' [ "total" "$$(C3)" ]\n' >> $$@
167 @printf ' ]\n' >> $$@
168 @printf '}\n\n' >> $$@
169 @printf 'class "component" { 0 }\n\n' >> $$@
170 @printf 'class "plane" { 1 } { 3 } { 5 }\n\n' >> $$@
171 @printf 'class "number" { 2 } { 4 } { 6 }\n' >> $$@
174 ifeq ($(MAKECMDGOALS), tbls)
175 $(foreach PKG, $(PACKAGES), $(eval $(call SUMMARY_TEMPLATE,$(PKG))))
180 # trim #######################################################################
182 TRIMS := $(MAS) $(TBLS) $(LDWS)
185 $(H)expand $< | $(TRIM) > $@
186 $(H)if diff $< $@ > /dev/null; then $(RM) $@; else echo " TRIM $<" & mv $@ $<; fi
188 trim: $(TRIMS:%=%.trimmed)
190 ##############################################################################