2 XOA_DIR = ../../../components/binaries/xoa
4 DEP_DIR = ../../../components/binaries/matitadep
7 CONF = ground_2/xoa.conf.xml
8 TARGETS = ground_2/xoa_natation.ma ground_2/xoa.ma
12 ORIGS = basic_2/basic_1.orig
14 PACKAGES = ground_2 basic_2 apps_2
18 # xoa ########################################################################
23 @echo " EXEC $(XOA) $(CONF)"
24 $(H)MATITA_RT_BASE_DIR=../.. $(XOA_DIR)/$(XOA) $(CONF)
26 # orig #######################################################################
30 $(H)$(ORIG) basic_2 < $(ORIGS)
32 # dep ########################################################################
34 deps: MAS = $(shell find $* -name "*.ma")
36 deps: $(DEP_DIR)/$(DEP)
38 $(H)grep "include \"" $(MAS) | $<
40 # stats ######################################################################
42 stats: $(PACKAGES:%=%.stats)
44 %.stats: MAS = $(shell find $* -name "*.ma")
46 %.stats: CHARS = $(shell cat $(MAS) | wc -c)
49 @printf '\x1B[1;40;37m'
50 @printf '%-15s %-42s' 'Statistics for:' $*
52 @printf '\x1B[1;40;35m'
53 @printf '%-8s %6i' Chars $(CHARS)
54 @printf ' %-8s %5i' Lines `cat $(MAS) | wc -l`
55 @printf ' %-6s %3i' Pages `echo $$(($(CHARS) / 5120))`
58 @printf '\x1B[1;40;36m'
59 @printf '%-8s %6i' Sources `ls $(MAS) | wc -l`
61 # @printf ' %-8s %5i' Objs `ls *.vo | wc -l`
62 # @printf ' %-6s %3i' Files `ls *.v | wc -l`
64 @printf '\x1B[1;40;32m'
65 @printf '%-8s %6i' Theorems `grep "theorem " $(MAS) | wc -l`
66 @printf ' %-8s %5i' Lemmas `grep "lemma " $(MAS) | wc -l`
67 @printf ' %-6s %3i' Facts `grep "fact " $(MAS) | wc -l`
68 @printf ' %-6s %3i' Proofs `grep qed $(MAS) | wc -l`
70 @printf '\x1B[1;40;33m'
71 @printf '%-8s %6i' Defs `grep "definition\|let rec\|inductive\|record" $(MAS) | wc -l`
73 # @printf ' %-8s %5i' Local `grep "Local" *.v | wc -l`
75 @printf '\x1B[1;40;31m'
76 @printf '%-8s %6i' Axioms `grep axiom $(MAS) | wc -l`
77 @printf ' %-8s %5i' Comments `grep "(\*[^*:]*$$" $(MAS) | wc -l`
78 @printf ' %-6s %3i' Marks `grep "(\*\*)" $(MAS) | wc -l`
82 # summary ####################################################################
84 define SUMMARY_TEMPLATE
85 TBL_$(1) := $(1)/$(1)_sum.tbl
86 MAS_$(1) := $$(shell find $(1) -name "*.ma")
89 $$(TBL_$(1)): V1 := $$(shell ls $$(MAS_$(1)) | wc -l)
90 $$(TBL_$(1)): V2 := $$(shell cat $$(MAS_$(1)) | wc -c)
91 $$(TBL_$(1)): C1 := $$(shell grep "inductive \|record " $$(MAS_$(1)) | wc -l)
92 $$(TBL_$(1)): C2 := $$(shell grep "definition \|let rec " $$(MAS_$(1)) | wc -l)
93 $$(TBL_$(1)): C3 := $$(shell grep "inductive \|record \|definition \|let rec " $$(MAS_$(1)) | wc -l)
94 $$(TBL_$(1)): P1 := $$(shell grep "theorem " $$(MAS_$(1)) | wc -l)
95 $$(TBL_$(1)): P2 := $$(shell grep "lemma " $$(MAS_$(1)) | wc -l)
96 $$(TBL_$(1)): P3 := $$(shell grep "lemma \|theorem " $$(MAS_$(1)) | wc -l)
98 $$(TBL_$(1)): $$(MAS_$(1))
99 @printf ' SUMMARY $(1)\n'
100 @printf 'name "$$(basename $$(@F))"\n\n' > $$@
101 @printf 'table {\n' >> $$@
102 @printf ' class "grey" [ "category"\n' >> $$@
103 @printf ' [ "objects" * ]\n' >> $$@
104 @printf ' ]\n' >> $$@
105 @printf ' class "cyan" [ "sizes"\n' >> $$@
106 @printf ' [ "files" "$$(V1)" ]\n' >> $$@
107 @printf ' [ "bytes" "$$(V2)" ]\n' >> $$@
108 @printf ' [ * ]\n' >> $$@
109 @printf ' ]\n' >> $$@
110 @printf ' class "green" [ "propositions"\n' >> $$@
111 @printf ' [ "theorems" "$$(P1)" ]\n' >> $$@
112 @printf ' [ "lemmas" "$$(P2)" ]\n' >> $$@
113 @printf ' [ "total" "$$(P3)" ]\n' >> $$@
114 @printf ' ]\n' >> $$@
115 @printf ' class "yellow" [ "concepts"\n' >> $$@
116 @printf ' [ "declared" "$$(C1)" ]\n' >> $$@
117 @printf ' [ "defined" "$$(C2)" ]\n' >> $$@
118 @printf ' [ "total" "$$(C3)" ]\n' >> $$@
119 @printf ' ]\n' >> $$@
120 @printf '}\n\n' >> $$@
121 @printf 'class "component" { 0 }\n\n' >> $$@
122 @printf 'class "plane" { 1 } { 3 } { 5 }\n\n' >> $$@
123 @printf 'class "number" { 2 } { 4 } { 6 }\n\n' >> $$@
126 $(foreach PKG, $(PACKAGES), $(eval $(call SUMMARY_TEMPLATE,$(PKG))))