File: Makefile

package info (click to toggle)
elpi 2.0.7-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 50,296 kB
  • sloc: ml: 18,791; makefile: 229; python: 95; sh: 7
file content (143 lines) | stat: -rw-r--r-- 4,747 bytes parent folder | download | duplicates (4)
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
help:
	@echo 'Build targets:'
	@echo
	@echo '  build                  builds elpi'
	@echo '  install                install elpi'
	@echo '  clean                  remove build artifacts'
	@echo '  release                release the software (note: git tag -s first)'
	@echo
	@echo 'Testing targets:'
	@echo
	@echo '  tests                  runs the entire test suite'
	@echo '  tests ONLY=rex         runs only tests matching rex'
	@echo '  tests PROMOTE=true     runs and promote tests if different'
	@echo '                           (can be combined with ONLY)'
	@echo '  tests LN_NB=nb         sets max number of lines to print of failing tests'
	@echo '                           (negave numbers means print all file)'
	@echo '  tests STOP_ON_FST_ERROR=true stops the test suite after first error'
	@echo
	@echo '  git/treeish            checkout treeish and build elpi.git.treeish'
	@echo
	@echo 'Parser maintenance targets:'
	@echo
	@echo '  menhir-repl            run menhir in interactive mode'
	@echo '  menhir-explain-conflicts'
	@echo '  menhir-complete-errormsgs run when updating the grammar'
	@echo '  menhir-strip-errormsgs remove comments from error message file'
	@echo

INSTALL=_build/install/default
BUILD=_build/default
SHELL:=/usr/bin/env bash
TIMEOUT=90.0
PROMOTE=false
LN_NB=-1
STOP_ON_FST_ERROR=false
PWD=$(shell pwd)
RUNNERS=\
  $(wildcard $(PWD)/_build/git/*/$(BUILD)/tests/sources/*.exe.git.*.exe) \
  $(wildcard $(PWD)/$(BUILD)/tests/sources/*.exe) \
  $(PWD)/$(INSTALL)/bin/elpi \
  $(PWD)/$(INSTALL)/bin/elpi-trace-elaborator \
  $(addprefix $(PWD)/,$(wildcard _build/git/*/$(INSTALL)/bin/elpi.git.*)) \
  $(shell if type tjsim >/dev/null 2>&1; then type -P tjsim; else echo; fi)
TIME=--time $(shell if type -P gtime >/dev/null 2>&1; then type -P gtime; else echo /usr/bin/time; fi)
STACK=1114112

DUNE_OPTS=

build:
	dune build $(DUNE_OPTS) @all

install:
	dune install $(DUNE_OPTS)

doc:
	dune build $(DUNE_OPTS) @doc

doc-build: doc
	rm -rf docs/build
	rm -rf docs/source
	cp -r docs/base docs/source
	sed -i "s/@@VERSION@@/$(shell git describe)/" docs/source/conf.py
	python3 docs/engine/engine.py
	cd docs && make html
	cp -r _build/default/_doc/_html/* docs/build/html/
	touch docs/build/html/.nojekyll

doc-publish: doc-build
	rm -rf /tmp/gh-pages
	cp -r docs/build/html/ /tmp/gh-pages
	OLD_BRANCH=`git branch --show-current`; \
	git checkout gh-pages && rm -rf * && cp -r /tmp/gh-pages/* ./ && rm -rf /tmp/gh-pages && git add . && git commit -m "Updated gh-pages" && git checkout $$OLD_BRANCH
	@echo "uploading: enter to continue, ^C to abort"; read DUMMY; git push origin gh-pages

clean:
	rm -rf _build
	rm -rf docs/build

release:
	dune-release -p elpi
	$(MAKE) doc-publish

# testing
tests:
	$(MAKE) build
	dune runtest
	ulimit -s $(STACK); OCAMLRUNPARAM=l=$(STACK) \
		tests/test.exe \
		--seed $$RANDOM \
		--promote $(PROMOTE) \
		--ln_nb=$(LN_NB) \
		--timeout $(TIMEOUT) \
		--stop-on-first-error=$(STOP_ON_FST_ERROR) \
		$(TIME) \
		--sources=$(PWD)/tests/sources/ \
		--plot=$(PWD)/tests/plot \
		$(addprefix --name-match ,$(ONLY)) \
		$(addprefix --cat-skip ,$(SKIP)) \
		$(addprefix --runner , $(RUNNERS))

git/%:
	rm -rf "_build/git/elpi-$*"
	mkdir -p "_build/git/elpi-$*"
	git clone -l . "_build/git/elpi-$*"
	cd "_build/git/elpi-$*" && git checkout "$*"
	cd "_build/git/elpi-$*" && \
	  if [ -f dune ]; then \
	    make build DUNE_OPTS="$(DUNE_OPTS) --root .";\
	    (cd _build/install/default/bin/; ln -sf elpi elpi.git.$*); \
	    (cd _build/default/tests/sources; for x in *.exe; do ln -sf $$x $$x.git.$*.exe; done) \
	  else \
	    make; \
		mkdir -p _build/install/default/bin/; \
		ln -s $$PWD/elpi _build/install/default/bin/elpi.git.$*; \
	  fi

# parser maintenance
menhir-repl:
	menhir --interpret src/parser/tokens.mly \
		src/parser/token_precedence.mly \
		--base grammar src/parser/grammar.mly 2>/dev/null
menhir-explain-conflicts:
	-menhir --explain src/parser/tokens.mly \
		src/parser/token_precedence.mly \
		--base grammar src/parser/grammar.mly
	echo "Plese look at grammar.conflicts"
menhir-complete-errormsgs:
	menhir src/parser/tokens.mly \
		src/parser/token_precedence.mly \
		--base grammar src/parser/grammar.mly \
		--list-errors > src/parser/error_messages.auto.messages
	menhir src/parser/tokens.mly \
		src/parser/token_precedence.mly \
		--base grammar src/parser/grammar.mly\
		--merge-errors src/parser/error_messages.auto.messages \
		--merge-errors src/parser/error_messages.txt \
		> src/parser/error_messages.merged
	mv src/parser/error_messages.merged src/parser/error_messages.txt
	rm src/parser/error_messages.auto.messages
menhir-strip-errormsgs:
	sed -e "/^##/d" -i.bak src/parser/error_messages.txt

.PHONY: tests help install build clean gh-pages