4 TRIM := sed "s/ \\+$$//"
6 XOA_DIR := ../../../components/binaries/xoa
8 XOA_CONF := ground/xoa.conf.xml
9 XOA_OPTS := ../../matita.conf.xml $(XOA_CONF)
12 DEP_DIR := ../../../components/binaries/matitadep
13 DEP := matitadep.native
16 PRB_DIR := ../../../components/binaries/probe
18 PRB_OPTS := $(XOA_OPTS) -g -i
21 ORIGS := basic_2/basic_1.orig
23 WWW := ../../../../helm/www/lambdadelta
25 TAGS := all names xoa orig elim deps top leaf stats tbls odeps trim clean \
26 pack-ground pack-2a pack-2b \
29 PACKAGES := ground basic_2A static_2 basic_2 apps_2 alpha_1 delayed_updating
31 LDWS := $(shell find -name "*.ldw.xml")
32 TBLS := $(shell find -name "*.tbl")
35 @echo " MATITAC $(PACKAGES)"
36 $(H)../../matitac.opt $(PACKAGES)
38 # MAS ########################################################################
41 MAS_$(1) := $$(shell find $(1) -name "*.ma")
44 $(1)/probe.txt: $$(MAS_$(1))
46 $$(H)$$(PRB_DIR)/$$(PRB) $$(PRB_OPTS) $(1) -sn -sc -on -oc -f > $$@
48 $(1)/deps.txt: $$(MAS_$(1))
50 $$(H)$$(PRB_DIR)/$$(PRB) $$(PRB_OPTS) $(1) -b $$@
54 $(foreach PKG, $(PACKAGES), $(eval $(call MAS_TEMPLATE,$(PKG))))
56 # names ######################################################################
58 NAMES = basic_1A basic_2A static_2 basic_2
62 $(H)$(PRB_DIR)/$(PRB) $(PRB_OPTS) $* -ns | sort > $@
64 names: $(NAMES:%=%/names.txt)
66 # xoa ########################################################################
69 @echo " EXEC $(XOA) $(XOA_CONF)"
70 $(H)MATITA_RT_BASE_DIR=../.. $(XOA_DIR)/$(XOA) -s $(XOA_OPTS)
72 # elim #######################################################################
76 $(H)grep "elim (.*?)" $(MAS) || true
78 # orig #######################################################################
82 $(H)$(ORIG) basic_2 < $<
84 # dep input ##################################################################
86 $(DEP_INPUT): LINE = $(MAS:%=%:include \"\".)
88 $(DEP_INPUT): $(MAS) Makefile
90 $(H)grep "include \"" $(MAS) > $(DEP_INPUT)
91 $(H)echo "$(LINE)" | sed -e 's/\"\. /\"\.\n/g' >> $(DEP_INPUT)
93 # dep ########################################################################
97 $(H)$(DEP_DIR)/$(DEP) -c $(DEP_OPTS) $<
99 # top ########################################################################
102 @echo " MATITADEP -t"
103 $(H)$(DEP_DIR)/$(DEP) -t $(DEP_OPTS) $<
105 # leaf #######################################################################
108 @echo " MATITADEP -l"
109 $(H)$(DEP_DIR)/$(DEP) -l $(DEP_OPTS) $<
111 # stats ######################################################################
113 define STATS_TEMPLATE
114 STT_$(1) := $(1).stats
117 $$(STT_$(1)): C0 = $$(shell cat $(1)/probe.txt)
118 $$(STT_$(1)): C2 = $$(word 2, $$(C0))
119 $$(STT_$(1)): C3 = $$(word 4, $$(C0))
120 $$(STT_$(1)): O1 = $$(shell ls $$(MAS_$(1)) | wc -l)
121 $$(STT_$(1)): O2 = $$(word 1, $$(C0))
122 $$(STT_$(1)): O3 = $$(word 3, $$(C0))
123 $$(STT_$(1)): P1 = $$(word 10, $$(C0))
124 $$(STT_$(1)): P2 = $$(word 9, $$(C0))
125 $$(STT_$(1)): P3 = $$(word 8, $$(C0))
126 $$(STT_$(1)): P4 = $$(shell grep "qed[.-]" $$(MAS_$(1)) | wc -l)
127 $$(STT_$(1)): D1 = $$(word 5, $$(C0))
128 $$(STT_$(1)): D2 = $$(word 7, $$(C0))
129 $$(STT_$(1)): D3 = $$(shell grep "defined[.-]" $$(MAS_$(1)) | wc -l)
130 $$(STT_$(1)): M1 = $$(word 6, $$(C0))
131 $$(STT_$(1)): M2 = $$(shell grep "$$(OPEN)\*[^*:]*$$$$" $$(MAS_$(1)) | wc -l)
132 $$(STT_$(1)): M3 = $$(shell grep "(\*\*)" $$(MAS_$(1)) | wc -l)
134 $$(STT_$(1)): $$(MAS_$(1)) $(1)/probe.txt
135 @printf '\x1B[1;40;37m'
136 @printf '%-15s %-46s' 'Statistics for:' $(1)
138 @printf '\x1B[1;40;35m'
140 @printf ' %-8s %6i' Chars $$(C2)
141 @printf ' %-7s %7i' Nodes $$(C3)
144 @printf '\x1B[1;40;36m'
145 @printf '%-8s %3i' Files $$(O1)
146 @printf ' %-8s %6i' Sources $$(O2)
147 @printf ' %-7s %7i' Objects $$(O3)
150 @printf '\x1B[1;40;32m'
151 @printf '%-8s %3i' Theorems $$(P1)
152 @printf ' %-8s %6i' Lemmas $$(P2)
153 @printf ' %-7s %7i' Facts $$(P3)
154 @printf ' %-6s %4i' Proofs $$(P4)
156 @printf '\x1B[1;40;33m'
157 @printf '%-8s %3i' Declared $$(D1)
158 @printf ' %-8s %6i' Defined $$(D2)
159 @printf ' %-7s %7i' Proved $$(D3)
162 @printf '\x1B[1;40;31m'
163 @printf '%-8s %3i' Axioms $$(M1)
164 @printf ' %-8s %6i' Comments $$(M2)
165 @printf ' %-7s %7i' Marks $$(M3)
172 ifeq ($(MAKECMDGOALS), stats)
173 $(foreach PKG, $(PACKAGES), $(eval $(call STATS_TEMPLATE,$(PKG))))
178 # summary ####################################################################
180 define SUMMARY_TEMPLATE
181 SUM_$(1) := $(1)/web/$(1)_sum.tbl
184 $$(SUM_$(1)): C0 = $$(shell cat $(1)/probe.txt)
185 $$(SUM_$(1)): S1 = $$(word 1, $$(C0))
186 $$(SUM_$(1)): S2 = $$(word 2, $$(C0))
187 $$(SUM_$(1)): S3 = $$(word 3, $$(C0))
188 $$(SUM_$(1)): S4 = $$(word 4, $$(C0))
189 $$(SUM_$(1)): S5 = $$(shell printf "%.1f" `echo "scale=2;if($$(S2)!=0)$$(S4)/$$(S2) else 0"|bc`)
190 $$(SUM_$(1)): C1 = $$(word 5, $$(C0))
191 $$(SUM_$(1)): C2 = $$(word 7, $$(C0))
192 $$(SUM_$(1)): C3 = $$(shell echo "$$(C1)+$$(C2)"|bc)
193 $$(SUM_$(1)): P1 = $$(word 10, $$(C0))
194 $$(SUM_$(1)): P2 = $$(word 9, $$(C0))
195 $$(SUM_$(1)): P3 = $$(shell echo "$$(P1)+$$(P2)"|bc)
197 $$(SUM_$(1)): $$(MAS_$(1)) $(1)/probe.txt Makefile
198 @printf ' SUMMARY $(1)\n'
199 @printf 'name "$$(basename $$(@F))"\n\n' > $$@
200 @printf 'table {\n' >> $$@
201 @printf ' class "gray" [ "category"\n' >> $$@
202 @printf ' [ "units" * ]\n' >> $$@
203 @printf ' ]\n' >> $$@
204 @printf ' class "water" [ "sizes"\n' >> $$@
205 @printf ' [ "characters (files)" "$$(S2) ($$(S1))" ]\n' >> $$@
206 @printf ' [ "nodes (objects)" "$$(S4) ($$(S3))" ]\n' >> $$@
207 @printf ' [ "intrinsic loss factor" "$$(S5)" ]\n' >> $$@
208 @printf ' ]\n' >> $$@
209 @printf ' class "green" [ "propositions"\n' >> $$@
210 @printf ' [ "theorems" "$$(P1)" ]\n' >> $$@
211 @printf ' [ "lemmas" "$$(P2)" ]\n' >> $$@
212 @printf ' [ "total" "$$(P3)" ]\n' >> $$@
213 @printf ' ]\n' >> $$@
214 @printf ' class "grass" [ "concepts"\n' >> $$@
215 @printf ' [ "declared" "$$(C1)" ]\n' >> $$@
216 @printf ' [ "defined" "$$(C2)" ]\n' >> $$@
217 @printf ' [ "total" "$$(C3)" ]\n' >> $$@
218 @printf ' ]\n' >> $$@
219 @printf '}\n\n' >> $$@
220 @printf 'class "capitalize italic" { 0 }\n\n' >> $$@
221 @printf 'class "italic" { 1 } { 3 } { 5 }\n\n' >> $$@
222 @printf 'class "right italic" { 2 } { 4 } { 6 }\n' >> $$@
227 ifeq ($(MAKECMDGOALS), tbls)
228 $(foreach PKG, $(PACKAGES), $(eval $(call SUMMARY_TEMPLATE,$(PKG))))
233 # odeps ######################################################################
235 odeps: $(PACKAGES:%=%/deps.txt)
237 # trim #######################################################################
239 TRIMS := $(MAS) $(TBLS) $(LDWS)
242 $(H)expand $< | $(TRIM) > $@
243 $(H)if diff $< $@ > /dev/null; then $(RM) $@; else echo " TRIM $<" & mv $@ $<; fi
245 trim: $(TRIMS:%=%.trimmed)
247 # package ground #############################################################
249 pack-ground: PKG = lambdadelta_ground
251 pack-ground: DIRS = ground
253 pack-ground: PMAS = $(shell find $(DIRS) -name *.ma)
256 @echo " TAR -cjf $(PKG).tar.bz2 root $(DIRS)"
257 $(H)tar -cjf $(PKG).tar.bz2 ../lambdadelta/root $(PMAS:%=../lambdadelta/%)
259 # package 2A ###################################################################
261 pack-2a: PKG = lambdadelta_2A
263 pack-2a: DIRS = basic_2A
265 pack-2a: PMAS = $(shell find $(DIRS) -name *.ma)
268 @echo " TAR -cjf $(PKG).tar.bz2 $(DIRS)"
269 $(H)tar -cjf $(PKG).tar.bz2 $(PMAS:%=../lambdadelta/%)
271 # package 2B ###################################################################
273 pack-2b: PKG = lambdadelta_2B
275 pack-2b: DIRS = static_2 basic_2
277 pack-2b: PMAS = $(shell find $(DIRS) -name *.ma)
280 @echo " TAR -cjf $(PKG).tar.bz2 $(DIRS)"
281 $(H)tar -cjf $(PKG).tar.bz2 $(PMAS:%=../lambdadelta/%)
283 # clean ######################################################################
286 $(H)$(RM) `find -name "*~" -type f -print`
288 # www ######################################################################
291 $(H)$(MAKE) --no-print-directory -C $(WWW) home
293 # www ######################################################################
296 $(H)$(MAKE) --no-print-directory -C $(WWW) up-home
298 ##############################################################################