Testsuite: by default run all tests for a single way
[ghc.git] / Makefile
1 # -----------------------------------------------------------------------------
2 #
3 # (c) 2009 The University of Glasgow
4 #
5 # This file is part of the GHC build system.
6 #
7 # To understand how the build system works and how to modify it, see
8 # http://ghc.haskell.org/trac/ghc/wiki/Building/Architecture
9 # http://ghc.haskell.org/trac/ghc/wiki/Building/Modifying
10 #
11 # -----------------------------------------------------------------------------
12
13 # Eliminate use of the built-in implicit rules, and clear out the default list
14 # of suffixes for suffix rules. Speeds up make quite a bit. Both are needed
15 # for the shortest `make -d` output.
16 # Don't set --no-builtin-variables; some rules might stop working if you do
17 # (e.g. 'make clean' in testsuite/ currently relies on an implicit $RM).
18 MAKEFLAGS += --no-builtin-rules
19 .SUFFIXES:
20
21 ifeq "$(wildcard distrib/)" ""
22
23 # We're in a bindist
24
25 .PHONY: default
26 default:
27 @echo 'Run "make install" to install'
28 @false
29
30 .PHONY: install show
31 install show:
32 $(MAKE) --no-print-directory -f ghc.mk $@ BINDIST=YES NO_INCLUDE_DEPS=YES
33
34 else
35
36 .PHONY: default
37 default : all
38 @:
39
40 # For help, type 'make help'
41 .PHONY: help
42 help:
43 @cat MAKEHELP.md
44
45 ifneq "$(filter maintainer-clean distclean clean clean_% help,$(MAKECMDGOALS))" ""
46 -include mk/config.mk
47 else
48 include mk/config.mk
49 ifeq "$(ProjectVersion)" ""
50 $(error Please run ./configure first)
51 endif
52 endif
53
54 include mk/custom-settings.mk
55
56 # Verify that stage 0 LLVM backend isn't affected by Bug #9439 if needed
57 ifeq "$(GHC_LLVM_AFFECTED_BY_9439)" "1"
58 ifneq "$(findstring -fllvm,$(GhcHcOpts) $(GhcStage1HcOpts))" ""
59 $(error Stage 0 compiler is affected by Bug #9439. Refusing to bootstrap with -fllvm)
60 endif
61 endif
62
63 # No need to update makefiles for these targets:
64 # (the ones we're filtering out)
65 REALGOALS=$(filter-out \
66 binary-dist \
67 binary-dist-prep \
68 sdist sdist-ghc \
69 sdist-ghc-prep \
70 sdist-windows-tarballs \
71 sdist-windows-tarballs-prep \
72 sdist-testsuite \
73 sdist-testsuite-prep \
74 bootstrapping-files \
75 framework-pkg \
76 clean \
77 clean_% \
78 distclean \
79 maintainer-clean \
80 show \
81 show! \
82 echo \
83 help \
84 test \
85 fulltest \
86 slowtest \
87 fasttest \
88 ,$(MAKECMDGOALS))
89
90 # configure touches certain files even if they haven't changed. This
91 # can mean a lot of unnecessary recompilation after a re-configure, so
92 # here we cache the old versions of these files so we can restore the
93 # timestamps.
94 %.old: %
95 @set -x && test -f $@ && cmp -s $< $@ || cp -p $< $@
96 touch -r $@ $<
97
98
99 # NB. not the same as saying '%: ...', which doesn't do the right thing:
100 # it does nothing if we specify a target that already exists.
101 .PHONY: $(REALGOALS) all
102 $(REALGOALS) all: mk/config.mk.old mk/project.mk.old compiler/ghc.cabal.old
103 ifneq "$(OMIT_PHASE_0)" "YES"
104 @echo "===--- building phase 0"
105 $(MAKE) --no-print-directory -f ghc.mk phase=0 phase_0_builds
106 endif
107 ifneq "$(OMIT_PHASE_1)" "YES"
108 @echo "===--- building phase 1"
109 $(MAKE) --no-print-directory -f ghc.mk phase=1 phase_1_builds
110 endif
111 @echo "===--- building final phase"
112 $(MAKE) --no-print-directory -f ghc.mk phase=final $@
113
114 .PHONY: binary-dist
115 binary-dist: binary-dist-prep
116 mv bindistprep/*.tar.$(TAR_COMP_EXT) .
117
118 .PHONY: binary-dist-prep
119 binary-dist-prep:
120 ifeq "$(mingw32_TARGET_OS)" "1"
121 $(MAKE) --no-print-directory -f ghc.mk windows-binary-dist-prep
122 else
123 rm -f bindist-list
124 $(MAKE) --no-print-directory -f ghc.mk bindist-list BINDIST=YES
125 $(MAKE) --no-print-directory -f ghc.mk unix-binary-dist-prep
126 endif
127
128 .PHONY: sdist sdist-ghc sdist-ghc-prep sdist-windows-tarballs sdist-windows-tarballs-prep sdist-testsuite sdist-testsuite-prep
129 # Just running `./boot && ./configure && make sdist` should work, so skip
130 # phase 0 and 1 and don't build any dependency files.
131 sdist sdist-ghc sdist-ghc-prep sdist-windows-tarballs sdist-windows-tarballs-prep sdist-testsuite sdist-testsuite-prep :
132 $(MAKE) --no-print-directory -f ghc.mk $@ NO_INCLUDE_DEPS=YES NO_INCLUDE_PKGDATA=YES
133
134 .PHONY: clean distclean maintainer-clean
135 clean distclean maintainer-clean:
136 $(MAKE) --no-print-directory -f ghc.mk $@ CLEANING=YES
137 test ! -d testsuite || $(MAKE) -C testsuite $@
138
139 .PHONY: $(filter clean_%,$(MAKECMDGOALS))
140 $(filter clean_%, $(MAKECMDGOALS)) : clean_% :
141 $(MAKE) --no-print-directory -f ghc.mk $@ CLEANING=YES
142
143 .PHONY: bootstrapping-files show echo
144 bootstrapping-files show echo:
145 $(MAKE) --no-print-directory -f ghc.mk $@
146
147 .PHONY: show!
148 show!:
149 $(MAKE) --no-print-directory -f ghc.mk show NO_INCLUDE_PKGDATA=YES
150
151 ifeq "$(darwin_TARGET_OS)" "1"
152 .PHONY: framework-pkg
153 framework-pkg:
154 $(MAKE) -C distrib/MacOS $@
155 endif
156
157 # If the user says 'make A B', then we don't want to invoke two
158 # instances of the rule above in parallel:
159 .NOTPARALLEL:
160
161 endif
162
163 # Note [validate and testsuite speed]
164 #
165 # There are 3 different validate and testsuite speed settings:
166 # fast, normal and slow.
167 #
168 # how how used
169 # cd tests config. many many by
170 # validate && make speed= tests ways whom
171 # =============================================================================
172 # --fast fast 2 some 1 Travis (to stay within time limit)
173 # --normal test 1 all 1 Phabricator (slow takes too long?)
174 # --slow slow 0 all all Nightly (slow is ok)
175 #
176 # accept 1 all 1
177 #
178 # `make accept` should run all tests exactly once. There is no point in
179 # accepting a test for multiple ways, since it should produce the same output
180 # for all ways.
181 #
182 # To make sure all .stderr and .stdout files in the testsuite are never
183 # out-of-date, it is useful if Phabricator, via a normal `./validate` and `make
184 # test`, runs each test at least once.
185 .PHONY: fasttest
186 fasttest:
187 $(MAKE) -C testsuite/tests CLEANUP=1 SUMMARY_FILE=../../testsuite_summary.txt fast
188
189 .PHONY: test
190 test:
191 $(MAKE) -C testsuite/tests CLEANUP=1 SUMMARY_FILE=../../testsuite_summary.txt
192
193 .PHONY: slowtest fulltest
194 slowtest fulltest:
195 $(MAKE) -C testsuite/tests CLEANUP=1 SUMMARY_FILE=../../testsuite_summary.txt slow