Build ghc-iserv with --export-dynamic
[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 .PHONY: binary-dist
133 binary-dist: binary-dist-prep
134 mv bindistprep/*.tar.$(TAR_COMP_EXT) .
135
136 .PHONY: binary-dist-prep
137 binary-dist-prep:
138 ifeq "$(mingw32_TARGET_OS)" "1"
139 $(MAKE) --no-print-directory -f ghc.mk windows-binary-dist-prep
140 else
141 rm -f bindist-list
142 $(MAKE) --no-print-directory -f ghc.mk bindist-list BINDIST=YES
143 $(MAKE) --no-print-directory -f ghc.mk unix-binary-dist-prep
144 endif
145
146 .PHONY: install-strip
147 install-strip:
148 # See Note [install-strip].
149 $(MAKE) --no-print-directory -f ghc.mk INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
150
151 .PHONY: sdist sdist-ghc sdist-ghc-prep sdist-windows-tarballs sdist-windows-tarballs-prep sdist-testsuite sdist-testsuite-prep
152 # Just running `./boot && ./configure && make sdist` should work, so skip
153 # phase 0 and 1 and don't build any dependency files.
154 sdist sdist-ghc sdist-ghc-prep sdist-windows-tarballs sdist-windows-tarballs-prep sdist-testsuite sdist-testsuite-prep :
155 $(MAKE) --no-print-directory -f ghc.mk $@ NO_INCLUDE_DEPS=YES NO_INCLUDE_PKGDATA=YES
156
157 .PHONY: clean distclean maintainer-clean
158 clean distclean maintainer-clean:
159 $(MAKE) --no-print-directory -f ghc.mk $@ CLEANING=YES
160 test ! -d testsuite || $(MAKE) -C testsuite $@
161
162 .PHONY: $(filter clean_%,$(MAKECMDGOALS))
163 $(filter clean_%, $(MAKECMDGOALS)) : clean_% :
164 $(MAKE) --no-print-directory -f ghc.mk $@ CLEANING=YES
165
166 .PHONY: bootstrapping-files show echo
167 bootstrapping-files show echo:
168 $(MAKE) --no-print-directory -f ghc.mk $@
169
170 .PHONY: show!
171 show!:
172 $(MAKE) --no-print-directory -f ghc.mk show NO_INCLUDE_PKGDATA=YES
173
174 ifeq "$(darwin_TARGET_OS)" "1"
175 .PHONY: framework-pkg
176 framework-pkg:
177 $(MAKE) -C distrib/MacOS $@
178 endif
179
180 # If the user says 'make A B', then we don't want to invoke two
181 # instances of the rule above in parallel:
182 .NOTPARALLEL:
183
184 endif
185
186 # Note [validate and testsuite speed]
187 #
188 # There are 3 different validate and testsuite speed settings:
189 # fast, normal and slow.
190 #
191 # how how used
192 # cd tests config. many many by
193 # validate && make speed= tests ways whom
194 # =============================================================================
195 # --fast fast 2 some 1+exs Travis (to stay within time limit)
196 # --normal test 1 all 1+exs Phabricator (slow takes too long?)
197 # --slow slow 0 all all Nightly (slow is ok)
198 #
199 # accept 1 all 1
200 #
201 # `--fast` and `--normal` run one default way, as well as any other ways which
202 # are explicitly requested by the test using extra_ways().
203 #
204 # `make accept` should run all tests exactly once. There is no point in
205 # accepting a test for multiple ways, since it should produce the same output
206 # for all ways.
207 #
208 # To make sure all .stderr and .stdout files in the testsuite are never
209 # out-of-date, it is useful if Phabricator, via a normal `./validate` and `make
210 # test`, runs each test at least once.
211 .PHONY: fasttest
212 fasttest:
213 $(MAKE) -C testsuite/tests CLEANUP=1 SUMMARY_FILE=../../testsuite_summary.txt fast
214
215 .PHONY: test
216 test:
217 $(MAKE) -C testsuite/tests CLEANUP=1 SUMMARY_FILE=../../testsuite_summary.txt
218
219 .PHONY: slowtest fulltest
220 slowtest fulltest:
221 $(MAKE) -C testsuite/tests CLEANUP=1 SUMMARY_FILE=../../testsuite_summary.txt slow