Pretty-printer missing parens for infix class declaration
[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
22 # -----------------------------------------------------------------------------
23 # Sanitize environment
24
25 # See Trac #11530
26 export GREP_OPTIONS :=
27
28 ifneq "$(filter maintainer-clean distclean clean clean_% help,$(MAKECMDGOALS))" ""
29 -include mk/config.mk
30 else
31 include mk/config.mk
32 ifeq "$(ProjectVersion)" ""
33 $(error Please run ./configure first)
34 endif
35 endif
36
37 include mk/custom-settings.mk
38
39
40 ifeq "$(wildcard distrib/)" ""
41
42 # We're in a bindist
43
44 .PHONY: default
45 default:
46 @echo 'Run "make install" to install'
47 @false
48
49 .PHONY: install show
50 install show:
51 $(MAKE) --no-print-directory -f ghc.mk $@ BINDIST=YES NO_INCLUDE_DEPS=YES
52
53 # Note [install-strip]
54 #
55 # install-strip is like install, but it strips the executable files while
56 # installing them.
57 #
58 # From http://www.gnu.org/prep/standards/html_node/Standard-Targets.html:
59 #
60 # "install-strip should not strip the executables in the build directory
61 # which are being copied for installation. It should only strip the copies
62 # that are installed. "
63
64 .PHONY: install-strip
65 install-strip:
66 # See Note [install-strip].
67 $(MAKE) --no-print-directory -f ghc.mk INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install BINDIST=YES NO_INCLUDE_DEPS=YES
68
69 else
70
71 .PHONY: default
72 default : all
73 @:
74
75 # For help, type 'make help'
76 .PHONY: help
77 help:
78 @cat MAKEHELP.md
79
80 # No need to update makefiles for these targets:
81 # (the ones we're filtering out)
82 REALGOALS=$(filter-out \
83 binary-dist \
84 binary-dist-prep \
85 install-strip \
86 sdist sdist-ghc \
87 sdist-ghc-prep \
88 sdist-windows-tarballs \
89 sdist-windows-tarballs-prep \
90 sdist-testsuite \
91 sdist-testsuite-prep \
92 bootstrapping-files \
93 framework-pkg \
94 clean \
95 clean_% \
96 distclean \
97 maintainer-clean \
98 show \
99 show! \
100 echo \
101 help \
102 test \
103 fulltest \
104 slowtest \
105 fasttest \
106 ,$(MAKECMDGOALS))
107
108 # configure touches certain files even if they haven't changed. This
109 # can mean a lot of unnecessary recompilation after a re-configure, so
110 # here we cache the old versions of these files so we can restore the
111 # timestamps.
112 %.old: %
113 @set -x && test -f $@ && cmp -s $< $@ || cp -p $< $@
114 touch -r $@ $<
115
116
117 # NB. not the same as saying '%: ...', which doesn't do the right thing:
118 # it does nothing if we specify a target that already exists.
119 .PHONY: $(REALGOALS) all
120 $(REALGOALS) all: mk/config.mk.old mk/project.mk.old compiler/ghc.cabal.old
121 ifneq "$(OMIT_PHASE_0)" "YES"
122 @echo "===--- building phase 0"
123 $(MAKE) --no-print-directory -f ghc.mk phase=0 phase_0_builds
124 endif
125 ifneq "$(OMIT_PHASE_1)" "YES"
126 @echo "===--- building phase 1"
127 $(MAKE) --no-print-directory -f ghc.mk phase=1 phase_1_builds
128 endif
129 @echo "===--- building final phase"
130 $(MAKE) --no-print-directory -f ghc.mk phase=final $@
131
132 # if BINARY_DIST_DIR is not set, assume we want the old
133 # behaviour of placing the binary dist into the current
134 # directory. Provide BINARY_DIST_DIR to put the final
135 # binary distribution elsewhere.
136 BINARY_DIST_DIR ?= .
137
138 .PHONY: binary-dist
139 binary-dist: binary-dist-prep
140 mv bindistprep/*.tar.$(TAR_COMP_EXT) "$(BINARY_DIST_DIR)"
141
142 .PHONY: binary-dist-prep
143 binary-dist-prep:
144 ifeq "$(mingw32_TARGET_OS)" "1"
145 $(MAKE) --no-print-directory -f ghc.mk windows-binary-dist-prep
146 else
147 rm -f bindist-list
148 $(MAKE) --no-print-directory -f ghc.mk bindist-list BINDIST=YES
149 $(MAKE) --no-print-directory -f ghc.mk unix-binary-dist-prep
150 endif
151
152 .PHONY: install-strip
153 install-strip:
154 # See Note [install-strip].
155 $(MAKE) --no-print-directory -f ghc.mk INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
156
157 .PHONY: sdist sdist-ghc sdist-ghc-prep sdist-windows-tarballs sdist-windows-tarballs-prep sdist-testsuite sdist-testsuite-prep
158 # Just running `./boot && ./configure && make sdist` should work, so skip
159 # phase 0 and 1 and don't build any dependency files.
160 sdist sdist-ghc sdist-ghc-prep sdist-windows-tarballs sdist-windows-tarballs-prep sdist-testsuite sdist-testsuite-prep :
161 $(MAKE) --no-print-directory -f ghc.mk $@ NO_INCLUDE_DEPS=YES NO_INCLUDE_PKGDATA=YES
162
163 .PHONY: clean distclean maintainer-clean
164 clean distclean maintainer-clean:
165 $(MAKE) --no-print-directory -f ghc.mk $@ CLEANING=YES
166 test ! -d testsuite || $(MAKE) -C testsuite $@
167
168 .PHONY: $(filter clean_%,$(MAKECMDGOALS))
169 $(filter clean_%, $(MAKECMDGOALS)) : clean_% :
170 $(MAKE) --no-print-directory -f ghc.mk $@ CLEANING=YES
171
172 .PHONY: bootstrapping-files show echo
173 bootstrapping-files show echo:
174 $(MAKE) --no-print-directory -f ghc.mk $@
175
176 .PHONY: show!
177 show!:
178 $(MAKE) --no-print-directory -f ghc.mk show NO_INCLUDE_PKGDATA=YES
179
180 ifeq "$(darwin_TARGET_OS)" "1"
181 .PHONY: framework-pkg
182 framework-pkg:
183 $(MAKE) -C distrib/MacOS $@
184 endif
185
186 # If the user says 'make A B', then we don't want to invoke two
187 # instances of the rule above in parallel:
188 .NOTPARALLEL:
189
190 endif
191
192 # Note [validate and testsuite speed]
193 #
194 # There are 3 different validate and testsuite speed settings:
195 # fast, normal and slow.
196 #
197 # how how used
198 # cd tests config. many many by
199 # validate && make speed= tests ways whom
200 # =============================================================================
201 # --fast fast 2 some 1+exs Travis (to stay within time limit)
202 # --normal test 1 all 1+exs Phabricator (slow takes too long?)
203 # --slow slow 0 all all Nightly (slow is ok)
204 #
205 # accept 1 all 1
206 #
207 # `--fast` and `--normal` run one default way, as well as any other ways which
208 # are explicitly requested by the test using extra_ways().
209 #
210 # `make accept` should run all tests exactly once. There is no point in
211 # accepting a test for multiple ways, since it should produce the same output
212 # for all ways.
213 #
214 # To make sure all .stderr and .stdout files in the testsuite are never
215 # out-of-date, it is useful if Phabricator, via a normal `./validate` and `make
216 # test`, runs each test at least once.
217 .PHONY: fasttest
218 fasttest: testsuite_utils
219 $(MAKE) -C testsuite/tests CLEANUP=1 SUMMARY_FILE=../../testsuite_summary.txt fast
220
221 .PHONY: test
222 test: testsuite_utils
223 $(MAKE) -C testsuite/tests CLEANUP=1 SUMMARY_FILE=../../testsuite_summary.txt
224
225 .PHONY: slowtest fulltest
226 slowtest fulltest: testsuite_utils
227 $(MAKE) -C testsuite/tests CLEANUP=1 SUMMARY_FILE=../../testsuite_summary.txt slow
228
229 .PHONY: testsuite_utils
230 testsuite_utils:
231 $(MAKE) -f ghc.mk testsuite_utils