1 # -----------------------------------------------------------------------------
2 # Main compiler Makefile
6 # all builds stage1 compiler
8 # boot stage=N generate build dirs and dependencies for stage N.
9 # NB. Must be done before 'make stageN'.
10 # NB. Cannot 'make boot stage=2' until stage1 has
11 # been built (similarly for stage3).
13 # stage1 (or stage=1) builds stage1 compiler
14 # stage2 (or stage=2) builds stage2 compiler
15 # stage3 (or stage=3) builds stage3 compiler
20 # Use GHC for compiling C bits (NB. must be before boilerplate include)
24 # We don't want to compile stage1 in multiple ways
25 ifeq "$(findstring $(stage), 2 3)" ""
29 include $(TOP)/mk/boilerplate.mk
31 ifeq "$(GhcThreaded)$(GhcProfiled)" "YESYES"
32 $(error Cannot make GHC both threaded and profiled)
36 #-----------------------------------------------------------------------------
37 # Counting source code lines
39 USER_SRCS = $(filter-out $(DERIVED_SRCS),$(SRCS))
41 ./count_lines $(USER_SRCS)
43 # -----------------------------------------------------------------------------
46 # The stage1/stage2/stage3 business is quite delicate. Here's how it works:
48 # - the variable $(stage) holds the current stage number. To build a
49 # particular stage, you say 'make stage=N' where N is 1, 2, or 3.
52 # - for stage N, object files and .hi files are placed inside
53 # the directory stageN, in subdirectories as per the sources.
55 # - .hi-boot files are *linked* into the stageN tree, because in GHC 5.05+
56 # the .hi-boot file must reside in the same place as the .hi file.
58 # - we use explicit -o and -ohi options to direct the output from C &
59 # Haskell compilations.
61 # - we generate a different .depend file for each build. They need to be
62 # different, because each stage might include different files: stage1
63 # might not include GHCi, for example. For each stage, a normal .depend
64 # file is generated, and then post-processed to add the correct stageN/
65 # prefix to each object and .hi filename. The resulting .depend file
66 # is named .depend-$(stage). See the end of this Makefile for details.
68 # - normal implicit rules don't work any more, because they're of the form
72 # whereas we really need
76 # so suffix.mk now defines the appropriate suffix rules when
77 # $(odir) is set to a non-empty value. Here we set $(odir) to
78 # stage1, stage2, or stage3.
80 # There are other plausible designs that might work, but each has different
83 # - using -odir and -hidir: GHC <= 4.08 doesn't support -hidir, and
84 # anyway -odir puts all the objects in one directory (strips off the
85 # subdirectory part), which eventually forces us to use VPATH to find
86 # the sources. I have a really bad feeling about VPATH.
88 # - invoke make in the stageN subdirectory. This probably requires VPATH
91 # - create a link tree. The problem with requiring link trees is that
92 # Windows doesn't support symbolic links.
98 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
110 $(MKDIRHIER) stage$(stage)
111 for i in $(ALL_DIRS); do \
112 $(MKDIRHIER) stage$(stage)/$$i; \
115 ifeq "$(stage) $(ghc_ge_603)" "1 YES"
118 ifneq "$(findstring $(stage), 2 3)" ""
126 # On Windows, we can't use symbolic links for the -hi-boot files
127 # because GHC itself is a Mingw program and does not understand
128 # symbolic links. So we have to copy the files instead of link them.
129 # That means that if you modify a .hi-boot file in Windows, you
130 # have to to say 'make boot' again.
132 # PS: 'ln -s foo baz' takes 'foo' relative to the path to 'baz'
133 # whereas 'cp foo baz' treats the two paths independently.
134 # Hence the "../.." in the ln command line
135 ifeq "$(UsingHsBoot)" "NO"
136 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
137 for i in */*hi-boot*; do \
138 cp -u -f $$i stage$(stage)/$$i; \
141 for i in */*hi-boot*; do \
142 ($(RM) -f stage$(stage)/$$i \
143 && $(LN_S) ../../$$i stage$(stage)/$$i) || true ; \
171 SRC_HC_OPTS += $(patsubst %, -i$(odir)/%, $(ALL_DIRS))
173 SRC_HC_OPTS += -Wall -fno-warn-name-shadowing
174 # Turn off orphan warnings, but only if the flag exists (i.e. not if we
175 # are building stage 1 and using GHC < 6.3).
176 ifneq "$(stage) $(ghc_ge_603)" "1 NO"
177 SRC_HC_OPTS += -fno-warn-orphans
180 HS_OBJS = $(patsubst %, $(odir)/%, $(addsuffix .$(way_)o,$(basename $(HS_SRCS))))
181 C_OBJS = $(patsubst %, $(odir)/%, $(addsuffix .$(way_)o,$(basename $(C_SRCS))))
183 # Our standard cleaning rules don't know that we're doing our output
184 # into $(odir), so we have to augment CLEAN_FILES appropriateliy.
186 CLEAN_FILES += $(odir)/*/*.$(way_)hi $(odir)/*/*.$(way_)hi-boot $(odir)/*/*.$(way_)o-boot
188 ifeq "$(UsingHsBoot)" "YES"
189 CLEAN_FILES += $(odir)/*/*.hi-boot $(odir)/*/*.o-boot
193 mostlyclean clean distclean maintainer-clean ::
198 # -----------------------------------------------------------------------------
201 # Note: there have been reports of people running up against the ARG_MAX limit
202 # when linking ghc with all its constituent object files. The likely source of
203 # the problem is that the environment is a bit too big, so a workaround could
204 # be to do `env PATH=$(PATH) make ghc' to minimise the environment. (or the
205 # equivalent of `env' if it doesn't exist locally).
207 ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
208 GHC_PROG=$(odir)/ghc$(_way)-$(ProjectVersion)
210 GHC_PROG=$(odir)/ghc$(_way)
214 HS_PROG = $(GHC_PROG)
217 # -----------------------------------------------------------------------------
218 # Create compiler configuration
220 # The 'echo' commands simply spit the values of various make variables
221 # into Config.hs, whence they can be compiled and used by GHC itself
223 CONFIG_HS = main/Config.hs
226 $(CONFIG_HS) : $(FPTOOLS_TOP)/mk/config.mk
227 @$(RM) -f $(CONFIG_HS)
228 @echo "Creating $(CONFIG_HS) ... "
229 @echo "{-# OPTIONS -w #-}" >>$(CONFIG_HS)
230 @echo "module Config where" >>$(CONFIG_HS)
231 @echo "cProjectName = \"$(ProjectName)\"" >> $(CONFIG_HS)
232 @echo "cProjectVersion = \"$(ProjectVersion)\"" >> $(CONFIG_HS)
233 @echo "cProjectVersionInt = \"$(ProjectVersionInt)\"" >> $(CONFIG_HS)
234 @echo "cProjectPatchLevel = \"$(ProjectPatchLevel)\"" >> $(CONFIG_HS)
235 @echo "cBooterVersion = \"$(GhcVersion)\"" >> $(CONFIG_HS)
236 @echo "cStage = STAGE" >> $(CONFIG_HS)
237 @echo "cHscIfaceFileVersion = \"$(HscIfaceFileVersion)\"" >> $(CONFIG_HS)
238 @echo "cSplitObjs = \"$(SplitObjs)\"" >> $(CONFIG_HS)
239 @echo "cGhcWithInterpreter = \"$(GhcWithInterpreter)\"" >> $(CONFIG_HS)
240 @echo "cGhcWithNativeCodeGen = \"$(GhcWithNativeCodeGen)\"" >> $(CONFIG_HS)
241 @echo "cGhcWithSMP = \"$(GhcWithSMP)\"" >> $(CONFIG_HS)
242 @echo "cGhcRTSWays = \"$(GhcRTSWays)\"" >> $(CONFIG_HS)
243 @echo "cGhcUnregisterised = \"$(GhcUnregisterised)\"" >> $(CONFIG_HS)
244 @echo "cGhcEnableTablesNextToCode = \"$(GhcEnableTablesNextToCode)\"" >> $(CONFIG_HS)
245 @echo "cLeadingUnderscore = \"$(LeadingUnderscore)\"" >> $(CONFIG_HS)
246 @echo "cRAWCPP_FLAGS = \"$(RAWCPP_FLAGS)\"" >> $(CONFIG_HS)
247 @echo "cGCC = \"$(WhatGccIsCalled)\"" >> $(CONFIG_HS)
248 @echo "cMKDLL = \"$(BLD_DLL)\"" >> $(CONFIG_HS)
249 @echo "cLdIsGNULd = \"$(LdIsGNULd)\"" >> $(CONFIG_HS)
250 @echo "cLD_X = \"$(LD_X)\"" >> $(CONFIG_HS)
251 @echo "cPROJECT_DIR = \"$(PROJECT_DIR)\"" >> $(CONFIG_HS)
252 @echo "cGHC_DRIVER_DIR_REL = \"$(GHC_DRIVER_DIR_REL)\"" >> $(CONFIG_HS)
253 @echo "cGHC_TOUCHY_PGM = \"$(GHC_TOUCHY_PGM)\"" >> $(CONFIG_HS)
254 @echo "cGHC_TOUCHY_DIR_REL = \"$(GHC_TOUCHY_DIR_REL)\"" >> $(CONFIG_HS)
255 @echo "cGHC_UNLIT_PGM = \"$(GHC_UNLIT_PGM)\"" >> $(CONFIG_HS)
256 @echo "cGHC_UNLIT_DIR_REL = \"$(GHC_UNLIT_DIR_REL)\"" >> $(CONFIG_HS)
257 @echo "cGHC_MANGLER_PGM = \"$(GHC_MANGLER_PGM)\"" >> $(CONFIG_HS)
258 @echo "cGHC_MANGLER_DIR_REL = \"$(GHC_MANGLER_DIR_REL)\"" >> $(CONFIG_HS)
259 @echo "cGHC_SPLIT_PGM = \"$(GHC_SPLIT_PGM)\"" >> $(CONFIG_HS)
260 @echo "cGHC_SPLIT_DIR_REL = \"$(GHC_SPLIT_DIR_REL)\"" >> $(CONFIG_HS)
261 @echo "cGHC_SYSMAN_PGM = \"$(GHC_SYSMAN)\"" >> $(CONFIG_HS)
262 @echo "cGHC_SYSMAN_DIR_REL = \"$(GHC_SYSMAN_DIR)\"" >> $(CONFIG_HS)
263 @echo "cGHC_CP = \"$(GHC_CP)\"" >> $(CONFIG_HS)
264 @echo "cGHC_PERL = \"$(GHC_PERL)\"" >> $(CONFIG_HS)
265 ifeq ($(GhcWithIlx),YES)
266 @echo "cILX2IL = \"$(ILX2IL)\"" >> $(CONFIG_HS)
267 @echo "cILASM = \"$(ILASM)\"" >> $(CONFIG_HS)
269 @echo "cEnableWin32DLLs = \"$(EnableWin32DLLs)\"" >> $(CONFIG_HS)
270 @echo "cCONTEXT_DIFF = \"$(CONTEXT_DIFF)\"" >> $(CONFIG_HS)
271 @echo "cUSER_WAY_NAMES = \"$(USER_WAY_NAMES)\"" >> $(CONFIG_HS)
272 @echo "cUSER_WAY_OPTS = \"$(USER_WAY_OPTS)\"" >> $(CONFIG_HS)
273 @echo "cDEFAULT_TMPDIR = \"$(DEFAULT_TMPDIR)\"" >> $(CONFIG_HS)
274 @echo "cDocDir = \"$(docdir)\"" >> $(CONFIG_HS)
275 ifeq "$(RelocatableBuild)" "YES"
276 @echo "cRelocatableBuild = True" >> $(CONFIG_HS)
278 @echo "cRelocatableBuild = False" >> $(CONFIG_HS)
282 CLEAN_FILES += $(CONFIG_HS)
284 # -----------------------------------------------------------------------------
285 # Create platform includes
287 # Here we generate a little header file containing CPP symbols that GHC
288 # uses to determine which platform it is building on/for. The platforms
289 # can differ between stage1 and stage2 if we're cross-compiling, so we
290 # need one of these header files per stage.
292 PLATFORM_H = ghc_boot_platform.h
294 stage1/$(PLATFORM_H) : stage_dirs $(FPTOOLS_TOP)/mk/config.mk
295 @echo "Creating $@..."
297 @echo "#ifndef __PLATFORM_H__" >$@
298 @echo "#define __PLATFORM_H__" >>$@
300 @echo "#define BuildPlatform_NAME \"$(BUILDPLATFORM)\"" >> $@
301 @echo "#define HostPlatform_NAME \"$(HOSTPLATFORM)\"" >> $@
302 @echo "#define TargetPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
304 @echo "#define $(BuildPlatform_CPP)_BUILD 1" >> $@
305 @echo "#define $(HostPlatform_CPP)_HOST 1" >> $@
306 @echo "#define $(TargetPlatform_CPP)_TARGET 1" >> $@
308 @echo "#define $(BuildArch_CPP)_BUILD_ARCH 1" >> $@
309 @echo "#define $(HostArch_CPP)_HOST_ARCH 1" >> $@
310 @echo "#define $(TargetArch_CPP)_TARGET_ARCH 1" >> $@
311 @echo "#define BUILD_ARCH \"$(BuildArch_CPP)\"" >> $@
312 @echo "#define HOST_ARCH \"$(HostArch_CPP)\"" >> $@
313 @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
315 @echo "#define $(BuildOS_CPP)_BUILD_OS 1" >> $@
316 @echo "#define $(HostOS_CPP)_HOST_OS 1" >> $@
317 @echo "#define $(TargetOS_CPP)_TARGET_OS 1" >> $@
318 @echo "#define BUILD_OS \"$(BuildOS_CPP)\"" >> $@
319 @echo "#define HOST_OS \"$(HostOS_CPP)\"" >> $@
320 @echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@
321 ifeq "$(HostOS_CPP)" "irix"
322 @echo "#ifndef $(IRIX_MAJOR)_TARGET_OS " >> $@
323 @echo "#define $(IRIX_MAJOR)_TARGET_OS 1" >> $@
324 @echo "#endif " >> $@
327 @echo "#define $(BuildVendor_CPP)_BUILD_VENDOR 1" >> $@
328 @echo "#define $(HostVendor_CPP)_HOST_VENDOR 1" >> $@
329 @echo "#define $(TargetVendor_CPP)_TARGET_VENDOR 1" >> $@
330 @echo "#define BUILD_VENDOR \"$(BuildVendor_CPP)\"" >> $@
331 @echo "#define HOST_VENDOR \"$(HostVendor_CPP)\"" >> $@
332 @echo "#define TARGET_VENDOR \"$(TargetVendor_CPP)\"" >> $@
334 @echo "#endif /* __PLATFORM_H__ */" >> $@
337 # For stage2 and above, the BUILD platform is the HOST of stage1, and
338 # the HOST platform is the TARGET of stage1. The TARGET remains the same
339 # (stage1 is the cross-compiler, not stage2).
340 stage2/$(PLATFORM_H) : stage_dirs $(FPTOOLS_TOP)/mk/config.mk
341 @echo "Creating $@..."
343 @echo "#ifndef __PLATFORM_H__" >$@
344 @echo "#define __PLATFORM_H__" >>$@
346 @echo "#define BuildPlatform_NAME \"$(HOSTPLATFORM)\"" >> $@
347 @echo "#define HostPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
348 @echo "#define TargetPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
350 @echo "#define $(HostPlatform_CPP)_BUILD 1" >> $@
351 @echo "#define $(TargetPlatform_CPP)_HOST 1" >> $@
352 @echo "#define $(TargetPlatform_CPP)_TARGET 1" >> $@
354 @echo "#define $(HostArch_CPP)_BUILD_ARCH 1" >> $@
355 @echo "#define $(TargetArch_CPP)_HOST_ARCH 1" >> $@
356 @echo "#define $(TargetArch_CPP)_TARGET_ARCH 1" >> $@
357 @echo "#define BUILD_ARCH \"$(HostArch_CPP)\"" >> $@
358 @echo "#define HOST_ARCH \"$(TargetArch_CPP)\"" >> $@
359 @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
361 @echo "#define $(HostOS_CPP)_BUILD_OS 1" >> $@
362 @echo "#define $(TargetOS_CPP)_HOST_OS 1" >> $@
363 @echo "#define $(TargetOS_CPP)_TARGET_OS 1" >> $@
364 @echo "#define BUILD_OS \"$(HostOS_CPP)\"" >> $@
365 @echo "#define HOST_OS \"$(TargetOS_CPP)\"" >> $@
366 @echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@
367 ifeq "$(HostOS_CPP)" "irix"
368 @echo "#ifndef $(IRIX_MAJOR)_TARGET_OS " >> $@
369 @echo "#define $(IRIX_MAJOR)_TARGET_OS 1" >> $@
370 @echo "#endif " >> $@
373 @echo "#define $(HostVendor_CPP)_BUILD_VENDOR 1" >> $@
374 @echo "#define $(TargetVendor_CPP)_HOST_VENDOR 1" >> $@
375 @echo "#define $(TargetVendor_CPP)_TARGET_VENDOR 1" >> $@
376 @echo "#define BUILD_VENDOR \"$(HostVendor_CPP)\"" >> $@
377 @echo "#define HOST_VENDOR \"$(TargetVendor_CPP)\"" >> $@
378 @echo "#define TARGET_VENDOR \"$(TargetVendor_CPP)\"" >> $@
380 @echo "#endif /* __PLATFORM_H__ */" >> $@
383 stage3/$(PLATFORM_H) : stage_dirs stage2/$(PLATFORM_H)
384 $(CP) stage2/$(PLATFORM_H) stage3/$(PLATFORM_H)
386 STAGE_PLATFORM_H = stage$(stage)/$(PLATFORM_H)
388 boot :: $(STAGE_PLATFORM_H)
390 SRC_HC_OPTS += -Istage$(stage)
392 # -----------------------------------------------------------------------------
395 # First figure out ALL_DIRS, the source sub-directories
398 utils basicTypes types hsSyn prelude rename typecheck deSugar coreSyn \
399 vectorise specialise simplCore stranal stgSyn simplStg codeGen main \
400 profiling parser cprAnalysis ndpFlatten iface cmm
402 # Make sure we include Config.hs even if it doesn't exist yet...
403 ALL_SRCS += $(CONFIG_HS)
405 # HsGeneric.hs is not used just now
406 EXCLUDED_SRCS += hsSyn/HsGeneric.hs
408 ifeq ($(GhcWithNativeCodeGen),YES)
409 ALL_DIRS += nativeGen
411 SRC_HC_OPTS += -DOMIT_NATIVE_CODEGEN
414 ifeq ($(GhcWithIlx),YES)
419 ifeq ($(GhcWithJavaGen),YES)
421 SRC_HC_OPTS += -DJAVA
424 ifeq "$(BootingFromHc)" "YES"
425 # HC files are always from a self-booted compiler
428 ifneq "$(findstring $(stage), 2 3)" ""
435 # -----------------------------------------------------------------------------
436 # Building a compiler with interpreter support
438 # The interpreter, GHCi interface, Template Haskell and Hpc are only
439 # enabled when we are bootstrapping with the same version of GHC, and
440 # the interpreter is supported on this platform.
442 ifeq "$(bootstrapped)" "YES"
443 SRC_HC_OPTS += -package hpc -package bytestring
444 PKG_DEPENDS += hpc bytestring
447 ifeq "$(GhcWithInterpreter) $(bootstrapped)" "YES YES"
449 # Yes, include the interepreter and Template Haskell extensions
450 SRC_HC_OPTS += -DGHCI -package template-haskell
451 PKG_DEPENDS += template-haskell
453 # Should GHCI be building info tables in the TABLES_NEXT_TO_CODE style
455 ifeq "$(GhcEnableTablesNextToCode) $(GhcUnregisterised)" "YES NO"
456 SRC_HC_OPTS += -DGHCI_TABLES_NEXT_TO_CODE
459 ifeq "$(GhcThreaded)" "YES"
460 # Use threaded RTS with GHCi, so threads don't get blocked at the prompt.
461 SRC_LD_OPTS += -threaded
463 ifeq "$(GhcProfiled)" "YES"
466 ifeq "$(GhcDebugged)" "YES"
467 SRC_LD_OPTS += -debug
472 # If we are going to use dynamic libraries instead of .o files for ghci,
473 # we will need to always retain CAFs in the compiler.
474 # ghci/keepCAFsForGHCi contains a GNU C __attribute__((constructor))
475 # function which sets the keepCAFs flag for the RTS before any Haskell
477 ifeq "$(GhcBuildDylibs)" "YES"
479 EXCLUDED_SRCS += ghci/keepCAFsForGHCi.c
482 # Enable readline if either:
483 # - we're building stage 1 and $(GhcHasReadline)="YES"
484 # - we're building stage 2/3, and we have built the readline package
486 # But we don't enable readline on Windows, because readline is fairly
489 ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
491 ifeq "$(GhcHasReadline)" "YES"
492 SRC_HC_OPTS += -package readline -DUSE_READLINE
493 PKG_DEPENDS += readline
496 ifeq "$(wildcard $(FPTOOLS_TOP_ABS)/libraries/readline/unbuildable)" ""
497 SRC_HC_OPTS += -package readline -DUSE_READLINE
498 PKG_DEPENDS += readline
505 # No interpreter, so exclude Template Haskell modules
506 EXCLUDED_SRCS += deSugar/DsMeta.hs typecheck/TcSplice.lhs hsSyn/Convert.lhs
508 endif # bootstrapped with interpreter
510 # -----------------------------------------------
513 # Big Fudge to get around inherent problem that Makefile setup
514 # has got with 'mkdependC'.
516 SRC_MKDEPENDC_OPTS += -D__GLASGOW_HASKELL__=$(ProjectVersionInt)
518 # XXX not really correct, hschooks.c actually gets include files like
519 # RtsFlags.c from the installed GHC, but we can't tell mkdependC about that.
520 SRC_MKDEPENDC_OPTS += -I$(GHC_INCLUDE_DIR)
522 # -----------------------------------------------------------------------------
523 # Haskell compilations
526 -cpp -fglasgow-exts -fno-generics -Rghc-timing \
529 # Omitted: -I$(GHC_INCLUDE_DIR)
530 # We should have -I$(GHC_INCLUDE_DIR) in SRC_HC_OPTS,
531 # to avoid the use of an explicit path in GHC source files
532 # (include "../includes/config.h"
533 # But alas GHC 4.08 (and others for all I know) uses this very
534 # same include path when compiling the .hc files it generates.
535 # Disaster! Then the hc file sees the GHC 5.02 (or whatever)
536 # include files. For the moment we've reverted to using
537 # an explicit path in the .hs sources
539 # For the benefit of <5.00 compilers, do include GHC_INCLUDE_DIR
540 # when generating dependencies. (=> it gets passed onto mkdependHS,
542 SRC_MKDEPENDHS_OPTS += -I$(GHC_INCLUDE_DIR)
544 # We need System.Posix (or Posix when ghc < 6.2)
545 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
546 ifeq "$(bootstrapped)" "YES"
547 SRC_HC_OPTS += -package Win32
551 ifeq "$(bootstrapped) $(ghc_ge_601)" "NO NO"
552 SRC_HC_OPTS += -package posix
554 SRC_HC_OPTS += -package unix
559 # We use the Cabal package in stages 2/3 only; in stage 1 we're using
560 # the libcompat library which provides the Cabal modules.
562 SRC_HC_OPTS += -package Cabal
566 ifeq "$(ghc_ge_603)" "YES"
567 # Ignore lang, to avoid potential clash with the Generics module if
568 # lang happens to be a dependency of some exposed package in the local
569 # GHC installation (eg. wxHaskell did this around 6.4).
570 SRC_HC_OPTS += -ignore-package lang
573 SRC_CC_OPTS += -Iparser -I. -O
574 SRC_HC_OPTS += -recomp $(GhcHcOpts) $(GhcStage$(stage)HcOpts)
577 ifeq "$(BootingFromHc)" "YES"
578 SRC_CC_OPTS += -D__GLASGOW_HASKELL__=$(ProjectVersionInt)
581 # Special flags for particular modules
582 # The standard suffix rule for compiling a Haskell file
583 # adds these flags to the command line
585 # There used to be a -no-recomp flag on PrimOp, but why?
586 # It's an expensive module to recompile!
587 prelude/PrimOp_HC_OPTS = -H80m
590 main/ParsePkgConf_HC_OPTS += -fno-warn-incomplete-patterns
591 parser/Parser_HC_OPTS += -fno-warn-incomplete-patterns
593 ifeq "$(ghc_ge_603)" "NO"
594 # Use -fvia-C since the NCG can't handle the narrow16Int# (and intToInt16#?)
595 # primops on all platforms.
596 parser/Parser_HC_OPTS += -fvia-C
597 # because the NCG can't handle the 64-bit math in here
598 prelude/PrelRules_HC_OPTS += -fvia-C
599 # ByteCodeItbls uses primops that the NCG doesn't support.
600 ghci/ByteCodeItbls_HC_OPTS += -fvia-C
601 ghci/ByteCodeLink_HC_OPTS += -fvia-C -monly-3-regs
604 # Careful optimisation of the parser: we don't want to throw everything
605 # at it, because that takes too long and doesn't buy much, but we do want
606 # to inline certain key external functions, so we instruct GHC not to
607 # throw away inlinings as it would normally do in -Onot mode:
608 parser/Parser_HC_OPTS += -Onot -fno-ignore-interface-pragmas
610 ifeq "$(HOSTPLATFORM)" "hppa1.1-hp-hpux9"
611 rename/RnMonad_HC_OPTS = -O2 -O2-for-C
614 utils/Digraph_HC_OPTS = -fglasgow-exts
616 basicTypes/SrcLoc_HC_OPTS = -funbox-strict-fields
618 # We always optimise some low-level modules, otherwise performance of
619 # a non-optimised compiler is severely affected.
620 main/BinIface_HC_OPTS += -O
621 utils/Binary_HC_OPTS += -O -funbox-strict-fields
622 utils/FastMutInt_HC_OPTS += -O
623 utils/Encoding_HC_OPTS += -O
624 utils/StringBuffer_HC_OPTS += -O -funbox-strict-fields
625 utils/FastString_HC_OPTS += -O -funbox-strict-fields
627 # ---- Profiling ----
628 #simplCore/Simplify_HC_OPTS = -auto-all
629 #simplCore/SimplEnv_HC_OPTS = -auto-all
630 #simplCore/SimplUtils_HC_OPTS = -auto-all
632 # CSE interacts badly with top-level IORefs (reportedly in DriverState and
633 # DriverMkDepend), causing some of them to be commoned up. We have a fix for
634 # this in 5.00+, but earlier versions of the compiler will need CSE turned off.
635 # To be on the safe side, we disable CSE in *all* modules with top-level IORefs.
636 ghci/InteractiveUI_HC_OPTS = -fno-cse
637 main/CmdLineOpts_HC_OPTS = -fno-cse
638 main/DriverMkDepend_HC_OPTS = -fno-cse
639 main/DriverPipeline_HC_OPTS = -fno-cse
640 main/Finder_HC_OPTS = -fno-cse
641 main/SysTools_HC_OPTS = -fno-cse
642 main/StaticFlags_HC_OPTS = -fno-cse
644 # The #include is vital for the via-C route, else the C
645 # compiler doesn't realise that the stcall foreign imports are indeed
646 # stdcall, and doesn't generate the Foo@8 name for them
647 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
648 main/SysTools_HC_OPTS += '-\#include <windows.h>' '-\#include <process.h>'
651 parser/Lexer_HC_OPTS += -funbox-strict-fields
653 # ghc_strlen percolates through so many modules that it is easier to get its
654 # prototype via a global option instead of a myriad of per-file OPTIONS
655 SRC_HC_OPTS += '-\#include "cutils.h"'
657 # ----------------------------------------------------------------------------
658 # Generate supporting stuff for prelude/PrimOp.lhs
659 # from prelude/primops.txt
661 PRIMOP_BITS=primop-data-decl.hs-incl \
663 primop-list.hs-incl \
664 primop-has-side-effects.hs-incl \
665 primop-out-of-line.hs-incl \
666 primop-commutable.hs-incl \
667 primop-needs-wrapper.hs-incl \
668 primop-can-fail.hs-incl \
669 primop-strictness.hs-incl \
670 primop-primop-info.hs-incl
672 CLEAN_FILES += prelude/primops.txt
673 CLEAN_FILES += $(PRIMOP_BITS)
675 SRC_CPP_OPTS += -I$(GHC_INCLUDE_DIR)
676 SRC_CPP_OPTS += ${GhcCppOpts}
678 ifneq "$(BootingFromHc)" "YES"
679 prelude/PrimOp.lhs $(odir)/prelude/PrimOp.o: $(PRIMOP_BITS)
682 ifneq "$(BootingFromHc)" "YES"
683 depend :: $(PRIMOP_BITS)
686 # This is an ugly hack: we need stage1/$(PLATFORM_H) built before we
687 # preprocess primops.txt.pp, but we don't want to just add that
688 # dependency because we don't want $(PLATFORM_H) built during normal
689 # operations, because we don't have have dependencies from the .hs
690 # sources on it, and we don't want those dependencies because that
691 # would cause everything to be rebuilt every time the Makefile
692 # changed. So here we add the required dependency only when making
694 ifneq "$(findstring boot, $(MAKECMDGOALS))$(findstring depend, $(MAKECMDGOALS))" ""
695 prelude/primops.txt.pp : stage1/$(PLATFORM_H)
698 primop-data-decl.hs-incl: prelude/primops.txt
699 $(GENPRIMOP) --data-decl < $< > $@
700 primop-tag.hs-incl: prelude/primops.txt
701 $(GENPRIMOP) --primop-tag < $< > $@
702 primop-list.hs-incl: prelude/primops.txt
703 $(GENPRIMOP) --primop-list < $< > $@
704 primop-has-side-effects.hs-incl: prelude/primops.txt
705 $(GENPRIMOP) --has-side-effects < $< > $@
706 primop-out-of-line.hs-incl: prelude/primops.txt
707 $(GENPRIMOP) --out-of-line < $< > $@
708 primop-commutable.hs-incl: prelude/primops.txt
709 $(GENPRIMOP) --commutable < $< > $@
710 primop-needs-wrapper.hs-incl: prelude/primops.txt
711 $(GENPRIMOP) --needs-wrapper < $< > $@
712 primop-can-fail.hs-incl: prelude/primops.txt
713 $(GENPRIMOP) --can-fail < $< > $@
714 primop-strictness.hs-incl: prelude/primops.txt
715 $(GENPRIMOP) --strictness < $< > $@
716 primop-primop-info.hs-incl: prelude/primops.txt
717 $(GENPRIMOP) --primop-primop-info < $< > $@
719 # Usages aren't used any more; but the generator
720 # can still generate them if we want them back
721 primop-usage.hs-incl: prelude/primops.txt
722 $(GENPRIMOP) --usage < $< > $@
725 #-----------------------------------------------------------------------------
728 # Include libghccompat in stage1 only. In stage2 onwards, all these
729 # libraries will be available from the main libraries.
732 include $(GHC_COMPAT_DIR)/compat.mk
735 SRC_LD_OPTS += -no-link-chk
737 # -----------------------------------------------------------------------------
738 # create ghc-inplace, a convenient way to run ghc from the build tree...
739 # See comments in $(FPTOOLS_TOP)/utils/ghc-pkg/Makefile for why we use
740 # a real binary here rather than a shell script.
742 INPLACE_SRC = $(odir)/ghc-inplace.c
743 INPLACE_PROG = $(odir)/ghc-inplace$(_way)$(exeext)
744 EXCLUDED_C_SRCS += ghc-inplace.c
746 CLEAN_FILES += $(INPLACE_SRC)
748 GHC_PATH=$(FPTOOLS_TOP_ABS)/$(GHC_COMPILER_DIR_REL)/$(GHC_PROG)$(exeext)
750 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
751 INPLACE_EXTRA_FLAGS = -optc-DWINDOWS
754 $(INPLACE_PROG): ghc-inplace.c
755 $(SED) -e "s@GHC_PATH@$(GHC_PATH)@g" -e "s@TOP_ABS@$(FPTOOLS_TOP_ABS)@g" < $< > $(INPLACE_SRC)
756 $(HC) -cpp $(INPLACE_EXTRA_FLAGS) $(INPLACE_SRC) -o $@
758 all :: $(INPLACE_PROG)
760 CLEAN_FILES += $(INPLACE_PROG)
763 ghc-inplace : $(INPLACE_PROG)
764 $(RM) -f $@ && $(LN_S) $< $@
768 CLEAN_FILES += ghc-inplace
771 #-----------------------------------------------------------------------------
774 # We don't want ghc treated as an ordinary executable,
775 # but put it together with the libraries.
776 # Also don't want any interface files installed
778 DESTDIR = $(INSTALL_LIBRARY_DIR_GHC)
780 ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
781 INSTALL_LIBEXECS += $(GHC_PROG)
783 INSTALL_PROGS += $(GHC_PROG)
786 # ----------------------------------------------------------------------------
789 # rename/RnBinds_HC_OPTS += -auto-all
790 # rename/RnEnv_HC_OPTS += -auto-all
791 # rename/RnExpr_HC_OPTS += -auto-all
792 # rename/RnHiFiles_HC_OPTS += -auto-all
793 # rename/RnHsSyn_HC_OPTS += -auto-all
794 # rename/Rename_HC_OPTS += -auto-all
795 # rename/RnIfaces_HC_OPTS += -auto-all
796 # rename/RnNames_HC_OPTS += -auto-all
797 # rename/RnSource_HC_OPTS += -auto-all
798 # rename/RnTypes_HC_OPTS += -auto-all
800 # typecheck/Inst_HC_OPTS += -auto-all
801 # typecheck/TcBinds_HC_OPTS += -auto-all
802 # typecheck/TcClassDcl_HC_OPTS += -auto-all
803 # typecheck/TcDefaults_HC_OPTS += -auto-all
804 # typecheck/TcDeriv_HC_OPTS += -auto-all
805 # typecheck/TcEnv_HC_OPTS += -auto-all
806 # typecheck/TcExpr_HC_OPTS += -auto-all
807 # typecheck/TcForeign_HC_OPTS += -auto-all
808 # typecheck/TcGenDeriv_HC_OPTS += -auto-all
809 # typecheck/TcHsSyn_HC_OPTS += -auto-all
810 # typecheck/TcIfaceSig_HC_OPTS += -auto-all
811 # typecheck/TcInstDcls_HC_OPTS += -auto-all
812 # typecheck/TcMatches_HC_OPTS += -auto-all
813 # typecheck/TcMonoType_HC_OPTS += -auto-all
814 # typecheck/TcMType_HC_OPTS += -auto-all
815 # typecheck/TcPat_HC_OPTS += -auto-all
816 # typecheck/TcRnDriver_HC_OPTS += -auto-all
817 # #typecheck/TcRnMonad_HC_OPTS += -auto-all
818 # #typecheck/TcRnTypes_HC_OPTS += -auto-all
819 # typecheck/TcRules_HC_OPTS += -auto-all
820 # typecheck/TcSimplify_HC_OPTS += -auto-all
821 # typecheck/TcSplice_HC_OPTS += -auto-all
822 # typecheck/TcTyClsDecls_HC_OPTS += -auto-all
823 # typecheck/TcTyDecls_HC_OPTS += -auto-all
824 # typecheck/TcType_HC_OPTS += -auto-all
825 # typecheck/TcUnify_HC_OPTS += -auto-all
827 # coreSyn/CorePrep_HC_OPTS += -auto-all
828 # parser/Parser_HC_OPTS += -fasm
830 #-----------------------------------------------------------------------------
831 # Building the GHC package
833 # The GHC package is made from the stage 2 build and later.
834 # Fortunately the package build system framework more or less does the
835 # right thing for us here.
837 ifneq "$(findstring $(stage), 2 3)" ""
838 BUILD_GHC_PACKAGE=YES
841 ifeq "$(BUILD_GHC_PACKAGE)" "YES"
843 HIERARCHICAL_LIB = NO
844 VERSION = $(ProjectVersion)
845 PKG_DEPENDS += base haskell98
846 PACKAGE_CPP_OPTS += -DPKG_DEPENDS='$(PKG_DEPENDS)'
847 PACKAGE_CPP_OPTS += -DSTAGE='"$(stage)"'
849 # Omit Main from the library, the client will want to plug their own Main in
850 LIBOBJS = $(filter-out $(odir)/main/Main.$(way_)o $(odir)/parser/hschooks.$(way_)o, $(OBJS))
852 # disable splitting: it won't really help with GHC, and the specialised
853 # build system for compiler/ isn't set up to handle it.
856 # the package build system likes to set WAYS=$(GhcLibWays), but we don't
857 # really want to build the whole of GHC multiple ways... if you do,
858 # set GhcCompilerWays instead.
859 GhcLibWays = $(GhcCompilerWays)
861 # override $(GhcLibHcOpts): we want GhcStage2HcOpts to take precedence
864 ifeq "$(DOING_BIN_DIST)" "YES"
865 # This is derived from the sources when we are in a source tree, but we
866 # don't have any sources in a bindist, so we have to shortcut it
867 HS_IFACES := $(wildcard stage$(stage)/*/*.hi)
869 # override default definition of HS_IFACES so we can add $(odir)
870 HS_IFACES = $(addsuffix .$(way_)hi,$(basename $(HS_OBJS)))
873 # Haddock can't handle recursive modules currently, so we disable it for now.
874 override HADDOCK_DOCS = NO
876 # Tell package.mk not to set $(HC)
879 # The stage 2 GHC binary itself is built by compiling main/Main.hs
880 # (the same as used in stage 1) against the GHC package.
882 # This is done by compiling Main.hs separately and linking it with
883 # -package ghc. This is done using a separate Makefile, Makefile.ghcbin
884 # Why? See comments in Makefile.ghcbin
886 # The stage 2 and stage 3 package.conf.in files are different, because they
887 # point to either the stage2/ or stage3/ dirs in import-dirs. Hence before
888 # linking the ghc binary we must install the correct version of the package
889 # configuration. Yeuch... maybe one day this will all be done more cleanly.
890 STAMP_PKG_CONF = $(GHC_DRIVER_DIR)/stamp-pkg-conf-$(PACKAGE)
892 # Propagate standard targets to Makefile.ghcbin
893 docs runtests $(BOOT_TARGET) TAGS clean distclean mostlyclean maintainer-clean $(INSTALL_TARGET) $(INSTALL_DOCS_TARGET) html chm HxS ps dvi txt::
894 $(MAKE) -f Makefile.ghcbin $(MFLAGS) $@
897 #-----------------------------------------------------------------------------
900 MAINTAINER_CLEAN_FILES += parser/Parser.info main/ParsePkgConf.info
902 #-----------------------------------------------------------------------------
903 # Include target-rule boilerplate
905 # Don't use the default MKDEPENDHS stuff... we'll do our own, below
909 # Make doesn't work this out for itself, it seems
910 parser/Parser.y : parser/Parser.y.pp
911 EXTRA_SRCS += parser/Parser.y
914 #-----------------------------------------------------------------------------
915 # Source files for tags file generation
917 # We want to excluded derived sources, because they won't be in the source
918 # tree, which is where we are going to move the TAGS file to.a
920 TAGS_HS_SRCS = parser/Parser.y.pp $(filter-out $(DERIVED_SRCS) main/Config.hs parser/Parser.y, $(sort $(SRCS)))
922 WRONG_GHCTAGS_HS_SRCS = $(filter-out $(DERIVED_SRCS) main/Config.hs parser/Parser.y, $(sort $(SRCS)))
923 # above is wrong because of the following problem:
924 # module `main:DataCon' is defined in multiple files: basicTypes/DataCon.lhs
925 # basicTypes/DataCon.lhs-boot
927 GHCTAGS_HS_SRCS = $(HS_SRCS)
928 GHCTAGS_HC_OPTS = $(patsubst -i$(odir)/%, -i%, $(HC_OPTS))
929 GHCTAGS_HC_OPTS += -DSTAGE='"$(stage)"'
931 #------------------------------------------------------------
936 ghctags :: $(GHCTAGS_HS_SRCS) $(TAGS_C_SRCS)
937 @if [ "$(stage)" != 2 ]; then echo "Must use 'make stage=2 ghctags'"; exit 1; fi
940 @echo SOURCES ARE "$(GHCTAGS_HS_SRCS)"
941 : ifneq "$(GHCTAGS_HS_SRCS)" ""
942 @echo TIME TO ROCK AND ROLL
943 # $(GHCTAGS_INPLACE) -- $(MKDEPENDHS_OPTS) $(filter-out -split-objs, $(MKDEPENDHS_HC_OPTS)) -- $(GHCTAGS_HS_SRCS)
944 $(GHCTAGS_INPLACE) -- $(GHCTAGS_HC_OPTS) -- $(GHCTAGS_HS_SRCS)
946 ifneq "$(TAGS_C_SRCS)" ""
947 etags -a $(TAGS_C_SRCS)
949 @( DEREFFED=`ls -l Makefile | sed -e 's/.*-> \(.*\)/\1/g'` && $(RM) `dirname $$DEREFFED`/TAGS && $(CP) TAGS `dirname $$DEREFFED` ) 2>/dev/null || echo TAGS file generated, perhaps copy over to source tree?
951 include $(TOP)/mk/target.mk
953 ifeq "$(BUILD_GHC_PACKAGE)" "YES"
957 $(odir)/main/Config.$(way_)o: SRC_HC_OPTS+=-DSTAGE=$(DQ)$(stage)$(DQ)
959 ifneq "$(findstring $(stage), 2 3)" ""
960 $(warning LIBRARY is $(LIBRARY))
962 ifneq "$(DOING_BIN_DIST)" "YES"
963 $(GHC_PROG) : $(LIBRARY) main/Main.hs
964 $(RM) package.conf.inplace
965 $(RM) $(STAMP_PKG_CONF)
966 $(MAKE) way="" $(STAMP_PKG_CONF)
967 $(MAKE) -f Makefile.ghcbin $(MFLAGS) HS_PROG=$(GHC_PROG) $@
972 #-----------------------------------------------------------------------------
976 $(INSTALL_DIR) $(BIN_DIST_DIR)/compiler
977 $(INSTALL_DIR) $(BIN_DIST_DIR)/compiler/stage$(stage)
978 echo "stage=$(stage)" > $(BIN_DIST_DIR)/compiler/Makefile
979 cat Makefile >> $(BIN_DIST_DIR)/compiler/Makefile
980 $(INSTALL_DATA) package.conf.in $(BIN_DIST_DIR)/compiler/
981 set -e; for d in stage$(stage)/*/; do $(INSTALL_DIR) $(BIN_DIST_DIR)/compiler/$$d; done
982 set -e; for f in $(HS_IFACES); do $(INSTALL_DATA) $$f $(BIN_DIST_DIR)/compiler/$$f; done
983 ifneq "$(INSTALL_LIBS)" ""
984 set -e; for f in $(INSTALL_LIBS); do $(INSTALL_DATA) $$f $(BIN_DIST_DIR)/compiler/$$f; done
986 ifneq "$(INSTALL_PROGS)" ""
987 set -e; for f in $(INSTALL_PROGS); do $(INSTALL_PROGRAM) $$f $(BIN_DIST_DIR)/compiler/$$f; done
989 ifneq "$(INSTALL_LIBEXECS)" ""
990 set -e; for f in $(INSTALL_LIBEXECS); do $(INSTALL_PROGRAM) $$f $(BIN_DIST_DIR)/compiler/$$f; done
993 # -----------------------------------------------------------------------------
994 # Explicit dependencies
996 # Some .hs files #include other source files, but since ghc -M doesn't spit out
997 # these dependencies we have to include them manually.
999 # We don't add dependencies on HsVersions.h, ghcautoconf.h, or ghc_boot_platform.h,
1000 # because then modifying one of these files would force recompilation of everything,
1001 # which is probably not what you want. However, it does mean you have to be
1002 # careful to recompile stuff you need if you reconfigure or change HsVersions.h.
1004 # Aargh, these don't work properly anyway, because GHC's recompilation checker
1005 # just reports "compilation NOT required". Do we have to add -no-recomp for each
1006 # of these .hs files? I haven't done anything about this yet.
1008 $(odir)/codeGen/Bitmap.$(way_)o : ../includes/MachDeps.h
1009 $(odir)/codeGen/CgCallConv.$(way_)o : ../includes/StgFun.h
1010 $(odir)/codeGen/CgProf.$(way_)o : ../includes/MachDeps.h
1011 $(odir)/codeGen/CgProf.$(way_)o : ../includes/Constants.h
1012 $(odir)/codeGen/CgProf.$(way_)o : ../includes/DerivedConstants.h
1013 $(odir)/codeGen/CgTicky.$(way_)o : ../includes/DerivedConstants.h
1014 $(odir)/codeGen/ClosureInfo.$(way_)o : ../includes/MachDeps.h
1015 $(odir)/codeGen/SMRep.$(way_)o : ../includes/MachDeps.h
1016 $(odir)/codeGen/SMRep.$(way_)o : ../includes/ClosureTypes.h
1017 $(odir)/ghci/ByteCodeAsm.$(way_)o : ../includes/Bytecodes.h
1018 $(odir)/ghci/ByteCodeFFI.$(way_)o : nativeGen/NCG.h
1019 $(odir)/ghci/ByteCodeInstr.$(way_)o : ../includes/MachDeps.h
1020 $(odir)/ghci/ByteCodeItbls.$(way_)o : ../includes/ClosureTypes.h
1021 $(odir)/ghci/ByteCodeItbls.$(way_)o : nativeGen/NCG.h
1022 $(odir)/main/Constants.$(way_)o : ../includes/MachRegs.h
1023 $(odir)/main/Constants.$(way_)o : ../includes/Constants.h
1024 $(odir)/main/Constants.$(way_)o : ../includes/MachDeps.h
1025 $(odir)/main/Constants.$(way_)o : ../includes/DerivedConstants.h
1026 $(odir)/main/Constants.$(way_)o : ../includes/GHCConstants.h
1027 $(odir)/nativeGen/AsmCodeGen.$(way_)o : nativeGen/NCG.h
1028 $(odir)/nativeGen/MachCodeGen.$(way_)o : nativeGen/NCG.h
1029 $(odir)/nativeGen/MachCodeGen.$(way_)o : ../includes/MachDeps.h
1030 $(odir)/nativeGen/MachInstrs.$(way_)o : nativeGen/NCG.h
1031 $(odir)/nativeGen/MachRegs.$(way_)o : nativeGen/NCG.h
1032 $(odir)/nativeGen/MachRegs.$(way_)o : ../includes/MachRegs.h
1033 $(odir)/nativeGen/PositionIndependentCode.$(way_)o : nativeGen/NCG.h
1034 $(odir)/nativeGen/PprMach.$(way_)o : nativeGen/NCG.h
1035 $(odir)/nativeGen/RegAllocInfo.$(way_)o : nativeGen/NCG.h
1036 $(odir)/typecheck/TcForeign.$(way_)o : nativeGen/NCG.h
1037 $(odir)/utils/Binary.$(way_)o : ../includes/MachDeps.h
1038 $(odir)/utils/FastMutInt.$(way_)o : ../includes/MachDeps.h
1040 # -----------------------------------------------------------------------------
1043 MKDEPENDHS_HC_OPTS = $(patsubst -i$(odir)/%, -i%, $(HC_OPTS))
1047 # Must do this *after* including target.mk, because $(HS_SRCS) isn't set yet.
1048 depend :: $(STAGE_PLATFORM_H) $(HS_SRCS) $(C_SRCS)
1050 ifneq "$(BootingFromHc)" "YES"
1051 $(MKDEPENDHS) -M -optdep-f -optdep.depend-BASE $(foreach way,$(WAYS),-optdep-s -optdep$(way)) $(foreach obj,$(MKDEPENDHS_OBJ_SUFFICES),-osuf $(obj)) $(MKDEPENDHS_OPTS) $(filter-out -split-objs, $(MKDEPENDHS_HC_OPTS)) $(HS_SRCS)
1053 $(MKDEPENDC) -f .depend-BASE $(MKDEPENDC_OPTS) $(foreach way,$(WAYS),-s $(way)) -- $(CC_OPTS) -- $(C_SRCS)
1054 $(PERL) -pe 'binmode(stdin); binmode(stdout); s@(\S*[._]o)@stage$(stage)/$$1@g; s@(\S*[._]hi)@stage$(stage)/$$1@g; s@^.*/compat.*$$@@g;' <.depend-BASE >.depend-$(stage)
1055 # The binmode stuff tells perl not to add stupid ^M's to the output
1057 # The /lib/compat replacement is to workaround a bug in the
1058 # -optdep--exclude-module flag in GHC 6.4. It is not required for any
1059 # other version of GHC, but doesn't do any harm.
1061 ifeq "$(MakefileDeps)" "YES"
1062 $(CONFIG_HS) : Makefile
1063 stage1/$(PLATFORM_H) : Makefile
1064 stage2/$(PLATFORM_H) : Makefile
1067 -include .depend-$(stage)