GHC new build system megapatch
[ghc-hetmet.git] / compiler / ghc.mk
1 # -----------------------------------------------------------------------------
2 # For expressing extra dependencies on source files
3
4 define compiler-hs-dependency # args: $1 = module, $2 = dependency
5
6 $$(foreach stage,1 2 3,\
7  $$(foreach way,$$(compiler_stage$$(stage)_WAYS),\
8   compiler/stage$$(stage)/build/$1.$($(way)_osuf))) : $2
9
10 endef
11
12 # -----------------------------------------------------------------------------
13 # Create compiler configuration
14 #
15 # The 'echo' commands simply spit the values of various make variables
16 # into Config.hs, whence they can be compiled and used by GHC itself
17
18 compiler_CONFIG_HS = compiler/main/Config.hs
19
20 ifneq "$(BINDIST)" "YES"
21 compiler/stage1/package-data.mk : $(compiler_CONFIG_HS)
22 compiler/stage2/package-data.mk : $(compiler_CONFIG_HS)
23 compiler/stage3/package-data.mk : $(compiler_CONFIG_HS)
24 endif
25
26 $(compiler_CONFIG_HS) : mk/config.mk
27         $(RM) -f $@
28         @echo "Creating $@ ... "
29         @echo "module Config where" >>$@
30         @echo "cProjectName          :: String" >> $@
31         @echo "cProjectName          = \"$(ProjectName)\"" >> $@
32         @echo "cProjectVersion       :: String" >> $@
33         @echo "cProjectVersion       = \"$(ProjectVersion)\"" >> $@
34         @echo "cProjectVersionInt    :: String" >> $@
35         @echo "cProjectVersionInt    = \"$(ProjectVersionInt)\"" >> $@
36         @echo "cProjectPatchLevel    :: String" >> $@
37         @echo "cProjectPatchLevel    = \"$(ProjectPatchLevel)\"" >> $@
38         @echo "cBooterVersion        :: String" >> $@
39         @echo "cBooterVersion        = \"$(GhcVersion)\"" >> $@
40         @echo "cStage                :: String" >> $@
41         @echo "cStage                = show (STAGE :: Int)" >> $@
42         @echo "cHscIfaceFileVersion  :: String" >> $@
43         @echo "cHscIfaceFileVersion  = \"$(HscIfaceFileVersion)\"" >> $@
44         @echo "cSplitObjs            :: String" >> $@
45         @echo "cSplitObjs            = \"$(SupportsSplitObjs)\"" >> $@
46         @echo "cGhcWithInterpreter   :: String" >> $@
47         @echo "cGhcWithInterpreter   = \"$(GhcWithInterpreter)\"" >> $@
48         @echo "cGhcWithNativeCodeGen :: String" >> $@
49         @echo "cGhcWithNativeCodeGen = \"$(GhcWithNativeCodeGen)\"" >> $@
50         @echo "cGhcWithSMP           :: String" >> $@
51         @echo "cGhcWithSMP           = \"$(GhcWithSMP)\"" >> $@
52         @echo "cGhcRTSWays           :: String" >> $@
53         @echo "cGhcRTSWays           = \"$(GhcRTSWays)\"" >> $@
54         @echo "cGhcUnregisterised    :: String" >> $@
55         @echo "cGhcUnregisterised    = \"$(GhcUnregisterised)\"" >> $@
56         @echo "cGhcEnableTablesNextToCode :: String" >> $@
57         @echo "cGhcEnableTablesNextToCode = \"$(GhcEnableTablesNextToCode)\"" >> $@
58         @echo "cLeadingUnderscore    :: String" >> $@
59         @echo "cLeadingUnderscore    = \"$(LeadingUnderscore)\"" >> $@
60         @echo "cRAWCPP_FLAGS         :: String" >> $@
61         @echo "cRAWCPP_FLAGS         = \"$(RAWCPP_FLAGS)\"" >> $@
62         @echo "cGCC                  :: String" >> $@
63         @echo "cGCC                  = \"$(WhatGccIsCalled)\"" >> $@
64         @echo "cMKDLL                :: String" >> $@
65         @echo "cMKDLL                = \"$(BLD_DLL)\"" >> $@
66         @echo "cLdIsGNULd            :: String" >> $@
67         @echo "cLdIsGNULd            = \"$(LdIsGNULd)\"" >> $@
68         @echo "cLD_X                 :: String" >> $@
69         @echo "cLD_X                 = \"$(LD_X)\"" >> $@
70         @echo "cGHC_DRIVER_DIR   :: String" >> $@
71         @echo "cGHC_DRIVER_DIR   = \"$(GHC_DRIVER_DIR)\"" >> $@
72         @echo "cGHC_TOUCHY_PGM       :: String" >> $@
73         @echo "cGHC_TOUCHY_PGM       = \"$(GHC_TOUCHY_PGM)\"" >> $@
74         @echo "cGHC_TOUCHY_DIR   :: String" >> $@
75         @echo "cGHC_TOUCHY_DIR   = \"$(GHC_TOUCHY_DIR)\"" >> $@
76         @echo "cGHC_UNLIT_PGM        :: String" >> $@
77         @echo "cGHC_UNLIT_PGM        = \"$(GHC_UNLIT_PGM)\"" >> $@
78         @echo "cGHC_UNLIT_DIR    :: String" >> $@
79         @echo "cGHC_UNLIT_DIR    = \"$(GHC_UNLIT_DIR)\"" >> $@
80         @echo "cGHC_MANGLER_PGM      :: String" >> $@
81         @echo "cGHC_MANGLER_PGM      = \"$(GHC_MANGLER_PGM)\"" >> $@
82         @echo "cGHC_MANGLER_DIR  :: String" >> $@
83         @echo "cGHC_MANGLER_DIR  = \"$(GHC_MANGLER_DIR)\"" >> $@
84         @echo "cGHC_SPLIT_PGM        :: String" >> $@
85         @echo "cGHC_SPLIT_PGM        = \"$(GHC_SPLIT_PGM)\"" >> $@
86         @echo "cGHC_SPLIT_DIR    :: String" >> $@
87         @echo "cGHC_SPLIT_DIR    = \"$(GHC_SPLIT_DIR)\"" >> $@
88         @echo "cGHC_SYSMAN_PGM       :: String" >> $@
89         @echo "cGHC_SYSMAN_PGM       = \"$(GHC_SYSMAN)\"" >> $@
90         @echo "cGHC_SYSMAN_DIR   :: String" >> $@
91         @echo "cGHC_SYSMAN_DIR   = \"$(GHC_SYSMAN_DIR)\"" >> $@
92         @echo "cGHC_CP               :: String" >> $@
93         @echo "cGHC_CP               = \"$(GHC_CP)\"" >> $@
94         @echo "cGHC_PERL             :: String" >> $@
95         @echo "cGHC_PERL             = \"$(GHC_PERL)\"" >> $@
96         @echo "cEnableWin32DLLs      :: String" >> $@
97         @echo "cEnableWin32DLLs      = \"$(EnableWin32DLLs)\"" >> $@
98         @echo "cCONTEXT_DIFF         :: String" >> $@
99         @echo "cCONTEXT_DIFF         = \"$(CONTEXT_DIFF)\"" >> $@
100         @echo "cUSER_WAY_NAMES       :: String" >> $@
101         @echo "cUSER_WAY_NAMES       = \"$(USER_WAY_NAMES)\"" >> $@
102         @echo "cUSER_WAY_OPTS        :: String" >> $@
103         @echo "cUSER_WAY_OPTS        = \"$(USER_WAY_OPTS)\"" >> $@
104         @echo "cDEFAULT_TMPDIR       :: String" >> $@
105         @echo "cDEFAULT_TMPDIR       = \"$(DEFAULT_TMPDIR)\"" >> $@
106         @echo "cRelocatableBuild     :: Bool"                 >> $@
107 ifeq "$(RelocatableBuild)" "YES"
108         @echo "cRelocatableBuild     = True"                  >> $@
109 else
110         @echo "cRelocatableBuild     = False"                 >> $@
111 endif
112         @echo "cLibFFI               :: Bool"                 >> $@
113 ifeq "$(UseLibFFIForAdjustors)" "YES"
114         @echo "cLibFFI               = True"                  >> $@
115 else
116         @echo "cLibFFI               = False"                 >> $@
117 endif
118         @echo done.
119
120 $(eval $(call clean-target,compiler,config_hs,$(compiler_CONFIG_HS)))
121
122 # -----------------------------------------------------------------------------
123 # Create platform includes
124
125 # Here we generate a little header file containing CPP symbols that GHC
126 # uses to determine which platform it is building on/for.  The platforms
127 # can differ between stage1 and stage2 if we're cross-compiling, so we
128 # need one of these header files per stage.
129
130 PLATFORM_H = ghc_boot_platform.h
131
132 compiler/stage1/$(PLATFORM_H) : mk/config.mk
133         $(MKDIRHIER) $(dir $@)
134         $(RM) $@
135         @echo "Creating $@..."
136         @echo "#ifndef __PLATFORM_H__"  >$@
137         @echo "#define __PLATFORM_H__" >>$@
138         @echo >> $@
139         @echo "#define BuildPlatform_NAME  \"$(BUILDPLATFORM)\"" >> $@
140         @echo "#define HostPlatform_NAME   \"$(HOSTPLATFORM)\"" >> $@
141         @echo "#define TargetPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
142         @echo >> $@
143         @echo "#define $(BuildPlatform_CPP)_BUILD       1" >> $@
144         @echo "#define $(HostPlatform_CPP)_HOST         1" >> $@
145         @echo "#define $(TargetPlatform_CPP)_TARGET     1" >> $@
146         @echo >> $@
147         @echo "#define $(BuildArch_CPP)_BUILD_ARCH      1" >> $@
148         @echo "#define $(HostArch_CPP)_HOST_ARCH        1" >> $@
149         @echo "#define $(TargetArch_CPP)_TARGET_ARCH    1" >> $@
150         @echo "#define BUILD_ARCH \"$(BuildArch_CPP)\"" >> $@
151         @echo "#define HOST_ARCH \"$(HostArch_CPP)\"" >> $@
152         @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
153         @echo >> $@
154         @echo "#define $(BuildOS_CPP)_BUILD_OS          1" >> $@
155         @echo "#define $(HostOS_CPP)_HOST_OS            1" >> $@
156         @echo "#define $(TargetOS_CPP)_TARGET_OS        1" >> $@  
157         @echo "#define BUILD_OS \"$(BuildOS_CPP)\"" >> $@
158         @echo "#define HOST_OS \"$(HostOS_CPP)\"" >> $@
159         @echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@
160 ifeq "$(HostOS_CPP)" "irix"
161         @echo "#ifndef $(IRIX_MAJOR)_TARGET_OS           " >> $@  
162         @echo "#define $(IRIX_MAJOR)_TARGET_OS          1" >> $@  
163         @echo "#endif                                    " >> $@  
164 endif
165         @echo >> $@
166         @echo "#define $(BuildVendor_CPP)_BUILD_VENDOR  1" >> $@
167         @echo "#define $(HostVendor_CPP)_HOST_VENDOR    1" >> $@
168         @echo "#define $(TargetVendor_CPP)_TARGET_VENDOR  1" >> $@
169         @echo "#define BUILD_VENDOR \"$(BuildVendor_CPP)\"" >> $@
170         @echo "#define HOST_VENDOR \"$(HostVendor_CPP)\"" >> $@
171         @echo "#define TARGET_VENDOR \"$(TargetVendor_CPP)\"" >> $@
172         @echo >> $@
173         @echo "#endif /* __PLATFORM_H__ */"          >> $@
174         @echo "Done."
175
176 # For stage2 and above, the BUILD platform is the HOST of stage1, and
177 # the HOST platform is the TARGET of stage1.  The TARGET remains the same
178 # (stage1 is the cross-compiler, not stage2).
179 compiler/stage2/$(PLATFORM_H) : mk/config.mk
180         $(MKDIRHIER) $(dir $@)
181         $(RM) $@
182         @echo "Creating $@..."
183         @echo "#ifndef __PLATFORM_H__"  >$@
184         @echo "#define __PLATFORM_H__" >>$@
185         @echo >> $@
186         @echo "#define BuildPlatform_NAME  \"$(HOSTPLATFORM)\"" >> $@
187         @echo "#define HostPlatform_NAME   \"$(TARGETPLATFORM)\"" >> $@
188         @echo "#define TargetPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
189         @echo >> $@
190         @echo "#define $(HostPlatform_CPP)_BUILD        1" >> $@
191         @echo "#define $(TargetPlatform_CPP)_HOST               1" >> $@
192         @echo "#define $(TargetPlatform_CPP)_TARGET     1" >> $@
193         @echo >> $@
194         @echo "#define $(HostArch_CPP)_BUILD_ARCH       1" >> $@
195         @echo "#define $(TargetArch_CPP)_HOST_ARCH      1" >> $@
196         @echo "#define $(TargetArch_CPP)_TARGET_ARCH    1" >> $@
197         @echo "#define BUILD_ARCH \"$(HostArch_CPP)\"" >> $@
198         @echo "#define HOST_ARCH \"$(TargetArch_CPP)\"" >> $@
199         @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
200         @echo >> $@
201         @echo "#define $(HostOS_CPP)_BUILD_OS           1" >> $@
202         @echo "#define $(TargetOS_CPP)_HOST_OS          1" >> $@
203         @echo "#define $(TargetOS_CPP)_TARGET_OS        1" >> $@  
204         @echo "#define BUILD_OS \"$(HostOS_CPP)\"" >> $@
205         @echo "#define HOST_OS \"$(TargetOS_CPP)\"" >> $@
206         @echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@
207 ifeq "$(HostOS_CPP)" "irix"
208         @echo "#ifndef $(IRIX_MAJOR)_TARGET_OS           " >> $@  
209         @echo "#define $(IRIX_MAJOR)_TARGET_OS          1" >> $@  
210         @echo "#endif                                    " >> $@  
211 endif
212         @echo >> $@
213         @echo "#define $(HostVendor_CPP)_BUILD_VENDOR   1" >> $@
214         @echo "#define $(TargetVendor_CPP)_HOST_VENDOR  1" >> $@
215         @echo "#define $(TargetVendor_CPP)_TARGET_VENDOR  1" >> $@
216         @echo "#define BUILD_VENDOR \"$(HostVendor_CPP)\"" >> $@
217         @echo "#define HOST_VENDOR \"$(TargetVendor_CPP)\"" >> $@
218         @echo "#define TARGET_VENDOR \"$(TargetVendor_CPP)\"" >> $@
219         @echo >> $@
220         @echo "#endif /* __PLATFORM_H__ */"          >> $@
221         @echo "Done."
222
223 compiler/stage3/$(PLATFORM_H) : compiler/stage2/$(PLATFORM_H)
224         $(CP) $< $@
225
226 # Every Constants.o object file depends on includes/GHCConstants.h:
227 $(eval $(call compiler-hs-dependency,Constants,$(includes_GHCCONSTANTS)))
228
229 # ----------------------------------------------------------------------------
230 #               Generate supporting stuff for prelude/PrimOp.lhs 
231 #               from prelude/primops.txt
232
233 # XXX: these should go in stage1/stage2/stage3
234 PRIMOP_BITS = compiler/primop-data-decl.hs-incl        \
235               compiler/primop-tag.hs-incl              \
236               compiler/primop-list.hs-incl             \
237               compiler/primop-has-side-effects.hs-incl \
238               compiler/primop-out-of-line.hs-incl      \
239               compiler/primop-commutable.hs-incl       \
240               compiler/primop-needs-wrapper.hs-incl    \
241               compiler/primop-can-fail.hs-incl         \
242               compiler/primop-strictness.hs-incl       \
243               compiler/primop-primop-info.hs-incl
244
245 compiler_CPP_OPTS += -I$(GHC_INCLUDE_DIR)
246 compiler_CPP_OPTS += ${GhcCppOpts}
247
248 $(PRIMOPS_TXT) compiler/parser/Parser.y: %: %.pp compiler/stage1/$(PLATFORM_H)
249         $(CPP) $(RAWCPP_FLAGS) -P $(compiler_CPP_OPTS) -x c $< | grep -v '^#pragma GCC' > $@
250
251 $(eval $(call clean-target,compiler,primop, $(PRIMOPS_TXT) compiler/parser/Parser.y $(PRIMOP_BITS)))
252
253 compiler/primop-data-decl.hs-incl: $(PRIMOPS_TXT) $(GENPRIMOP_INPLACE)
254         $(GENPRIMOP_INPLACE) --data-decl          < $< > $@
255 compiler/primop-tag.hs-incl: $(PRIMOPS_TXT) $(GENPRIMOP_INPLACE)
256         $(GENPRIMOP_INPLACE) --primop-tag         < $< > $@
257 compiler/primop-list.hs-incl: $(PRIMOPS_TXT) $(GENPRIMOP_INPLACE)
258         $(GENPRIMOP_INPLACE) --primop-list        < $< > $@
259 compiler/primop-has-side-effects.hs-incl: $(PRIMOPS_TXT) $(GENPRIMOP_INPLACE)
260         $(GENPRIMOP_INPLACE) --has-side-effects   < $< > $@
261 compiler/primop-out-of-line.hs-incl: $(PRIMOPS_TXT) $(GENPRIMOP_INPLACE)
262         $(GENPRIMOP_INPLACE) --out-of-line        < $< > $@
263 compiler/primop-commutable.hs-incl: $(PRIMOPS_TXT) $(GENPRIMOP_INPLACE)
264         $(GENPRIMOP_INPLACE) --commutable         < $< > $@
265 compiler/primop-needs-wrapper.hs-incl: $(PRIMOPS_TXT) $(GENPRIMOP_INPLACE)
266         $(GENPRIMOP_INPLACE) --needs-wrapper      < $< > $@
267 compiler/primop-can-fail.hs-incl: $(PRIMOPS_TXT) $(GENPRIMOP_INPLACE)
268         $(GENPRIMOP_INPLACE) --can-fail           < $< > $@
269 compiler/primop-strictness.hs-incl: $(PRIMOPS_TXT) $(GENPRIMOP_INPLACE)
270         $(GENPRIMOP_INPLACE) --strictness         < $< > $@
271 compiler/primop-primop-info.hs-incl: $(PRIMOPS_TXT) $(GENPRIMOP_INPLACE)
272         $(GENPRIMOP_INPLACE) --primop-primop-info < $< > $@
273
274 # Every PrimOp.o object file depends on $(PRIMOP_BITS):
275 $(eval $(call compiler-hs-dependency,PrimOp,$(PRIMOP_BITS)))
276
277 # Usages aren't used any more; but the generator 
278 # can still generate them if we want them back
279 compiler/primop-usage.hs-incl: $(PRIMOPS_TXT)
280         $(GENPRIMOP_INPLACE) --usage              < $< > $@
281
282 # -----------------------------------------------------------------------------
283 # Configuration
284
285 compiler_stage1_CONFIGURE_OPTS += --flags=stage1
286 compiler_stage2_CONFIGURE_OPTS += --flags=stage2
287 compiler_stage3_CONFIGURE_OPTS += --flags=stage3
288
289 ifeq "$(GhcWithNativeCodeGen)" "YES"
290 compiler_stage1_CONFIGURE_OPTS += --flags=ncg
291 compiler_stage2_CONFIGURE_OPTS += --flags=ncg
292 endif
293
294 ifeq "$(GhcWithInterpreter)" "YES"
295 compiler_stage2_CONFIGURE_OPTS += --flags=ghci
296
297 ifeq "$(BuildSharedLibs)" "YES"
298 compiler_stage2_CONFIGURE_OPTS += --enable-shared
299 # If we are going to use dynamic libraries instead of .o files for ghci,
300 # we will need to always retain CAFs in the compiler.
301 # ghci/keepCAFsForGHCi contains a GNU C __attribute__((constructor))
302 # function which sets the keepCAFs flag for the RTS before any Haskell
303 # code is run.
304 compiler_stage2_CONFIGURE_OPTS += --flags=dynlibs
305 endif
306
307 ifeq "$(GhcEnableTablesNextToCode) $(GhcUnregisterised)" "YES NO"
308 # Should GHCI be building info tables in the TABLES_NEXT_TO_CODE style
309 # or not?
310 # XXX This should logically be a CPP option, but there doesn't seem to
311 # be a flag for that
312 compiler_stage2_CONFIGURE_OPTS += --ghc-option=-DGHCI_TABLES_NEXT_TO_CODE
313 endif
314
315 # Should the debugger commands be enabled?
316 ifeq "$(GhciWithDebugger)" "YES"
317 compiler_stage2_CONFIGURE_OPTS += --ghc-option=-DDEBUGGER
318 endif
319
320 endif
321
322 ifeq "$(GhcWithNativeCodeGen)" "NO"
323 # XXX This should logically be a CPP option, but there doesn't seem to
324 # be a flag for that
325 compiler_CONFIGURE_OPTS += --ghc-option=-DOMIT_NATIVE_CODEGEN
326 endif
327
328 ifeq "$(TargetOS_CPP)" "openbsd"
329 compiler_CONFIGURE_OPTS += --ld-options=-E
330 endif
331
332 ifeq "$(GhcUnregisterised)" "NO"
333 ifeq "$(HOSTPLATFORM)" "ia64-unknown-linux"
334 # needed for generating proper relocation in large binaries: trac #856
335 compiler_CONFIGURE_OPTS += --ld-option=-Wl,--relax
336 endif
337 endif
338
339 # We need to turn on profiling either if we have been asked to
340 # (GhcLibProfiled = YES) or if we want GHC itself to be compiled with
341 # profiling enabled (GhcProfiled = YES).
342 ifneq "$(GhcLibProfiled) $(GhcProfiled)" "NO NO"
343 compiler_stage2_CONFIGURE_OPTS += --enable-library-profiling
344 # And if we're profiling GHC then we want lots of SCCs.
345 # We also don't want to waste time building the non-profiling library,
346 # either normally or for ghci. Unfortunately this means that we have to
347 # tell ghc-pkg --force as it gets upset when libHSghc-6.9.a doesn't
348 # exist.
349 ifeq "$(GhcProfiled)" "YES"
350 compiler_stage2_CONFIGURE_OPTS += --ghc-option=-auto-all
351 compiler_stage2_CONFIGURE_OPTS += --disable-library-vanilla
352 compiler_stage2_CONFIGURE_OPTS += --disable-library-for-ghci
353 compiler_stage2_CONFIGURE_OPTS += --ghc-pkg-option=--force
354 endif
355 endif
356
357 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
358 # The #include is vital for the via-C route with older compilers, else the C
359 # compiler doesn't realise that the stcall foreign imports are indeed
360 # stdcall, and doesn't generate the Foo@8 name for them
361 # As it's only important for older compilers we don't need to do anything
362 # for stage2+.
363 compiler_stage1_CONFIGURE_OPTS += --ghc-option='-\#include'    \
364                           --ghc-option='"<windows.h>"' \
365                           --ghc-option='-\#include'    \
366                           --ghc-option='"<process.h>"'
367 endif
368
369 # ghc_strlen percolates through so many modules that it is easier to get its
370 # prototype via a global option instead of a myriad of per-file OPTIONS.
371 # Again, this is only important for older compilers, so we don't do it in
372 # stage 2+.
373 compiler_stage1_CONFIGURE_OPTS += --ghc-options='-\#include "cutils.h"'
374
375 compiler_stage3_CONFIGURE_OPTS := $(compiler_stage2_CONFIGURE_OPTS)
376
377 compiler_stage1_CONFIGURE_OPTS += --ghc-option=-DSTAGE=1
378 compiler_stage2_CONFIGURE_OPTS += --ghc-option=-DSTAGE=2
379 compiler_stage3_CONFIGURE_OPTS += --ghc-option=-DSTAGE=3
380 compiler_stage2_HADDOCK_OPTS += --haddock-option=--optghc=-DSTAGE=2
381
382 compiler_stage1_CONFIGURE_OPTS += --ghc-options='$(GhcStage1HcOpts)'
383 compiler_stage2_CONFIGURE_OPTS += --ghc-options='$(GhcStage2HcOpts)'
384 compiler_stage3_CONFIGURE_OPTS += --ghc-options='$(GhcStage3HcOpts)'
385
386 compiler/stage1/package-data.mk : compiler/ghc.mk
387 compiler/stage2/package-data.mk : compiler/ghc.mk
388 compiler/stage3/package-data.mk : compiler/ghc.mk
389
390 # -----------------------------------------------------------------------------
391 # And build the package
392
393 compiler_PACKAGE = ghc
394
395 # haddocking only happens for stage2
396 compiler_stage1_DO_HADDOCK = NO
397 compiler_stage3_DO_HADDOCK = NO
398
399 # Don't do splitting for the GHC package, it takes too long and
400 # there's not much benefit.
401 compiler_stage1_SplitObjs = NO
402 compiler_stage2_SplitObjs = NO
403 compiler_stage3_SplitObjs = NO
404
405 # For now, bindists always use stage 2
406 ifneq "$(BINDIST)" "YES"
407 # stage 1 is enabled unless $(stage) is set to something other than 1
408 ifeq "$(filter-out 1,$(stage))" ""
409 $(eval $(call build-package,compiler,stage1,0))
410 endif
411 endif
412
413 # stage 2 is enabled unless $(stage) is set to something other than 2
414 ifeq "$(filter-out 2,$(stage))" ""
415 $(eval $(call build-package,compiler,stage2,1))
416 endif
417
418 ifneq "$(BINDIST)" "YES"
419 # stage 3 has to be requested explicitly with stage=3
420 ifeq "$(stage)" "3"
421 $(eval $(call build-package,compiler,stage3,2))
422 endif
423
424 $(compiler_stage1_depfile) : compiler/stage1/$(PLATFORM_H)
425 $(compiler_stage2_depfile) : compiler/stage2/$(PLATFORM_H)
426 $(compiler_stage3_depfile) : compiler/stage3/$(PLATFORM_H)
427
428 $(compiler_stage1_depfile) : $(includes_H_CONFIG) $(includes_H_PLATFORM) $(includes_GHCCONSTANTS) $(includes_DERIVEDCONSTANTS) $(PRIMOP_BITS)
429 $(compiler_stage2_depfile) : $(includes_H_CONFIG) $(includes_H_PLATFORM) $(includes_GHCCONSTANTS) $(includes_DERIVEDCONSTANTS) $(PRIMOP_BITS)
430 $(compiler_stage3_depfile) : $(includes_H_CONFIG) $(includes_H_PLATFORM) $(includes_GHCCONSTANTS) $(includes_DERIVEDCONSTANTS) $(PRIMOP_BITS)
431 endif
432