forked from agda/agda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
289 lines (223 loc) · 9.53 KB
/
Makefile
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# Top-level Makefile for Agda 2
# Authors: Ulf Norell, Nils Anders Danielsson, Francesco Mazzoli
SHELL=bash
# Profiling verbosity for library-test
PROFVERB=7
# Various paths and commands
TOP=.
# mk/path.mk uses TOP, so include after the definition of TOP.
include ./mk/paths.mk
CABAL_CMD=cabal
override CABAL_OPTS+=--builddir=$(BUILD_DIR)
# Run in interactive and parallel mode by default
AGDA_TESTS_OPTIONS ?=-i -j $(shell getconf _NPROCESSORS_ONLN)
## Default target #########################################################
.PHONY : default
default: install-bin
## Cabal-based installation ###############################################
.PHONY : install
install: install-bin compile-emacs-mode setup-emacs-mode
.PHONY : prof
prof : install-prof-bin
.PHONY : install-bin
install-bin :
$(CABAL_CMD) install --enable-tests --disable-documentation \
--disable-library-profiling $(CABAL_OPTS)
.PHONY : install-O0-bin
install-O0-bin :
$(CABAL_CMD) install -O0 --enable-tests --disable-documentation \
--disable-library-profiling $(CABAL_OPTS)
.PHONY : install-O2-bin
install-O2-bin :
$(CABAL_CMD) install -O2 --enable-tests --disable-documentation \
--disable-library-profiling $(CABAL_OPTS)
.PHONY : install-prof-bin
install-prof-bin :
$(CABAL_CMD) install --enable-tests --disable-documentation \
--enable-library-profiling --enable-profiling \
--program-suffix=_p $(CABAL_OPTS)
.PHONY : compile-emacs-mode
compile-emacs-mode: install-bin
agda-mode compile
.PHONY : setup-emacs-mode
setup-emacs-mode : install-bin
@echo
@echo "If the agda-mode command is not found, make sure that the directory"
@echo "in which it was installed is located on your shell's search path."
@echo
agda-mode setup
## Making the documentation ###############################################
.PHONY : doc
doc:
$(CABAL_CMD) configure $(CABAL_OPTS)
$(CABAL_CMD) haddock $(CABAL_OPTS)
## Making the full language ###############################################
$(AGDA_BIN):
$(CABAL_CMD) build $(CABAL_OPTS)
.PHONY : full
full : $(AGDA_BIN)
## Making the source distribution #########################################
.PHONY : tags
tags :
$(MAKE) -C $(FULL_SRC_DIR) tags
.PHONY : TAGS
TAGS :
$(MAKE) -C $(FULL_SRC_DIR) TAGS
## Testing ###########################################################
.PHONY : quick
quick : install-O0-bin quicktest
.PHONY : test
# We don't run the `epic-test` because the Epic backend has been
# disabled. See Issue 1481.
test : check-whitespace succeed fail interaction interactive latex-test examples library-test api-test tests benchmark-without-logs compiler-test lib-succeed lib-interaction
.PHONY : quicktest
quicktest : succeed fail
.PHONY : tests
tests :
@echo "======================================================================"
@echo "======================== Internal test suite ========================="
@echo "======================================================================"
$(AGDA_BIN) --test +RTS -M1g
.PHONY : succeed
succeed :
@echo "======================================================================"
@echo "===================== Suite of successfull tests ====================="
@echo "======================================================================"
@$(MAKE) -C test/Common
@chmod +x test/succeed/checkOutput
@$(MAKE) -C test/succeed
.PHONY : interaction
interaction :
@echo "======================================================================"
@echo "===================== Suite of interaction tests ====================="
@echo "======================================================================"
@$(MAKE) -C test/interaction
.PHONY : interactive
interactive :
@echo "======================================================================"
@echo "===================== Suite of interactive tests ====================="
@echo "======================================================================"
@$(MAKE) -C test/interactive
.PHONY : examples
examples :
@echo "======================================================================"
@echo "========================= Suite of examples =========================="
@echo "======================================================================"
@$(MAKE) -C examples
.PHONY : fail
fail :
@echo "======================================================================"
@echo "======================= Suite of failing tests ======================="
@echo "======================================================================"
@$(MAKE) -C test/fail
.PHONY : latex-test
latex-test :
@echo "======================================================================"
@echo "================== Suite of tests for LaTeX backend =================="
@echo "======================================================================"
@AGDA_BIN=$(AGDA_BIN) $(AGDA_TESTS_BIN) $(AGDA_TESTS_OPTIONS) --regex-include all/LatexBackend
.PHONY : std-lib
std-lib :
if [ ! -d $@ ]; then \
git clone https://github.com/agda/agda-stdlib.git \
--single-branch $@; \
fi
.PHONY : up-to-date-std-lib
up-to-date-std-lib : std-lib
@(cd std-lib && \
git fetch && git checkout master && git merge origin/master && \
make setup)
.PHONY : library-test
library-test : # up-to-date-std-lib
@echo "======================================================================"
@echo "========================== Standard library =========================="
@echo "======================================================================"
(cd std-lib && runhaskell GenerateEverything.hs && \
time $(AGDA_BIN) --ignore-interfaces -v profile:$(PROFVERB) \
-i. -isrc README.agda \
+RTS -s -H1G -M1.5G)
.PHONY : continue-library-test
continue-library-test :
@(cd std-lib && \
time $(AGDA_BIN) -v profile:$(PROFVERB) -i. -isrc README.agda +RTS -s -H1G -M1.5G)
.PHONY : lib-succeed
lib-succeed :
@echo "======================================================================"
@echo "========== Successfull tests using the standard library =============="
@echo "======================================================================"
@$(MAKE) -C test/$@
.PHONY : lib-interaction
lib-interaction :
@echo "======================================================================"
@echo "========== Interaction tests using the standard library =============="
@echo "======================================================================"
@$(MAKE) -C test/$@
# The Epic backend has been removed. See Issue 1481.
.PHONY : epic-test
epic-test :
@echo "======================================================================"
@echo "============================ Epic backend ============================"
@echo "======================================================================"
@$(MAKE) -C test/epic
.PHONY : compiler-test
compiler-test :
@echo "======================================================================"
@echo "========================== Compiler tests ============================"
@echo "======================================================================"
@AGDA_BIN=$(AGDA_BIN) $(AGDA_TESTS_BIN) $(AGDA_TESTS_OPTIONS) --regex-include all/Compiler
.PHONY : api-test
api-test :
@echo "======================================================================"
@echo "======== Successfull tests using Agda as a Haskell library ==========="
@echo "======================================================================"
@$(MAKE) -C test/api
.PHONY : benchmark
benchmark :
@echo "======================================================================"
@echo "========================= Benchmark suite ============================"
@echo "======================================================================"
@$(MAKE) -C benchmark
.PHONY : benchmark-without-logs
benchmark-without-logs :
@echo "======================================================================"
@echo "============ Benchmark suite without creating logs ==================="
@echo "======================================================================"
@$(MAKE) -C benchmark without-creating-logs
## Clean ##################################################################
.PHONY : clean
clean :
$(CABAL_CMD) clean --builddir=$(BUILD_DIR)
## Whitespace-related #####################################################
# Agda can fail to compile on Windows if files which are CPP-processed
# don't end with a newline character (because we use -Werror).
.PHONY : fix-whitespace
fix-whitespace :
fix-agda-whitespace
.PHONY : check-whitespace
check-whitespace :
fix-agda-whitespace --check
.PHONY : install-fix-agda-whitespace
install-fix-agda-whitespace :
cd src/fix-agda-whitespace && $(CABAL_CMD) install
########################################################################
# HPC
.PHONY: hpc-build
hpc-build:
$(CABAL_CMD) clean $(CABAL_OPTS)
$(CABAL_CMD) configure --enable-library-coverage $(CABAL_OPTS)
$(CABAL_CMD) build $(CABAL_OPTS)
agda.tix: ./examples/agda.tix ./test/succeed/agda.tix ./test/compiler/agda.tix ./test/api/agda.tix ./test/interaction/agda.tix ./test/fail/agda.tix ./test/fail/Epic/agda.tix ./test/lib-succeed/agda.tix ./std-lib/agda.tix
hpc sum --output=$@ $^
.PHONY: hpc
hpc: hpc-build test agda.tix
hpc report --hpcdir=$(BUILD_DIR)/hpc/mix/Agda-$(VERSION) agda.tix
hpc markup --hpcdir=$(BUILD_DIR)/hpc/mix/Agda-$(VERSION) agda --destdir=hpc-report
## Lines of Code ##########################################################
agdalocfiles=$(shell find . \( \( -name '*.agda' -o -name '*.in' \) ! -name '.*' \) )
# Agda files (tests) in this project
agda-loc :
@wc $(agdalocfiles)
# Source code of Agda
loc :
make -C src/full loc
# EOF