File: Makefile

package info (click to toggle)
coq-simple-io 1.11.0-3
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 380 kB
  • sloc: ml: 273; makefile: 67
file content (78 lines) | stat: -rw-r--r-- 1,960 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
NAME=coq-simple-io

MAKEFILE_COQ = Makefile.coq
MAKE_COQ = $(MAKE) -f $(MAKEFILE_COQ)

.PHONY: all build install clean example depgraph doc html html-raw compat test

build: $(MAKEFILE_COQ) compat
	$(MAKE_COQ)

doc: html

# NOT RECOMMENDED: coq_makefile's install doesn't install plugins as libraries
install: build
	$(MAKE_COQ) install

uninstall: $(MAKEFILE_COQ)
	$(MAKE_COQ) uninstall

$(MAKEFILE_COQ): _CoqProject
	coq_makefile -f $< -o $@

COMPATFILES:=_CoqProject \
  test/TestInt63.v

compat: $(COMPATFILES)

COQ_VERSION:=$(word 1, $(shell coqc -print-version))
OCAML_VERSION:=$(shell ocamlc -version)

%: %.cppo
	cppo -V COQ:$(COQ_VERSION) -V OCAML:$(OCAML_VERSION) -n -o $@ $^

test:
	sh ./testall.sh

clean:
	if [ -e Makefile.coq ]; then $(MAKE) -f Makefile.coq cleanall; fi
	$(RM) Makefile.coq Makefile.coq.conf *.cmxs
	$(RM) -r _build/ build/
	$(RM) $(DEPS_DOT) $(DEPS_OUT)
	$(RM) test/*.ml{i,} test/.*.aux
	$(RM) $(COMPATFILES)

COQDEP=coqdep
DEPS_DOT=deps.dot
DEPS_OUT=deps.jpg

depgraph:
	$(COQDEP) -dumpgraph $(DEPS_DOT) -Q src/ SimpleIO src > /dev/null 2>&1
	sed 's%\("\([^"]*\)/\([^"/]*\)"\[label="\)%\1\2/\n%' -i deps.dot
	dot $(DEPS_DOT) -Tjpg -o$(DEPS_OUT)

## coqdoc -------------------------------------------------
COQDOCFLAGS:= \
  -t "Simple IO" \
  --toc --toc-depth 1 --html --interpolate \
  --index indexpage --no-lib-name --parse-comments

ifdef COQDOCJS_DIR
COQDOCFLAGS+=--with-header $(COQDOCJS_DIR)/extra/header.html --with-footer $(COQDOCJS_DIR)/extra/footer.html

html: html-raw
	cp $(COQDOCJS_DIR)/extra/resources/* doc
	awk -i inplace '{gsub(/href="\.\./,"href=\".")}; { print }' doc/*.html
else
html: html-raw
	@echo "`tput bold``tput setaf 3`WARNING: coqdocjs not set.`tput sgr0` This will produce ugly docs. Set the COQDOCJS_DIR variable when invoking make."
endif

export COQDOCFLAGS

html-raw: Makefile.coq
	rm -rf html
	$(MAKE_COQ) html
	cp -r html/. doc/

## -------------------------------------------------------