Make GHC-in-GHCi work on Windows
[ghc.git] / compiler / ghc.mk
1 # -----------------------------------------------------------------------------
2 #
3 # (c) 2009-2012 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 # https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture
9 # https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying
10 #
11 # -----------------------------------------------------------------------------
12
13 # -----------------------------------------------------------------------------
14 # Create compiler configuration
15 #
16 # The 'echo' commands simply spit the values of various make variables
17 # into Config.hs, whence they can be compiled and used by GHC itself
18
19 # This is just to avoid generating a warning when generating deps
20 # involving RtsFlags.h
21 compiler_stage1_MKDEPENDC_OPTS = -DMAKING_GHC_BUILD_SYSTEM_DEPENDENCIES
22 compiler_stage2_MKDEPENDC_OPTS = -DMAKING_GHC_BUILD_SYSTEM_DEPENDENCIES
23 compiler_stage3_MKDEPENDC_OPTS = -DMAKING_GHC_BUILD_SYSTEM_DEPENDENCIES
24
25 compiler_stage1_C_FILES_NODEPS = compiler/parser/cutils.c
26
27 # This package doesn't pass the Cabal checks because include-dirs
28 # points outside the source directory. This isn't a real problem, so
29 # we just skip the check.
30 compiler_NO_CHECK = YES
31
32 ifneq "$(BINDIST)" "YES"
33 compiler/stage1/package-data.mk : compiler/stage1/build/Config.hs
34 compiler/stage2/package-data.mk : compiler/stage2/build/Config.hs
35 compiler/stage3/package-data.mk : compiler/stage3/build/Config.hs
36
37 compiler/stage1/build/PlatformConstants.o: $(includes_GHCCONSTANTS_HASKELL_TYPE)
38 compiler/stage2/build/PlatformConstants.o: $(includes_GHCCONSTANTS_HASKELL_TYPE)
39 compiler/stage3/build/PlatformConstants.o: $(includes_GHCCONSTANTS_HASKELL_TYPE)
40 compiler/stage1/build/DynFlags.o: $(includes_GHCCONSTANTS_HASKELL_EXPORTS)
41 compiler/stage2/build/DynFlags.o: $(includes_GHCCONSTANTS_HASKELL_EXPORTS)
42 compiler/stage3/build/DynFlags.o: $(includes_GHCCONSTANTS_HASKELL_EXPORTS)
43 compiler/stage1/build/DynFlags.o: $(includes_GHCCONSTANTS_HASKELL_WRAPPERS)
44 compiler/stage2/build/DynFlags.o: $(includes_GHCCONSTANTS_HASKELL_WRAPPERS)
45 compiler/stage3/build/DynFlags.o: $(includes_GHCCONSTANTS_HASKELL_WRAPPERS)
46 endif
47
48 compiler/stage%/build/Config.hs : mk/config.mk mk/project.mk | $$(dir $$@)/.
49 $(call removeFiles,$@)
50 @echo 'Creating $@ ... '
51 @echo '{-# LANGUAGE CPP #-}' >> $@
52 @echo 'module Config' >> $@
53 @echo ' ( module GHC.Version' >> $@
54 @echo ' , cBuildPlatformString' >> $@
55 @echo ' , cHostPlatformString' >> $@
56 @echo ' , cProjectName' >> $@
57 @echo ' , cBooterVersion' >> $@
58 @echo ' , cStage' >> $@
59 @echo ' ) where' >> $@
60 @echo >> $@
61 @echo 'import GhcPrelude' >> $@
62 @echo >> $@
63 @echo 'import GHC.Version' >> $@
64 @echo >> $@
65 @echo '#include "ghc_boot_platform.h"' >> $@
66 @echo >> $@
67 @echo 'cBuildPlatformString :: String' >> $@
68 @echo 'cBuildPlatformString = BuildPlatform_NAME' >> $@
69 @echo >> $@
70 @echo 'cHostPlatformString :: String' >> $@
71 @echo 'cHostPlatformString = HostPlatform_NAME' >> $@
72 @echo >> $@
73 @echo 'cProjectName :: String' >> $@
74 @echo 'cProjectName = "$(ProjectName)"' >> $@
75 @echo >> $@
76 @echo 'cBooterVersion :: String' >> $@
77 @echo 'cBooterVersion = "$(GhcVersion)"' >> $@
78 @echo >> $@
79 @echo 'cStage :: String' >> $@
80 @echo 'cStage = show (STAGE :: Int)' >> $@
81 @echo done.
82
83 # -----------------------------------------------------------------------------
84 # Create platform includes
85
86 # Here we generate a little header file containing CPP symbols that GHC
87 # uses to determine which platform it is building on/for. The platforms
88 # can differ between stage1 and stage2 if we're cross-compiling, so we
89 # need one of these header files per stage.
90
91 PLATFORM_H = ghc_boot_platform.h
92
93 compiler/stage1/$(PLATFORM_H) : mk/config.mk mk/project.mk | $$(dir $$@)/.
94 $(call removeFiles,$@)
95 @echo "Creating $@..."
96 @echo "#if !defined(__PLATFORM_H__)" >> $@
97 @echo "#define __PLATFORM_H__" >> $@
98 @echo >> $@
99 @echo "#define BuildPlatform_NAME \"$(BUILDPLATFORM)\"" >> $@
100 @echo "#define HostPlatform_NAME \"$(HOSTPLATFORM)\"" >> $@
101 @echo >> $@
102 @echo "#define $(BuildPlatform_CPP)_BUILD 1" >> $@
103 @echo "#define $(HostPlatform_CPP)_HOST 1" >> $@
104 @echo "#define $(TargetPlatform_CPP)_TARGET 1" >> $@
105 @echo >> $@
106 @echo "#define $(BuildArch_CPP)_BUILD_ARCH 1" >> $@
107 @echo "#define $(HostArch_CPP)_HOST_ARCH 1" >> $@
108 @echo "#define $(TargetArch_CPP)_TARGET_ARCH 1" >> $@
109 @echo "#define BUILD_ARCH \"$(BuildArch_CPP)\"" >> $@
110 @echo "#define HOST_ARCH \"$(HostArch_CPP)\"" >> $@
111 @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
112 @echo >> $@
113 @echo "#define $(BuildOS_CPP)_BUILD_OS 1" >> $@
114 @echo "#define $(HostOS_CPP)_HOST_OS 1" >> $@
115 @echo "#define $(TargetOS_CPP)_TARGET_OS 1" >> $@
116 @echo "#define BUILD_OS \"$(BuildOS_CPP)\"" >> $@
117 @echo "#define HOST_OS \"$(HostOS_CPP)\"" >> $@
118 @echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@
119 @echo >> $@
120 @echo "#define $(BuildVendor_CPP)_BUILD_VENDOR 1" >> $@
121 @echo "#define $(HostVendor_CPP)_HOST_VENDOR 1" >> $@
122 @echo "#define $(TargetVendor_CPP)_TARGET_VENDOR 1" >> $@
123 @echo "#define BUILD_VENDOR \"$(BuildVendor_CPP)\"" >> $@
124 @echo "#define HOST_VENDOR \"$(HostVendor_CPP)\"" >> $@
125 @echo "#define TARGET_VENDOR \"$(TargetVendor_CPP)\"" >> $@
126 @echo >> $@
127 @echo "#endif /* __PLATFORM_H__ */" >> $@
128 @echo "Done."
129
130 # For stage2 and above, the BUILD platform is the HOST of stage1, and
131 # the HOST platform is the TARGET of stage1. The TARGET remains the same
132 # (stage1 is the cross-compiler, not stage2).
133 compiler/stage2/$(PLATFORM_H) : mk/config.mk mk/project.mk | $$(dir $$@)/.
134 $(call removeFiles,$@)
135 @echo "Creating $@..."
136 @echo "#if !defined(__PLATFORM_H__)" >> $@
137 @echo "#define __PLATFORM_H__" >> $@
138 @echo >> $@
139 @echo "#define BuildPlatform_NAME \"$(HOSTPLATFORM)\"" >> $@
140 @echo "#define HostPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
141 @echo >> $@
142 @echo "#define $(HostPlatform_CPP)_BUILD 1" >> $@
143 @echo "#define $(TargetPlatform_CPP)_HOST 1" >> $@
144 @echo "#define $(TargetPlatform_CPP)_TARGET 1" >> $@
145 @echo >> $@
146 @echo "#define $(HostArch_CPP)_BUILD_ARCH 1" >> $@
147 @echo "#define $(TargetArch_CPP)_HOST_ARCH 1" >> $@
148 @echo "#define $(TargetArch_CPP)_TARGET_ARCH 1" >> $@
149 @echo "#define BUILD_ARCH \"$(HostArch_CPP)\"" >> $@
150 @echo "#define HOST_ARCH \"$(TargetArch_CPP)\"" >> $@
151 @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
152 @echo >> $@
153 @echo "#define $(HostOS_CPP)_BUILD_OS 1" >> $@
154 @echo "#define $(TargetOS_CPP)_HOST_OS 1" >> $@
155 @echo "#define $(TargetOS_CPP)_TARGET_OS 1" >> $@
156 @echo "#define BUILD_OS \"$(HostOS_CPP)\"" >> $@
157 @echo "#define HOST_OS \"$(TargetOS_CPP)\"" >> $@
158 @echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@
159 @echo >> $@
160 @echo "#define $(HostVendor_CPP)_BUILD_VENDOR 1" >> $@
161 @echo "#define $(TargetVendor_CPP)_HOST_VENDOR 1" >> $@
162 @echo "#define $(TargetVendor_CPP)_TARGET_VENDOR 1" >> $@
163 @echo "#define BUILD_VENDOR \"$(HostVendor_CPP)\"" >> $@
164 @echo "#define HOST_VENDOR \"$(TargetVendor_CPP)\"" >> $@
165 @echo "#define TARGET_VENDOR \"$(TargetVendor_CPP)\"" >> $@
166 @echo >> $@
167 @echo "#endif /* __PLATFORM_H__ */" >> $@
168 @echo "Done."
169
170 compiler/stage3/$(PLATFORM_H) : compiler/stage2/$(PLATFORM_H)
171 "$(CP)" $< $@
172
173 # ----------------------------------------------------------------------------
174 # Generate supporting stuff for prelude/PrimOp.hs
175 # from prelude/primops.txt
176
177 PRIMOP_BITS_NAMES = primop-data-decl.hs-incl \
178 primop-tag.hs-incl \
179 primop-list.hs-incl \
180 primop-has-side-effects.hs-incl \
181 primop-out-of-line.hs-incl \
182 primop-commutable.hs-incl \
183 primop-code-size.hs-incl \
184 primop-can-fail.hs-incl \
185 primop-strictness.hs-incl \
186 primop-fixity.hs-incl \
187 primop-primop-info.hs-incl \
188 primop-vector-uniques.hs-incl \
189 primop-vector-tys.hs-incl \
190 primop-vector-tys-exports.hs-incl \
191 primop-vector-tycons.hs-incl
192
193 PRIMOP_BITS_STAGE1 = $(addprefix compiler/stage1/build/,$(PRIMOP_BITS_NAMES))
194 PRIMOP_BITS_STAGE2 = $(addprefix compiler/stage2/build/,$(PRIMOP_BITS_NAMES))
195 PRIMOP_BITS_STAGE3 = $(addprefix compiler/stage3/build/,$(PRIMOP_BITS_NAMES))
196
197 compiler_CPP_OPTS += $(addprefix -I,$(GHC_INCLUDE_DIRS))
198 compiler_CPP_OPTS += ${GhcCppOpts}
199
200 # We add these paths to the Haskell compiler's #include search path list since
201 # we must avoid #including files by paths relative to the source file as Hadrian
202 # moves the build artifacts out of the source tree. See #8040.
203 compiler_HC_OPTS += $(addprefix -I,$(GHC_INCLUDE_DIRS))
204
205 define preprocessCompilerFiles
206 # $0 = stage
207 compiler/stage$1/build/primops.txt: compiler/prelude/primops.txt.pp compiler/stage$1/$$(PLATFORM_H)
208 $$(HS_CPP) -P $$(compiler_CPP_OPTS) -Icompiler/stage$1 -x c $$< | grep -v '^#pragma GCC' > $$@
209
210 compiler/stage$1/build/primop-data-decl.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE)
211 "$$(genprimopcode_INPLACE)" --data-decl < $$< > $$@
212 compiler/stage$1/build/primop-tag.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE)
213 "$$(genprimopcode_INPLACE)" --primop-tag < $$< > $$@
214 compiler/stage$1/build/primop-list.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE)
215 "$$(genprimopcode_INPLACE)" --primop-list < $$< > $$@
216 compiler/stage$1/build/primop-has-side-effects.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE)
217 "$$(genprimopcode_INPLACE)" --has-side-effects < $$< > $$@
218 compiler/stage$1/build/primop-out-of-line.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE)
219 "$$(genprimopcode_INPLACE)" --out-of-line < $$< > $$@
220 compiler/stage$1/build/primop-commutable.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE)
221 "$$(genprimopcode_INPLACE)" --commutable < $$< > $$@
222 compiler/stage$1/build/primop-code-size.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE)
223 "$$(genprimopcode_INPLACE)" --code-size < $$< > $$@
224 compiler/stage$1/build/primop-can-fail.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE)
225 "$$(genprimopcode_INPLACE)" --can-fail < $$< > $$@
226 compiler/stage$1/build/primop-strictness.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE)
227 "$$(genprimopcode_INPLACE)" --strictness < $$< > $$@
228 compiler/stage$1/build/primop-fixity.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE)
229 "$$(genprimopcode_INPLACE)" --fixity < $$< > $$@
230 compiler/stage$1/build/primop-primop-info.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE)
231 "$$(genprimopcode_INPLACE)" --primop-primop-info < $$< > $$@
232 compiler/stage$1/build/primop-vector-uniques.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE)
233 "$$(genprimopcode_INPLACE)" --primop-vector-uniques < $$< > $$@
234 compiler/stage$1/build/primop-vector-tys.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE)
235 "$$(genprimopcode_INPLACE)" --primop-vector-tys < $$< > $$@
236 compiler/stage$1/build/primop-vector-tys-exports.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE)
237 "$$(genprimopcode_INPLACE)" --primop-vector-tys-exports < $$< > $$@
238 compiler/stage$1/build/primop-vector-tycons.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE)
239 "$$(genprimopcode_INPLACE)" --primop-vector-tycons < $$< > $$@
240
241 # Usages aren't used any more; but the generator
242 # can still generate them if we want them back
243 compiler/stage$1/build/primop-usage.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE)
244 "$$(genprimopcode_INPLACE)" --usage < $$< > $$@
245
246 endef
247
248 $(eval $(call preprocessCompilerFiles,1))
249 $(eval $(call preprocessCompilerFiles,2))
250 $(eval $(call preprocessCompilerFiles,3))
251
252 # -----------------------------------------------------------------------------
253 # Configuration
254
255 compiler_stage1_CONFIGURE_OPTS += --flags=stage1
256 compiler_stage2_CONFIGURE_OPTS += --flags=stage2
257 compiler_stage3_CONFIGURE_OPTS += --flags=stage3
258
259 ifeq "$(GhcThreaded)" "YES"
260 # We pass THREADED_RTS to the stage2 C files so that cbits/genSym.c will bring
261 # the threaded version of atomic_inc() into scope.
262 compiler_stage2_CONFIGURE_OPTS += --ghc-option=-optc-DTHREADED_RTS
263 endif
264
265 ifeq "$(GhcWithNativeCodeGen)" "YES"
266 compiler_stage1_CONFIGURE_OPTS += --flags=ncg
267 compiler_stage2_CONFIGURE_OPTS += --flags=ncg
268 endif
269
270 ifeq "$(GhcWithInterpreter)" "YES"
271 compiler_stage2_CONFIGURE_OPTS += --flags=ghci
272
273 ifeq "$(GhcEnableTablesNextToCode) $(GhcUnregisterised)" "YES NO"
274 # Should GHCI be building info tables in the TABLES_NEXT_TO_CODE style
275 # or not?
276 # XXX This should logically be a CPP option, but there doesn't seem to
277 # be a flag for that
278 compiler_stage2_CONFIGURE_OPTS += --ghc-option=-DGHCI_TABLES_NEXT_TO_CODE
279 endif
280
281 # Should the debugger commands be enabled?
282 ifeq "$(GhciWithDebugger)" "YES"
283 compiler_stage2_CONFIGURE_OPTS += --ghc-option=-DDEBUGGER
284 endif
285
286 endif
287
288 ifeq "$(TargetOS_CPP)" "openbsd"
289 compiler_CONFIGURE_OPTS += --ld-options=-E
290 endif
291
292 ifeq "$(GhcUnregisterised)" "NO"
293 else
294 compiler_CONFIGURE_OPTS += --ghc-option=-DNO_REGS
295 endif
296
297 ifneq "$(GhcWithSMP)" "YES"
298 compiler_CONFIGURE_OPTS += --ghc-option=-DNOSMP
299 compiler_CONFIGURE_OPTS += --ghc-option=-optc-DNOSMP
300 endif
301
302 ifeq "$(WITH_TERMINFO)" "NO"
303 compiler_stage2_CONFIGURE_OPTS += --flags=-terminfo
304 endif
305
306 # Careful optimisation of the parser: we don't want to throw everything
307 # at it, because that takes too long and doesn't buy much, but we do want
308 # to inline certain key external functions, so we instruct GHC not to
309 # throw away inlinings as it would normally do in -O0 mode.
310 # Since GHC version 7.8, we need -fcmm-sink to be
311 # passed to the compiler. This is required on x86 to avoid the
312 # register allocator running out of stack slots when compiling this
313 # module with -fPIC -dynamic.
314 # See #8182 for all the details
315 compiler/stage1/build/Parser_HC_OPTS += -O0 -fno-ignore-interface-pragmas -fcmm-sink
316 compiler/stage2/build/Parser_HC_OPTS += -O0 -fno-ignore-interface-pragmas -fcmm-sink
317 compiler/stage3/build/Parser_HC_OPTS += -O0 -fno-ignore-interface-pragmas -fcmm-sink
318
319 ifeq "$(GhcProfiled)" "YES"
320 # If we're profiling GHC then we want SCCs. However, adding -auto-all
321 # everywhere tends to give a hard-to-read profile, and adds lots of
322 # overhead. A better approach is to proceed top-down; identify the
323 # parts of the compiler of interest, and then add further cost centres
324 # as necessary. Turn on -fprof-auto for individual modules like this:
325
326 # compiler/main/DriverPipeline_HC_OPTS += -fprof-auto
327 compiler/main/GhcMake_HC_OPTS += -fprof-auto
328 compiler/main/GHC_HC_OPTS += -fprof-auto
329
330 # or alternatively add {-# OPTIONS_GHC -fprof-auto #-} to the top of
331 # modules you're interested in.
332
333 # We seem to still build the vanilla libraries even if we say
334 # --disable-library-vanilla, but installation then fails, as Cabal
335 # doesn't copy the vanilla .hi files, but ghc-pkg complains about
336 # their absence when we register the package. So for now, we just
337 # leave the vanilla libraries enabled.
338 # compiler_stage2_CONFIGURE_OPTS += --disable-library-vanilla
339 compiler_stage2_CONFIGURE_OPTS += --ghc-pkg-option=--force
340 endif
341
342 compiler_stage3_CONFIGURE_OPTS := $(compiler_stage2_CONFIGURE_OPTS)
343
344 compiler_stage1_CONFIGURE_OPTS += --ghc-option=-DSTAGE=1
345 compiler_stage2_CONFIGURE_OPTS += --ghc-option=-DSTAGE=2
346 compiler_stage3_CONFIGURE_OPTS += --ghc-option=-DSTAGE=3
347 compiler_stage2_HADDOCK_OPTS += --optghc=-DSTAGE=2
348
349 compiler/stage1/package-data.mk : compiler/ghc.mk
350 compiler/stage2/package-data.mk : compiler/ghc.mk
351 compiler/stage3/package-data.mk : compiler/ghc.mk
352
353 # -----------------------------------------------------------------------------
354 # And build the package
355
356 compiler_PACKAGE = ghc
357
358 # Don't do splitting for the GHC package, it takes too long and
359 # there's not much benefit.
360 compiler_stage1_SplitSections = NO
361 compiler_stage2_SplitSections = NO
362 compiler_stage3_SplitSections = NO
363
364 # if stage is set to something other than "1" or "", disable stage 1
365 # See Note [Stage1Only vs stage=1] in mk/config.mk.in.
366 ifneq "$(filter-out 1,$(stage))" ""
367 compiler_stage1_NOT_NEEDED = YES
368 endif
369 # if stage is set to something other than "2" or "", disable stage 2
370 ifneq "$(filter-out 2,$(stage))" ""
371 compiler_stage2_NOT_NEEDED = YES
372 endif
373 # stage 3 has to be requested explicitly with stage=3
374 ifneq "$(stage)" "3"
375 compiler_stage3_NOT_NEEDED = YES
376 endif
377 $(eval $(call build-package,compiler,stage1,0))
378 $(eval $(call build-package,compiler,stage2,1))
379 $(eval $(call build-package,compiler,stage3,2))
380
381 # We only want to turn keepCAFs on if we will be loading dynamic
382 # Haskell libraries with GHCi. We therefore filter the object file
383 # out for non-dynamic ways.
384 define keepCAFsForGHCiDynOnly
385 # $1 = stage
386 # $2 = way
387 ifeq "$$(findstring dyn, $2)" ""
388 compiler_stage$1_$2_C_OBJS := $$(filter-out %/keepCAFsForGHCi.$$($2_osuf),$$(compiler_stage$1_$2_C_OBJS))
389 endif
390 endef
391 $(foreach w,$(compiler_stage1_WAYS),$(eval $(call keepCAFsForGHCiDynOnly,1,$w)))
392 $(foreach w,$(compiler_stage2_WAYS),$(eval $(call keepCAFsForGHCiDynOnly,2,$w)))
393 $(foreach w,$(compiler_stage3_WAYS),$(eval $(call keepCAFsForGHCiDynOnly,3,$w)))
394
395 # after build-package, because that adds --enable-library-for-ghci
396 # to compiler_stage*_CONFIGURE_OPTS:
397 # We don't build the GHCi library for the ghc package. We can load it
398 # the .a file instead, and as object splitting isn't on for the ghc
399 # package this isn't much slower.However, not building the package saves
400 # a significant chunk of disk space.
401 compiler_stage1_CONFIGURE_OPTS += --disable-library-for-ghci
402 compiler_stage2_CONFIGURE_OPTS += --disable-library-for-ghci
403 compiler_stage3_CONFIGURE_OPTS += --disable-library-for-ghci
404
405 # after build-package, because that sets compiler_stage1_HC_OPTS:
406 ifeq "$(V)" "0"
407 compiler_stage1_HC_OPTS += $(filter-out -Rghc-timing,$(GhcHcOpts)) $(GhcStage1HcOpts)
408 compiler_stage2_HC_OPTS += $(filter-out -Rghc-timing,$(GhcHcOpts)) $(GhcStage2HcOpts)
409 compiler_stage3_HC_OPTS += $(filter-out -Rghc-timing,$(GhcHcOpts)) $(GhcStage3HcOpts)
410 else
411 compiler_stage1_HC_OPTS += $(GhcHcOpts) $(GhcStage1HcOpts)
412 compiler_stage2_HC_OPTS += $(GhcHcOpts) $(GhcStage2HcOpts)
413 compiler_stage3_HC_OPTS += $(GhcHcOpts) $(GhcStage3HcOpts)
414 endif
415
416 ifneq "$(BINDIST)" "YES"
417
418 $(compiler_stage1_depfile_haskell) : compiler/stage1/$(PLATFORM_H)
419 $(compiler_stage2_depfile_haskell) : compiler/stage2/$(PLATFORM_H)
420 $(compiler_stage3_depfile_haskell) : compiler/stage3/$(PLATFORM_H)
421
422 COMPILER_INCLUDES_DEPS += $(includes_H_CONFIG)
423 COMPILER_INCLUDES_DEPS += $(includes_H_PLATFORM)
424 COMPILER_INCLUDES_DEPS += $(includes_GHCCONSTANTS)
425 COMPILER_INCLUDES_DEPS += $(includes_GHCCONSTANTS_HASKELL_TYPE)
426 COMPILER_INCLUDES_DEPS += $(includes_GHCCONSTANTS_HASKELL_WRAPPERS)
427 COMPILER_INCLUDES_DEPS += $(includes_GHCCONSTANTS_HASKELL_EXPORTS)
428 COMPILER_INCLUDES_DEPS += $(includes_DERIVEDCONSTANTS)
429
430 $(compiler_stage1_depfile_haskell) : $(COMPILER_INCLUDES_DEPS) $(PRIMOP_BITS_STAGE1)
431 $(compiler_stage2_depfile_haskell) : $(COMPILER_INCLUDES_DEPS) $(PRIMOP_BITS_STAGE2)
432 $(compiler_stage3_depfile_haskell) : $(COMPILER_INCLUDES_DEPS) $(PRIMOP_BITS_STAGE3)
433
434 $(foreach way,$(compiler_stage1_WAYS),\
435 compiler/stage1/build/PrimOp.$($(way)_osuf)) : $(PRIMOP_BITS_STAGE1)
436 $(foreach way,$(compiler_stage2_WAYS),\
437 compiler/stage2/build/PrimOp.$($(way)_osuf)) : $(PRIMOP_BITS_STAGE2)
438 $(foreach way,$(compiler_stage3_WAYS),\
439 compiler/stage3/build/PrimOp.$($(way)_osuf)) : $(PRIMOP_BITS_STAGE3)
440
441
442 # GHC itself doesn't know about the above dependencies, so we have to
443 # switch off the recompilation checker for that module:
444 compiler/prelude/PrimOp_HC_OPTS += -fforce-recomp
445
446 ifeq "$(DYNAMIC_GHC_PROGRAMS)" "YES"
447 compiler/utils/Util_HC_OPTS += -DDYNAMIC_GHC_PROGRAMS
448 endif
449
450 endif