~ubuntu-branches/ubuntu/wily/agda/wily-proposed

« back to all changes in this revision

Viewing changes to Makefile

  • Committer: Package Import Robot
  • Author(s): Iain Lane
  • Date: 2014-08-05 06:38:12 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20140805063812-io8e77niomivhd49
Tags: 2.4.0.2-1
* [6e140ac] Imported Upstream version 2.4.0.2
* [2049fc8] Update Build-Depends to match control
* [93dc4d4] Install the new primitives
* [e48f40f] Fix typo dev→doc

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Top-level Makefile for Agda 2
2
 
# Authors: Ulf Norell, Nils Anders Danielsson
3
 
 
4
 
SHELL=bash
5
 
## Includes ###############################################################
6
 
 
7
 
TOP = .
8
 
 
9
 
is_configured = $(shell if test -f mk/config.mk; \
10
 
                                                then echo Yes; \
11
 
                                                else echo No; \
12
 
                                                fi \
13
 
                                 )
14
 
 
15
 
include mk/paths.mk
16
 
 
17
 
ifeq ($(is_configured),Yes)
18
 
include mk/config.mk
19
 
include mk/rules.mk
20
 
endif
21
 
 
22
 
 
23
 
## Phony targets ##########################################################
24
 
 
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
29
 
 
30
 
## Default target #########################################################
31
 
 
32
 
ifeq ($(is_configured),Yes)
33
 
default : compile-emacs-mode
34
 
# tags
35
 
else
36
 
default : make_configure
37
 
endif
38
 
 
39
 
## Cabal-based installation ###############################################
40
 
 
41
 
# The cabal command.
42
 
CABAL_CMD=cabal
43
 
 
44
 
# Options used by cabal install.
45
 
CABAL_OPTIONS=
46
 
#  -f epic
47
 
 
48
 
install : update-cabal install-bin compile-emacs-mode setup-emacs-mode
49
 
 
50
 
prof : install-prof-bin
51
 
 
52
 
update-cabal :
53
 
        $(CABAL_CMD) update
54
 
 
55
 
# Installs the Emacs mode, but does not set it up.
56
 
install-bin :
57
 
        $(CABAL_CMD) install --disable-library-profiling --disable-documentation $(CABAL_OPTIONS)
58
 
 
59
 
install-prof-bin :
60
 
        $(CABAL_CMD) install --enable-library-profiling --enable-executable-profiling \
61
 
                             --program-suffix=_p --disable-documentation $(CABAL_OPTIONS)
62
 
 
63
 
compile-emacs-mode : install-bin
64
 
        agda-mode compile
65
 
 
66
 
setup-emacs-mode : install-bin
67
 
        @echo
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."
70
 
        @echo
71
 
        agda-mode setup
72
 
 
73
 
## Making the make system #################################################
74
 
 
75
 
