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