1
# Top-level Makefile for Agda 2
2
# Authors: Ulf Norell, Nils Anders Danielsson
5
## Includes ###############################################################
9
is_configured = $(shell if test -f mk/config.mk; \
17
ifeq ($(is_configured),Yes)
23
## Phony targets ##########################################################
25
.PHONY : default all clean install full prof core \
26
debug doc dist make_configure clean_test examples \
27
test tests succeed fail interaction benchmark up-to-date-std-lib \
28
update-cabal install-lib install-bin install-emacs-mode
30
## Default target #########################################################
32
ifeq ($(is_configured),Yes)
33
default : compile-emacs-mode
36
default : make_configure
39
## Cabal-based installation ###############################################
44
# Options used by cabal install.
48
install : update-cabal install-bin compile-emacs-mode setup-emacs-mode
50
prof : install-prof-bin
55
# Installs the Emacs mode, but does not set it up.
57
$(CABAL_CMD) install --disable-library-profiling --disable-documentation $(CABAL_OPTIONS)
60
$(CABAL_CMD) install --enable-library-profiling --enable-executable-profiling \
61
--program-suffix=_p --disable-documentation $(CABAL_OPTIONS)
63
compile-emacs-mode : install-bin
66
setup-emacs-mode : install-bin
68
@echo "If the agda-mode command is not found, make sure that the directory"
69
@echo "in which it was installed is located on your shell's search path."
73
## Making the make system #################################################
75
m4_macros = $(wildcard $(MACRO_DIR)/*.m4)
77
make_configure : configure
78
@echo "Run './configure' to set up the build system."
80
configure : aclocal.m4 $(m4_macros) configure.ac
84
## The following targets are only available after running configure #######
87
ifeq ($(is_configured),Yes)
89
## Making the documentation ###############################################
92
$(MAKE) -C $(HADDOCK_DIR)
94
## Making the full language ###############################################
96
ifeq ($(HAVE_RUNHASKELL),Yes)
99
RUNSETUP = $(RUNHASKELL) $(SETUP)
111
CONFIG = dist/setup-config
113
BUILD = dist/build-complete
114
INPLACE = dist/installed-inplace
115
SOURCES = $(shell $(FIND) $(FULL_SRC_DIR) -name '*hs') \
116
$(shell $(FIND) $(FULL_SRC_DIR) -name '*.y') \
117
$(shell $(FIND) $(FULL_SRC_DIR) -name '*.x')
119
$(CONFIG) : $(CABAL) $(SETUP)
120
$(RUNSETUP) configure
122
$(BUILD) : $(CONFIG) $(SOURCES)
126
$(INPLACE) : $(BUILD)
127
$(RUNSETUP) register --user --inplace
130
$(AGDA_BIN) : $(INPLACE) $(MAIN_SRC_DIR)/Main.hs
131
$(MAKE) -C $(MAIN_SRC_DIR)
135
## Making the core language ###############################################
138
$(MAKE) -C $(CORE_SRC_DIR)
140
## Making the Agda 1 to Agda 2 translator #################################
143
(cd $(TRANSL_SRC_DIR); cabal configure && cabal build)
145
## Making the source distribution #########################################
147
ifeq ($(HAVE_DARCS)-$(shell if test -d _darcs; then echo darcs; fi),Yes-darcs)
153
ifeq ($(is_darcs_repo),Yes)
158
$(DARCS) dist -d agda2
163
@echo You can only "'make dist'" from the darcs repository.
169
$(MAKE) -C $(FULL_SRC_DIR) tags
171
$(MAKE) -C $(FULL_SRC_DIR) TAGS
173
## Testing ###########################################################
175
test : check-whitespace succeed fail interaction examples tests library-test compiler-test lib-succeed epic-test
178
@echo "======================================================================"
179
@echo "======================== Internal test suite ========================="
180
@echo "======================================================================"
184
@echo "======================================================================"
185
@echo "===================== Suite of successfull tests ====================="
186
@echo "======================================================================"
187
@chmod +x test/succeed/checkOutput
188
@$(MAKE) -C test/succeed
191
@echo "======================================================================"
192
@echo "===================== Suite of interaction tests ====================="
193
@echo "======================================================================"
194
@$(MAKE) -C test/interaction
197
@echo "======================================================================"
198
@echo "========================= Suite of examples =========================="
199
@echo "======================================================================"
203
@echo "======================================================================"
204
@echo "======================= Suite of failing tests ======================="
205
@echo "======================================================================"
206
@$(MAKE) -C test/fail
209
darcs get --lazy --repo-name=$@ \
210
http://www.cse.chalmers.se/~nad/repos/lib/
212
up-to-date-std-lib : std-lib
213
@(cd std-lib && darcs pull -a && make setup)
215
library-test : up-to-date-std-lib
216
@echo "======================================================================"
217
@echo "========================== Standard library =========================="
218
@echo "======================================================================"
220
time $(PWD)/$(AGDA_BIN) -i. -isrc README.agda $(AGDA_TEST_FLAGS) \
223
compiler-test : up-to-date-std-lib
224
@echo "======================================================================"
225
@echo "============================== Compiler =============================="
226
@echo "======================================================================"
227
@(cd test/compiler && \
228
time ../../$(AGDA_BIN) --compile -i. -i../../std-lib -i../../std-lib/src \
229
Main.agda +RTS -H1G -M1.5G && \
233
@echo "======================================================================"
234
@echo "========== Successfull tests using the standard library =============="
235
@echo "======================================================================"
239
@echo "======================================================================"
240
@echo "============================ Epic backend ============================"
241
@echo "======================================================================"
242
@$(MAKE) -C test/epic
245
@$(MAKE) -C benchmark
247
## Clean ##################################################################
250
$(MAKE) -C $(HADDOCK_DIR) clean
255
$(MAKE) -C $(HADDOCK_DIR) veryclean
257
rm -rf configure config.log config.status autom4te.cache mk/config.mk
259
## Debugging the Makefile #################################################
262
@echo "The agda binary is at: $(AGDA_BIN)"
263
@echo "Do we have ghc 6.4? $(HAVE_GHC_6_4)"
264
@echo "Is this the darcs repository? $(is_darcs_repo)"
269
@echo "You haven't run configure."
271
endif # is_configured
273
## Whitespace-related #####################################################
275
# Agda can fail to compile on Windows if files which are CPP-processed
276
# don't end with a newline character (because we use -Werror).
284
fix-agda-whitespace --check
287
install-fix-agda-whitespace :
288
cd src/fix-agda-whitespace && \
289
$(CABAL_CMD) install $(CABAL_OPTIONS)