m4_macros       = $(wildcard $(MACRO_DIR)/*.m4)
76
 
 
77
 
make_configure : configure
78
 
        @echo "Run './configure' to set up the build system."
79
 
 
80
 
configure : aclocal.m4 $(m4_macros) configure.ac
81
 
        autoconf
82
 
 
83
 
##
84
 
## The following targets are only available after running configure #######
85
 
##
86
 
 
87
 
ifeq ($(is_configured),Yes)
88
 
 
89
 
## Making the documentation ###############################################
90
 
 
91
 
doc :
92
 
        $(MAKE) -C $(HADDOCK_DIR)
93
 
 
94
 
## Making the full language ###############################################
95
 
 
96
 
ifeq ($(HAVE_RUNHASKELL),Yes)
97
 
 
98
 
SETUP      = Setup.hs
99
 
RUNSETUP   = $(RUNHASKELL) $(SETUP)
100
 
 
101
 
else
102
 
 
103
 
SETUP      = setup
104
 
RUNSETUP   = ./setup
105
 
 
106
 
$(SETUP) : Setup.hs
107
 
        ghc --make -o $@ $<
108
 
 
109
 
endif
110
 
 
111
 
CONFIG  = dist/setup-config
112
 
CABAL           = Agda.cabal
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')
118
 
 
119
 
$(CONFIG) : $(CABAL) $(SETUP)
120
 
        $(RUNSETUP) configure
121
 
 
122
 
$(BUILD) : $(CONFIG) $(SOURCES)
123
 
        $(RUNSETUP) build
124
 
        @date > $@
125
 
 
126
 
$(INPLACE) : $(BUILD)
127
 
        $(RUNSETUP) register --user --inplace
128
 
        @date > $@
129
 
 
130
 
$(AGDA_BIN) : $(INPLACE) $(MAIN_SRC_DIR)/Main.hs
131
 
        $(MAKE) -C $(MAIN_SRC_DIR)
132
 
 
133
 
full : $(AGDA_BIN)
134
 
 
135
 
## Making the core language ###############################################
136
 
 
137
 
core :
138
 
        $(MAKE) -C $(CORE_SRC_DIR)
139
 
 
140
 
## Making the Agda 1 to Agda 2 translator #################################
141
 
 
142
 
transl :
143
 
        (cd $(TRANSL_SRC_DIR); cabal configure && cabal build)
144
 
 
145
 
## Making the source distribution #########################################
146
 
 
147
 
ifeq ($(HAVE_DARCS)-$(shell if test -d _darcs; then echo darcs; fi),Yes-darcs)
148
 
  is_darcs_repo = Yes
149
 
else
150
 
  is_darcs_repo = No
151
 
endif
152
 
 
153
 
ifeq ($(is_darcs_repo),Yes)
154
 
 
155
 
dist : agda2.tar.gz
156
 
 
157
 
agda2.tar.gz :
158
 
        $(DARCS) dist -d agda2
159
 
 
160
 
else
161
 
 
162
 
dist :
163
 
        @echo You can only "'make dist'" from the darcs repository.
164
 
        @$(FALSE)
165
 
 
166
 
endif
167
 
 
168
 
tags :
169
 
        $(MAKE) -C $(FULL_SRC_DIR) tags
170
 
TAGS :
171
 
        $(MAKE) -C $(FULL_SRC_DIR) TAGS
172
 
 
173
 
## Testing ###########################################################
174
 
 
175
 
test : check-whitespace succeed fail interaction examples tests library-test compiler-test lib-succeed epic-test
176
 
 
177
 
tests :
178
 
        @echo "======================================================================"
179
 
        @echo "======================== Internal test suite ========================="
180
 
        @echo "======================================================================"
181
 
        $(AGDA_BIN) --test
182
 
 
183
 
succeed :
184
 
        @echo "======================================================================"
185
 
        @echo "===================== Suite of successfull tests ====================="
186
 
        @echo "======================================================================"
187
 
        @chmod +x test/succeed/checkOutput
188
 
        @$(MAKE) -C test/succeed
189
 
 
190
 
interaction :
191
 
        @echo "======================================================================"
192
 
        @echo "===================== Suite of interaction tests ====================="
193
 
        @echo "======================================================================"
194
 
        @$(MAKE) -C test/interaction
195
 
 
196
 
examples :
197
 
        @echo "======================================================================"
198
 
        @echo "========================= Suite of examples =========================="
199
 
        @echo "======================================================================"
200
 
        @$(MAKE) -C examples
201
 
 
202
 
fail :
203
 
        @echo "======================================================================"
204
 
        @echo "======================= Suite of failing tests ======================="
205
 
        @echo "======================================================================"
206
 
        @$(MAKE) -C test/fail
207
 
 
208
 
std-lib :
209
 
        darcs get --lazy --repo-name=$@ \
210
 
                 http://www.cse.chalmers.se/~nad/repos/lib/
211
 
 
212
 
up-to-date-std-lib : std-lib
213
 
        @(cd std-lib && darcs pull -a && make setup)
214
 
 
215
 
library-test : up-to-date-std-lib
216
 
        @echo "======================================================================"
217
 
        @echo "========================== Standard library =========================="
218
 
        @echo "======================================================================"
219
 
        @(cd std-lib && \
220
 
          time $(PWD)/$(AGDA_BIN) -i. -isrc README.agda $(AGDA_TEST_FLAGS) \
221
 
            +RTS -s)
222
 
 
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 && \
230
 
          ./Main)
231
 
 
232
 
lib-succeed :
233
 
        @echo "======================================================================"
234
 
        @echo "========== Successfull tests using the standard library =============="
235
 
        @echo "======================================================================"
236
 
        @$(MAKE) -C test/$@
237
 
 
238
 
epic-test :
239
 
        @echo "======================================================================"
240
 
        @echo "============================ Epic backend ============================"
241
 
        @echo "======================================================================"
242
 
        @$(MAKE) -C test/epic
243
 
 
244
 
benchmark :
245
 
        @$(MAKE) -C benchmark
246
 
 
247
 
## Clean ##################################################################
248
 
 
249
 
clean :
250
 
        $(MAKE) -C $(HADDOCK_DIR) clean
251
 
        rm -rf $(OUT_DIR)
252
 
        rm -rf dist
253
 
 
254
 
veryclean :
255
 
        $(MAKE) -C $(HADDOCK_DIR) veryclean
256
 
        rm -rf $(OUT_DIR)
257
 
        rm -rf configure config.log config.status autom4te.cache mk/config.mk
258
 
 
259
 
## Debugging the Makefile #################################################
260
 
 
261
 
info :
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)"
265
 
 
266
 
else    # is_configured
267
 
 
268
 
info :
269
 
        @echo "You haven't run configure."
270
 
 
271
 
endif   # is_configured
272
 
 
273
 
## Whitespace-related #####################################################
274
 
 
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).
277
 
 
278
 
.PHONY:
279
 
fix-whitespace :
280
 
        fix-agda-whitespace
281
 
 
282
 
.PHONY:
283
 
check-whitespace :
284
 
        fix-agda-whitespace --check
285
 
 
286
 
.PHONY:
287
 
install-fix-agda-whitespace :
288
 
        cd src/fix-agda-whitespace && \
289
 
        $(CABAL_CMD) install $(CABAL_OPTIONS)