1 # -----------------------------------------------------------------------------
3 # (c) 2009 The University of Glasgow
5 # This file is part of the GHC build system.
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
11 # -----------------------------------------------------------------------------
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
22 # -----------------------------------------------------------------------------
23 # Sanitize environment
26 export GREP_OPTIONS
:=
28 ifneq "$(filter maintainer-clean distclean clean clean_% help,$(MAKECMDGOALS))" ""
32 ifeq "$(ProjectVersion)" ""
33 $(error Please run .
/configure first
)
37 include mk
/custom-settings.mk
40 ifeq "$(wildcard distrib/)" ""
46 @echo
'Run "make install" to install'
51 $(MAKE
) --no-print-directory
-f ghc.mk
$@ BINDIST
=YES NO_INCLUDE_DEPS
=YES
53 # Note [install-strip]
55 # install-strip is like install, but it strips the executable files while
58 # From http://www.gnu.org/prep/standards/html_node/Standard-Targets.html:
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. "
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
75 # For help, type 'make help'
80 # No need to update makefiles for these targets:
81 # (the ones we're filtering out)
82 REALGOALS
=$(filter-out \
88 sdist-windows-tarballs \
89 sdist-windows-tarballs-prep \
91 sdist-testsuite-prep \
109 # configure touches certain files even if they haven't changed. This
110 # can mean a lot of unnecessary recompilation after a re-configure, so
111 # here we cache the old versions of these files so we can restore the
114 @set
-x
&& test -f
$@
&& cmp
-s
$< $@ || cp
-p
$< $@
118 # NB. not the same as saying '%: ...', which doesn't do the right thing:
119 # it does nothing if we specify a target that already exists.
120 .PHONY
: $(REALGOALS
) all
121 $(REALGOALS
) all: mk
/config.mk.old mk
/project.mk.old compiler
/ghc.cabal.old
122 ifneq "$(OMIT_PHASE_0)" "YES"
123 @echo
"===--- building phase 0"
124 $(MAKE
) --no-print-directory
-f ghc.mk phase
=0 phase_0_builds
126 ifneq "$(OMIT_PHASE_1)" "YES"
127 @echo
"===--- building phase 1"
128 $(MAKE
) --no-print-directory
-f ghc.mk phase
=1 phase_1_builds
130 @echo
"===--- building final phase"
131 $(MAKE
) --no-print-directory
-f ghc.mk phase
=final
$@
133 # if BINARY_DIST_DIR is not set, assume we want the old
134 # behaviour of placing the binary dist into the current
135 # directory. Provide BINARY_DIST_DIR to put the final
136 # binary distribution elsewhere.
140 binary-dist
: binary-dist-prep
141 mv bindistprep
/*.
tar.
$(TAR_COMP_EXT
) "$(BINARY_DIST_DIR)"
143 .PHONY
: binary-dist-prep
145 ifeq "$(mingw32_TARGET_OS)" "1"
146 $(MAKE
) --no-print-directory
-f ghc.mk windows-binary-dist-prep
149 $(MAKE
) --no-print-directory
-f ghc.mk bindist-list BINDIST
=YES
150 $(MAKE
) --no-print-directory
-f ghc.mk unix-binary-dist-prep
153 .PHONY
: install-strip
155 # See Note [install-strip].
156 $(MAKE
) --no-print-directory
-f ghc.mk INSTALL_PROGRAM
='$(INSTALL_PROGRAM) -s' install
158 .PHONY
: sdist sdist-ghc sdist-ghc-prep sdist-windows-tarballs sdist-windows-tarballs-prep sdist-testsuite sdist-testsuite-prep
159 # Just running `./boot && ./configure && make sdist` should work, so skip
160 # phase 0 and 1 and don't build any dependency files.
161 sdist sdist-ghc sdist-ghc-prep sdist-windows-tarballs sdist-windows-tarballs-prep sdist-testsuite sdist-testsuite-prep
:
162 $(MAKE
) --no-print-directory
-f ghc.mk
$@ NO_INCLUDE_DEPS
=YES NO_INCLUDE_PKGDATA
=YES
164 .PHONY
: clean distclean maintainer-clean
165 clean distclean maintainer-clean
:
166 $(MAKE
) --no-print-directory
-f ghc.mk
$@ CLEANING
=YES
167 test ! -d testsuite ||
$(MAKE
) -C testsuite
$@
169 .PHONY
: $(filter clean_
%,$(MAKECMDGOALS
))
170 $(filter clean_
%, $(MAKECMDGOALS
)) : clean_
% :
171 $(MAKE
) --no-print-directory
-f ghc.mk
$@ CLEANING
=YES
173 .PHONY
: bootstrapping-files show echo
174 bootstrapping-files show echo
:
175 $(MAKE
) --no-print-directory
-f ghc.mk
$@
179 $(MAKE
) --no-print-directory
-f ghc.mk show NO_INCLUDE_PKGDATA
=YES
181 ifeq "$(darwin_TARGET_OS)" "1"
182 .PHONY
: framework-pkg
184 $(MAKE
) -C distrib
/MacOS
$@
187 # If the user says 'make A B', then we don't want to invoke two
188 # instances of the rule above in parallel:
193 # Note [validate and testsuite speed]
195 # There are 3 different validate and testsuite speed settings:
196 # fast, normal and slow.
199 # cd tests config. many many by
200 # validate && make speed= tests ways whom
201 # =============================================================================
202 # --fast fast 2 some 1+exs Travis (to stay within time limit)
203 # --normal test 1 all 1+exs Phabricator (slow takes too long?)
204 # --slow slow 0 all all Nightly (slow is ok)
208 # `--fast` and `--normal` run one default way, as well as any other ways which
209 # are explicitly requested by the test using extra_ways().
211 # `make accept` should run all tests exactly once. There is no point in
212 # accepting a test for multiple ways, since it should produce the same output
215 # To make sure all .stderr and .stdout files in the testsuite are never
216 # out-of-date, it is useful if Phabricator, via a normal `./validate` and `make
217 # test`, runs each test at least once.
220 $(MAKE
) -C testsuite
/tests CLEANUP
=1 SUMMARY_FILE
=..
/..
/testsuite_summary.txt fast
224 $(MAKE
) -C testsuite
/tests CLEANUP
=1 SUMMARY_FILE
=..
/..
/testsuite_summary.txt
226 .PHONY
: slowtest fulltest
228 $(MAKE
) -C testsuite
/tests CLEANUP
=1 SUMMARY_FILE
=..
/..
/testsuite_summary.txt slow
232 @echo
"You can use 'make fast' only from inside a sub-component directory."