2 XOA_DIR = ../../../components/binaries/xoa
4 DEP_DIR = ../../../components/binaries/matitadep
6 MAC_DIR = ../../../components/binaries/mac
9 XOA_CONF = ground_2/xoa.conf.xml
10 XOA_TARGETS = ground_2/xoa_notation.ma ground_2/xoa.ma
14 ORIGS = basic_2/basic_1.orig
16 PACKAGES = ground_2 basic_2 apps_2
21 # xoa ########################################################################
25 $(XOA_TARGETS): $(XOA_CONF)
26 @echo " EXEC $(XOA) $(XOA_CONF)"
27 $(H)MATITA_RT_BASE_DIR=../.. $(XOA_DIR)/$(XOA) $(XOA_CONF)
29 # orig #######################################################################
33 $(H)$(ORIG) basic_2 < $(ORIGS)
35 # dep ########################################################################
37 deps: MAS = $(shell find $* -name "*.ma")
39 deps: $(DEP_DIR)/$(DEP)
41 $(H)grep "include \"" $(MAS) | $<
43 # stats ######################################################################
45 stats: $(PACKAGES:%=%.stats)
47 %.stats: MAS = $(shell find $* -name "*.ma")
49 %.stats: CHARS = $(shell $(MAC_DIR)/$(MAC) $(MAS))
52 @printf '\x1B[1;40;37m'
53 @printf '%-15s %-40s' 'Statistics for:' $*
55 @printf '\x1B[1;40;35m'
56 @printf '%-8s %6i' Chars $(CHARS)
57 @printf ' %-8s %3i' Pages `echo $$(($(CHARS) / 5120))`
60 @printf '\x1B[1;40;36m'
61 @printf '%-8s %6i' Sources `ls $(MAS) | wc -l`
63 # @printf ' %-8s %5i' Objs `ls *.vo | wc -l`
64 # @printf ' %-6s %3i' Files `ls *.v | wc -l`
66 @printf '\x1B[1;40;32m'
67 @printf '%-8s %6i' Theorems `grep "theorem " $(MAS) | wc -l`
68 @printf ' %-8s %3i' Lemmas `grep "lemma " $(MAS) | wc -l`
69 @printf ' %-5s %3i' Facts `grep "fact " $(MAS) | wc -l`
70 @printf ' %-6s %4i' Proofs `grep qed $(MAS) | wc -l`
72 @printf '\x1B[1;40;33m'
73 @printf '%-8s %6i' Declared `grep "inductive \|record " $(MAS) | wc -l`
74 @printf ' %-8s %3i' Defined `grep "definition \|let rec " $(MAS) | wc -l`
76 # @printf ' %-8s %5i' Local `grep "Local" *.v | wc -l`
78 @printf '\x1B[1;40;31m'
79 @printf '%-8s %6i' Axioms `grep axiom $(MAS) | wc -l`
80 @printf ' %-8s %3i' Comments `grep "(\*[^*:]*$$" $(MAS) | wc -l`
81 @printf ' %-5s %3i' Marks `grep "(\*\*)" $(MAS) | wc -l`
85 # summary ####################################################################
87 define SUMMARY_TEMPLATE
88 TBL_$(1) := $(1)/$(1)_sum.tbl
89 MAS_$(1) := $$(shell find $(1) -name "*.ma")
92 $$(TBL_$(1)): V1 := $$(shell ls $$(MAS_$(1)) | wc -l)
93 $$(TBL_$(1)): V2 := $$(shell $$(MAC_DIR)/$$(MAC) $$(MAS_$(1)))
94 $$(TBL_$(1)): C1 := $$(shell grep "inductive \|record " $$(MAS_$(1)) | wc -l)
95 $$(TBL_$(1)): C2 := $$(shell grep "definition \|let rec " $$(MAS_$(1)) | wc -l)
96 $$(TBL_$(1)): C3 := $$(shell grep "inductive \|record \|definition \|let rec " $$(MAS_$(1)) | wc -l)
97 $$(TBL_$(1)): P1 := $$(shell grep "theorem " $$(MAS_$(1)) | wc -l)
98 $$(TBL_$(1)): P2 := $$(shell grep "lemma " $$(MAS_$(1)) | wc -l)
99 $$(TBL_$(1)): P3 := $$(shell grep "lemma \|theorem " $$(MAS_$(1)) | wc -l)
101 $$(TBL_$(1)): $$(MAS_$(1))
102 @printf ' SUMMARY $(1)\n'
103 @printf 'name "$$(basename $$(@F))"\n\n' > $$@
104 @printf 'table {\n' >> $$@
105 @printf ' class "grey" [ "category"\n' >> $$@
106 @printf ' [ "objects" * ]\n' >> $$@
107 @printf ' ]\n' >> $$@
108 @printf ' class "cyan" [ "sizes"\n' >> $$@
109 @printf ' [ "files" "$$(V1)" ]\n' >> $$@
110 @printf ' [ "characters" "$$(V2)" ]\n' >> $$@
111 @printf ' [ * ]\n' >> $$@
112 @printf ' ]\n' >> $$@
113 @printf ' class "green" [ "propositions"\n' >> $$@
114 @printf ' [ "theorems" "$$(P1)" ]\n' >> $$@
115 @printf ' [ "lemmas" "$$(P2)" ]\n' >> $$@
116 @printf ' [ "total" "$$(P3)" ]\n' >> $$@
117 @printf ' ]\n' >> $$@
118 @printf ' class "yellow" [ "concepts"\n' >> $$@
119 @printf ' [ "declared" "$$(C1)" ]\n' >> $$@
120 @printf ' [ "defined" "$$(C2)" ]\n' >> $$@
121 @printf ' [ "total" "$$(C3)" ]\n' >> $$@
122 @printf ' ]\n' >> $$@
123 @printf '}\n\n' >> $$@
124 @printf 'class "component" { 0 }\n\n' >> $$@
125 @printf 'class "plane" { 1 } { 3 } { 5 }\n\n' >> $$@
126 @printf 'class "number" { 2 } { 4 } { 6 }\n\n' >> $$@
129 $(foreach PKG, $(PACKAGES), $(eval $(call SUMMARY_TEMPLATE,$(PKG))))