## 
## Formalized Cut Elimination in Coalgebraic Logics
## 
## Copyright (C) 2013 - 2013 Hendrik Tews
## 
## This file is part of my formalization of "Cut Elimination in 
## Coalgebraic Logics" by Dirk Pattinson and Lutz Schroeder.
## 
## The formalization is free software: you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation, either version 3 of the
## License, or (at your option) any later version.
## 
## The formalization is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License in file COPYING in this or one of the parent
## directories for more details.
## 
## You should have received a copy of the GNU General Public License
## along with the formalization in the file COPYING. 
## If not, see <http://www.gnu.org/licenses/>.
## 
## $Id: Makefile,v 1.14.2.2 2013/04/10 12:25:45 tews Exp $
## 



all: compile


SOURCES:=$(wildcard *.v)
COMPILED:=$(SOURCES:.v=.vo)

.PHONY: compile
compile: $(COMPILED)

%.vo: %.v
	coqc $<

.PHONY: check
check: compile
	coqchk -m -o all 2>&1 | tee check.log


TOCLEAN+=Makefile.deps
Makefile.deps: $(SOURCES)
	coqdep -I . $(SOURCES) > Makefile.deps

include Makefile.deps


DOCSOURCES:=\
	misc\
	sets\
	lists\
	some_nth\
	dep_lists\
	reorder\
	list_set\
	list_multiset\
	list_support\
	assoc\
	some_neg\
	dsets\
	functions\
	image\
	classic\
	cast\
	\
	functor\
	slice\
	\
	formulas\
	substitution\
	propositional_formulas\
	modal_formulas\
	renaming\
	rules\
	rule_sets\
	admissibility\
	plain_prop_mod\
	\
	sequent_support\
	build_proof\
	backward_substitution\
	factor_subst\
	factor_two_subst\
	some_neg_form\
	\
	weakening\
	inversion\
	cut_properties\
	\
	generic_cut\
	propositional_rules\
	propositional_properties\
	propositional_models\
	propositional_sound\
	build_prop_proof\
	propositional_completeness\
	\
	semantics\
	one_step_conditions\
	step_semantics\
	\
	prop_mod\
	sound\
	complete \
	\
	absorb\
	contraction\
	osr_cut\
	mixed_cut\
	prop_cut\
	syntactic_cut\
	\
	k_syntax\
	k_semantics\
	k_sound_complete\
	k_absorb\
	k_nd\
	\
	ck\
	\
	all

DOCSOURCESV:=$(DOCSOURCES:=.v)


.PHONY: doc
doc:
	coqdep -I . *v | coqgraph - -check-order $(DOCSOURCES)
	rm -rf doc/html
	mkdir doc/html
	coqdoc -s -g -toc --index reference -utf8 \
               -d doc/html $(DOCSOURCESV)

.PHONY: deps
deps:
	coqdep -I .  *v | coqgraph - | dot -Tps > dependencies.ps

.PHONY: check-dep
check-dep:
	coqdep -I .  *v | coqgraph -check-req -

.PHONY: sloc
sloc:
	wc *v | sort -n

.PHONY: sloc-total
sloc-total:
	wc -l *v | grep total

tools/plot_labels: tools/plot_labels.ml
	ocamlopt.opt -o $@ $<

labels.gp: log.data tools/plot_labels
	tools/plot_labels log.data labels.gp

.PHONY: plot
plot: tools/plot_labels labels.gp
	gnuplot log.gp

.PHONY: TAGS
TAGS:
	coqtags *.v


.PHONY: clean
clean:
	rm -f *.vo *.glob
	rm -f $(TOCLEAN)

