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