4 TRIM := sed "s/ \\+$$//"
6 XOA_CONF := ground_2/xoa.conf.xml
7 XOA_TARGETS := ground_2/notation/xoa/notation.ma ground_2/xoa/xoa.ma
9 XOA_DIR := ../../../components/binaries/xoa
11 XOA_OPTS := ../../matita.conf.xml $(XOA_CONF)
13 XOA2_CONF := ground_2/xoa2.conf.xml
14 XOA2_OPTS := ../../matita.conf.xml $(XOA2_CONF)
17 DEP_DIR := ../../../components/binaries/matitadep
18 DEP := matitadep.native
21 PRB_DIR := ../../../components/binaries/probe
23 PRB_OPTS := $(XOA_OPTS) -g -i
26 ORIGS := basic_2/basic_1.orig
28 CONTRIB := lambdadelta_2B
30 WWW := ../../../../helm/www/lambdadelta
32 TAGS := all xoa xoa2 orig elim deps top leaf stats tbls odeps trim contrib clean \
35 PACKAGES := ground_2 static_2 basic_2 apps_2 alpha_1
36 XPACKAGES := ground_2 static_2 basic_2
38 LDWS := $(shell find -name "*.ldw.xml")
39 TBLS := $(shell find -name "*.tbl")
42 @echo " MATITAC $(PACKAGES)"
43 $(H)../../matitac.opt $(PACKAGES)
45 # MAS ########################################################################
48 MAS_$(1) := $$(shell find $(1) -name "*.ma")
51 $(1)/probe.txt: $$(MAS_$(1))
53 $$(H)$$(PRB_DIR)/$$(PRB) $$(PRB_OPTS) $(1) -sn -sc -on -oc -f > $$@
55 $(1)/deps.txt: $$(MAS_$(1))
57 $$(H)$$(PRB_DIR)/$$(PRB) $$(PRB_OPTS) $(1) -b $$@
61 $(foreach PKG, $(PACKAGES), $(eval $(call MAS_TEMPLATE,$(PKG))))
63 # XMAS #######################################################################
69 $(foreach PKG, $(XPACKAGES), $(eval $(call XMAS_TEMPLATE,$(PKG))))
71 # xoa ########################################################################
75 $(XOA_TARGETS): $(XOA_CONF)
76 @echo " EXEC $(XOA) $(XOA_CONF)"
77 $(H)$(XOA_DIR)/$(XOA) $(XOA_OPTS)
79 # xoa2 #######################################################################
82 @echo " EXEC $(XOA) $(XOA2_CONF)"
83 $(H)MATITA_RT_BASE_DIR=../.. $(XOA_DIR)/$(XOA) -s $(XOA2_OPTS)
85 # elim #######################################################################
89 $(H)grep "elim (.*?)" $(MAS) || true
91 # orig #######################################################################
95 $(H)$(ORIG) basic_2 < $<
97 # dep input ##################################################################
99 $(DEP_INPUT): LINE = $(MAS:%=%:include \"\".)
101 $(DEP_INPUT): $(MAS) Makefile
102 @echo " GREP include"
103 $(H)grep "include \"" $(MAS) > $(DEP_INPUT)
104 $(H)echo "$(LINE)" | sed -e 's/\"\. /\"\.\n/g' >> $(DEP_INPUT)
106 # dep ########################################################################
109 @echo " MATITADEP -c"
110 $(H)$(DEP_DIR)/$(DEP) -c $(DEP_OPTS) $<
112 # top ########################################################################
115 @echo " MATITADEP -t"
116 $(H)$(DEP_DIR)/$(DEP) -t $(DEP_OPTS) $<
118 # leaf #######################################################################
121 @echo " MATITADEP -l"
122 $(H)$(DEP_DIR)/$(DEP) -l $(DEP_OPTS) $<
124 # stats ######################################################################
126 define STATS_TEMPLATE
127 STT_$(1) := $(1).stats
130 $$(STT_$(1)): C0 = $$(shell cat $(1)/probe.txt)
131 $$(STT_$(1)): C2 = $$(word 2, $$(C0))
132 $$(STT_$(1)): C3 = $$(word 4, $$(C0))
133 $$(STT_$(1)): O1 = $$(shell ls $$(MAS_$(1)) | wc -l)
134 $$(STT_$(1)): O2 = $$(word 1, $$(C0))
135 $$(STT_$(1)): O3 = $$(word 3, $$(C0))
136 $$(STT_$(1)): P1 = $$(word 10, $$(C0))
137 $$(STT_$(1)): P2 = $$(word 9, $$(C0))
138 $$(STT_$(1)): P3 = $$(word 8, $$(C0))
139 $$(STT_$(1)): P4 = $$(shell grep "qed[.-]" $$(MAS_$(1)) | wc -l)
140 $$(STT_$(1)): D1 = $$(word 5, $$(C0))
141 $$(STT_$(1)): D2 = $$(word 7, $$(C0))
142 $$(STT_$(1)): D3 = $$(shell grep "defined[.-]" $$(MAS_$(1)) | wc -l)
143 $$(STT_$(1)): M1 = $$(word 6, $$(C0))
144 $$(STT_$(1)): M2 = $$(shell grep "$$(OPEN)\*[^*:]*$$$$" $$(MAS_$(1)) | wc -l)
145 $$(STT_$(1)): M3 = $$(shell grep "(\*\*)" $$(MAS_$(1)) | wc -l)
147 $$(STT_$(1)): $$(MAS_$(1)) $(1)/probe.txt
148 @printf '\x1B[1;40;37m'
149 @printf '%-15s %-46s' 'Statistics for:' $(1)
151 @printf '\x1B[1;40;35m'
153 @printf ' %-8s %6i' Chars $$(C2)
154 @printf ' %-7s %7i' Nodes $$(C3)
157 @printf '\x1B[1;40;36m'
158 @printf '%-8s %3i' Files $$(O1)
159 @printf ' %-8s %6i' Sources $$(O2)
160 @printf ' %-7s %7i' Objects $$(O3)
163 @printf '\x1B[1;40;32m'
164 @printf '%-8s %3i' Theorems $$(P1)
165 @printf ' %-8s %6i' Lemmas $$(P2)
166 @printf ' %-7s %7i' Facts $$(P3)
167 @printf ' %-6s %4i' Proofs $$(P4)
169 @printf '\x1B[1;40;33m'
170 @printf '%-8s %3i' Declared $$(D1)
171 @printf ' %-8s %6i' Defined $$(D2)
172 @printf ' %-7s %7i' Proved $$(D3)
175 @printf '\x1B[1;40;31m'
176 @printf '%-8s %3i' Axioms $$(M1)
177 @printf ' %-8s %6i' Comments $$(M2)
178 @printf ' %-7s %7i' Marks $$(M3)
185 ifeq ($(MAKECMDGOALS), stats)
186 $(foreach PKG, $(PACKAGES), $(eval $(call STATS_TEMPLATE,$(PKG))))
191 # summary ####################################################################
193 define SUMMARY_TEMPLATE
194 SUM_$(1) := $(1)/web/$(1)_sum.tbl
197 $$(SUM_$(1)): C0 = $$(shell cat $(1)/probe.txt)
198 $$(SUM_$(1)): S1 = $$(word 1, $$(C0))
199 $$(SUM_$(1)): S2 = $$(word 2, $$(C0))
200 $$(SUM_$(1)): S3 = $$(word 3, $$(C0))
201 $$(SUM_$(1)): S4 = $$(word 4, $$(C0))
202 $$(SUM_$(1)): S5 = $$(shell printf "%.1f" `echo "scale=2;$$(S4)/$$(S2)"|bc`)
203 $$(SUM_$(1)): C1 = $$(word 5, $$(C0))
204 $$(SUM_$(1)): C2 = $$(word 7, $$(C0))
205 $$(SUM_$(1)): C3 = $$(shell echo "$$(C1)+$$(C2)"|bc)
206 $$(SUM_$(1)): P1 = $$(word 10, $$(C0))
207 $$(SUM_$(1)): P2 = $$(word 9, $$(C0))
208 $$(SUM_$(1)): P3 = $$(shell echo "$$(P1)+$$(P2)"|bc)
210 $$(SUM_$(1)): $$(MAS_$(1)) $(1)/probe.txt Makefile
211 @printf ' SUMMARY $(1)\n'
212 @printf 'name "$$(basename $$(@F))"\n\n' > $$@
213 @printf 'table {\n' >> $$@
214 @printf ' class "gray" [ "category"\n' >> $$@
215 @printf ' [ "units" * ]\n' >> $$@
216 @printf ' ]\n' >> $$@
217 @printf ' class "water" [ "sizes"\n' >> $$@
218 @printf ' [ "characters (files)" "$$(S2) ($$(S1))" ]\n' >> $$@
219 @printf ' [ "nodes (objects)" "$$(S4) ($$(S3))" ]\n' >> $$@
220 @printf ' [ "intrinsic loss factor" "$$(S5)" ]\n' >> $$@
221 @printf ' ]\n' >> $$@
222 @printf ' class "green" [ "propositions"\n' >> $$@
223 @printf ' [ "theorems" "$$(P1)" ]\n' >> $$@
224 @printf ' [ "lemmas" "$$(P2)" ]\n' >> $$@
225 @printf ' [ "total" "$$(P3)" ]\n' >> $$@
226 @printf ' ]\n' >> $$@
227 @printf ' class "grass" [ "concepts"\n' >> $$@
228 @printf ' [ "declared" "$$(C1)" ]\n' >> $$@
229 @printf ' [ "defined" "$$(C2)" ]\n' >> $$@
230 @printf ' [ "total" "$$(C3)" ]\n' >> $$@
231 @printf ' ]\n' >> $$@
232 @printf '}\n\n' >> $$@
233 @printf 'class "capitalize italic" { 0 }\n\n' >> $$@
234 @printf 'class "italic" { 1 } { 3 } { 5 }\n\n' >> $$@
235 @printf 'class "right italic" { 2 } { 4 } { 6 }\n' >> $$@
240 ifeq ($(MAKECMDGOALS), tbls)
241 $(foreach PKG, $(PACKAGES), $(eval $(call SUMMARY_TEMPLATE,$(PKG))))
246 # odeps ######################################################################
248 odeps: $(PACKAGES:%=%/deps.txt)
250 # trim #######################################################################
252 TRIMS := $(MAS) $(TBLS) $(LDWS)
255 $(H)expand $< | $(TRIM) > $@
256 $(H)if diff $< $@ > /dev/null; then $(RM) $@; else echo " TRIM $<" & mv $@ $<; fi
258 trim: $(TRIMS:%=%.trimmed)
260 # contrib ####################################################################
263 @echo " TAR -cjf $(CONTRIB).tar.bz2 root $(XPACKAGES)"
264 $(H)tar -cjf $(CONTRIB).tar.bz2 ../lambdadelta/root $(XMAS:%=../lambdadelta/%)
266 # clean ######################################################################
269 $(H)$(RM) `find -name "*~" -type f -print`
271 # www ######################################################################
274 $(H)$(MAKE) --no-print-directory -C $(WWW) home
276 # www ######################################################################
279 $(H)$(MAKE) --no-print-directory -C $(WWW) up-home
281 ##############################################################################