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 ifeq "$(RelocatableBuild)" "YES"
275 @echo "cRelocatableBuild = True" >> $(CONFIG_HS)
277 @echo "cRelocatableBuild = False" >> $(CONFIG_HS)
279 ifeq "$(UseLibFFI)" "YES"
280 @echo "cLibFFI = True" >> $(CONFIG_HS)
282 @echo "cLibFFI = False" >> $(CONFIG_HS)
286 CLEAN_FILES += $(CONFIG_HS)
288 # -----------------------------------------------------------------------------
289 # Create platform includes
291 # Here we generate a little header file containing CPP symbols that GHC
292 # uses to determine which platform it is building on/for. The platforms
293 # can differ between stage1 and stage2 if we're cross-compiling, so we
294 # need one of these header files per stage.
296 PLATFORM_H = ghc_boot_platform.h
298 stage1/$(PLATFORM_H) : stage_dirs $(FPTOOLS_TOP)/mk/config.mk
299 @echo "Creating $@..."
301 @echo "#ifndef __PLATFORM_H__" >$@
302 @echo "#define __PLATFORM_H__" >>$@
304 @echo "#define BuildPlatform_NAME \"$(BUILDPLATFORM)\"" >> $@
305 @echo "#define HostPlatform_NAME \"$(HOSTPLATFORM)\"" >> $@
306 @echo "#define TargetPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
308 @echo "#define $(BuildPlatform_CPP)_BUILD 1" >> $@
309 @echo "#define $(HostPlatform_CPP)_HOST 1" >> $@
310 @echo "#define $(TargetPlatform_CPP)_TARGET 1" >> $@
312 @echo "#define $(BuildArch_CPP)_BUILD_ARCH 1" >> $@
313 @echo "#define $(HostArch_CPP)_HOST_ARCH 1" >> $@
314 @echo "#define $(TargetArch_CPP)_TARGET_ARCH 1" >> $@
315 @echo "#define BUILD_ARCH \"$(BuildArch_CPP)\"" >> $@
316 @echo "#define HOST_ARCH \"$(HostArch_CPP)\"" >> $@
317 @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
319 @echo "#define $(BuildOS_CPP)_BUILD_OS 1" >> $@
320 @echo "#define $(HostOS_CPP)_HOST_OS 1" >> $@
321 @echo "#define $(TargetOS_CPP)_TARGET_OS 1" >> $@
322 @echo "#define BUILD_OS \"$(BuildOS_CPP)\"" >> $@
323 @echo "#define HOST_OS \"$(HostOS_CPP)\"" >> $@
324 @echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@
325 ifeq "$(HostOS_CPP)" "irix"
326 @echo "#ifndef $(IRIX_MAJOR)_TARGET_OS " >> $@
327 @echo "#define $(IRIX_MAJOR)_TARGET_OS 1" >> $@
328 @echo "#endif " >> $@
331 @echo "#define $(BuildVendor_CPP)_BUILD_VENDOR 1" >> $@
332 @echo "#define $(HostVendor_CPP)_HOST_VENDOR 1" >> $@
333 @echo "#define $(TargetVendor_CPP)_TARGET_VENDOR 1" >> $@
334 @echo "#define BUILD_VENDOR \"$(BuildVendor_CPP)\"" >> $@
335 @echo "#define HOST_VENDOR \"$(HostVendor_CPP)\"" >> $@
336 @echo "#define TARGET_VENDOR \"$(TargetVendor_CPP)\"" >> $@
338 @echo "#endif /* __PLATFORM_H__ */" >> $@
341 # For stage2 and above, the BUILD platform is the HOST of stage1, and
342 # the HOST platform is the TARGET of stage1. The TARGET remains the same
343 # (stage1 is the cross-compiler, not stage2).
344 stage2/$(PLATFORM_H) : stage_dirs $(FPTOOLS_TOP)/mk/config.mk
345 @echo "Creating $@..."
347 @echo "#ifndef __PLATFORM_H__" >$@
348 @echo "#define __PLATFORM_H__" >>$@
350 @echo "#define BuildPlatform_NAME \"$(HOSTPLATFORM)\"" >> $@
351 @echo "#define HostPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
352 @echo "#define TargetPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
354 @echo "#define $(HostPlatform_CPP)_BUILD 1" >> $@
355 @echo "#define $(TargetPlatform_CPP)_HOST 1" >> $@
356 @echo "#define $(TargetPlatform_CPP)_TARGET 1" >> $@
358 @echo "#define $(HostArch_CPP)_BUILD_ARCH 1" >> $@
359 @echo "#define $(TargetArch_CPP)_HOST_ARCH 1" >> $@
360 @echo "#define $(TargetArch_CPP)_TARGET_ARCH 1" >> $@
361 @echo "#define BUILD_ARCH \"$(HostArch_CPP)\"" >> $@
362 @echo "#define HOST_ARCH \"$(TargetArch_CPP)\"" >> $@
363 @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
365 @echo "#define $(HostOS_CPP)_BUILD_OS 1" >> $@
366 @echo "#define $(TargetOS_CPP)_HOST_OS 1" >> $@
367 @echo "#define $(TargetOS_CPP)_TARGET_OS 1" >> $@
368 @echo "#define BUILD_OS \"$(HostOS_CPP)\"" >> $@
369 @echo "#define HOST_OS \"$(TargetOS_CPP)\"" >> $@
370 @echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@
371 ifeq "$(HostOS_CPP)" "irix"
372 @echo "#ifndef $(IRIX_MAJOR)_TARGET_OS " >> $@
373 @echo "#define $(IRIX_MAJOR)_TARGET_OS 1" >> $@
374 @echo "#endif " >> $@
377 @echo "#define $(HostVendor_CPP)_BUILD_VENDOR 1" >> $@
378 @echo "#define $(TargetVendor_CPP)_HOST_VENDOR 1" >> $@
379 @echo "#define $(TargetVendor_CPP)_TARGET_VENDOR 1" >> $@
380 @echo "#define BUILD_VENDOR \"$(HostVendor_CPP)\"" >> $@
381 @echo "#define HOST_VENDOR \"$(TargetVendor_CPP)\"" >> $@
382 @echo "#define TARGET_VENDOR \"$(TargetVendor_CPP)\"" >> $@
384 @echo "#endif /* __PLATFORM_H__ */" >> $@
387 stage3/$(PLATFORM_H) : stage_dirs stage2/$(PLATFORM_H)
388 $(CP) stage2/$(PLATFORM_H) stage3/$(PLATFORM_H)
390 STAGE_PLATFORM_H = stage$(stage)/$(PLATFORM_H)
392 boot :: $(STAGE_PLATFORM_H)
394 SRC_HC_OPTS += -Istage$(stage)
396 # -----------------------------------------------------------------------------
399 # First figure out ALL_DIRS, the source sub-directories
402 utils basicTypes types hsSyn prelude rename typecheck deSugar coreSyn \
403 vectorise specialise simplCore stranal stgSyn simplStg codeGen main \
404 profiling parser cprAnalysis ndpFlatten iface cmm
406 # Make sure we include Config.hs even if it doesn't exist yet...
407 ALL_SRCS += $(CONFIG_HS)
409 # HsGeneric.hs is not used just now
410 EXCLUDED_SRCS += hsSyn/HsGeneric.hs
412 ifeq ($(GhcWithNativeCodeGen),YES)
413 ALL_DIRS += nativeGen
415 SRC_HC_OPTS += -DOMIT_NATIVE_CODEGEN
418 ifeq ($(GhcWithIlx),YES)
423 ifeq ($(GhcWithJavaGen),YES)
425 SRC_HC_OPTS += -DJAVA
428 ifeq "$(BootingFromHc)" "YES"
429 # HC files are always from a self-booted compiler
432 ifneq "$(findstring $(stage), 2 3)" ""
439 # -----------------------------------------------------------------------------
440 # Building a compiler with interpreter support
442 # The interpreter, GHCi interface, Template Haskell and Hpc are only
443 # enabled when we are bootstrapping with the same version of GHC, and
444 # the interpreter is supported on this platform.
446 ifeq "$(bootstrapped)" "YES"
447 SRC_HC_OPTS += -package hpc -package bytestring
448 PKG_DEPENDS += hpc bytestring
451 ifeq "$(GhcWithInterpreter) $(bootstrapped)" "YES YES"
453 # Yes, include the interepreter and Template Haskell extensions
454 SRC_HC_OPTS += -DGHCI -package template-haskell
455 PKG_DEPENDS += template-haskell
457 # Should GHCI be building info tables in the TABLES_NEXT_TO_CODE style
459 ifeq "$(GhcEnableTablesNextToCode) $(GhcUnregisterised)" "YES NO"
460 SRC_HC_OPTS += -DGHCI_TABLES_NEXT_TO_CODE
463 ifeq "$(GhcThreaded)" "YES"
464 # Use threaded RTS with GHCi, so threads don't get blocked at the prompt.
465 SRC_LD_OPTS += -threaded
467 ifeq "$(GhcProfiled)" "YES"
470 ifeq "$(GhcDebugged)" "YES"
471 SRC_LD_OPTS += -debug
476 # If we are going to use dynamic libraries instead of .o files for ghci,
477 # we will need to always retain CAFs in the compiler.
478 # ghci/keepCAFsForGHCi contains a GNU C __attribute__((constructor))
479 # function which sets the keepCAFs flag for the RTS before any Haskell
481 ifeq "$(GhcBuildDylibs)" "YES"
483 EXCLUDED_SRCS += ghci/keepCAFsForGHCi.c
486 # Enable readline if either:
487 # - we're building stage 1 and $(GhcHasReadline)="YES"
488 # - we're building stage 2/3, and we have built the readline package
490 # But we don't enable readline on Windows, because readline is fairly
493 ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
495 ifeq "$(GhcHasReadline)" "YES"
496 SRC_HC_OPTS += -package readline -DUSE_READLINE
497 PKG_DEPENDS += readline
500 ifeq "$(wildcard $(FPTOOLS_TOP_ABS)/libraries/readline/unbuildable)" ""
501 SRC_HC_OPTS += -package readline -DUSE_READLINE
502 PKG_DEPENDS += readline
509 # No interpreter, so exclude Template Haskell modules
510 EXCLUDED_SRCS += deSugar/DsMeta.hs typecheck/TcSplice.lhs hsSyn/Convert.lhs
512 endif # bootstrapped with interpreter
514 # -----------------------------------------------
517 # Big Fudge to get around inherent problem that Makefile setup
518 # has got with 'mkdependC'.
520 SRC_MKDEPENDC_OPTS += -D__GLASGOW_HASKELL__=$(ProjectVersionInt)
522 # XXX not really correct, hschooks.c actually gets include files like
523 # RtsFlags.c from the installed GHC, but we can't tell mkdependC about that.
524 SRC_MKDEPENDC_OPTS += -I$(GHC_INCLUDE_DIR)
526 # -----------------------------------------------------------------------------
527 # Haskell compilations
530 -cpp -fglasgow-exts -fno-generics -Rghc-timing \
533 # Omitted: -I$(GHC_INCLUDE_DIR)
534 # We should have -I$(GHC_INCLUDE_DIR) in SRC_HC_OPTS,
535 # to avoid the use of an explicit path in GHC source files
536 # (include "../includes/config.h"
537 # But alas GHC 4.08 (and others for all I know) uses this very
538 # same include path when compiling the .hc files it generates.
539 # Disaster! Then the hc file sees the GHC 5.02 (or whatever)
540 # include files. For the moment we've reverted to using
541 # an explicit path in the .hs sources
543 # For the benefit of <5.00 compilers, do include GHC_INCLUDE_DIR
544 # when generating dependencies. (=> it gets passed onto mkdependHS,
546 SRC_MKDEPENDHS_OPTS += -I$(GHC_INCLUDE_DIR)
548 # We need System.Posix (or Posix when ghc < 6.2)
549 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
550 ifeq "$(bootstrapped)" "YES"
551 SRC_HC_OPTS += -package Win32
555 ifeq "$(bootstrapped) $(ghc_ge_601)" "NO NO"
556 SRC_HC_OPTS += -package posix
558 SRC_HC_OPTS += -package unix
563 # We use the Cabal package in stages 2/3 only; in stage 1 we're using
564 # the libcompat library which provides the Cabal modules.
566 SRC_HC_OPTS += -package Cabal
570 ifeq "$(ghc_ge_603)" "YES"
571 # Ignore lang, to avoid potential clash with the Generics module if
572 # lang happens to be a dependency of some exposed package in the local
573 # GHC installation (eg. wxHaskell did this around 6.4).
574 SRC_HC_OPTS += -ignore-package lang
577 SRC_CC_OPTS += -Iparser -I. -O
578 SRC_HC_OPTS += -recomp $(GhcHcOpts) $(GhcStage$(stage)HcOpts)
581 ifeq "$(BootingFromHc)" "YES"
582 SRC_CC_OPTS += -D__GLASGOW_HASKELL__=$(ProjectVersionInt)
585 # Special flags for particular modules
586 # The standard suffix rule for compiling a Haskell file
587 # adds these flags to the command line
589 # There used to be a -no-recomp flag on PrimOp, but why?
590 # It's an expensive module to recompile!
591 prelude/PrimOp_HC_OPTS = -H80m
594 main/ParsePkgConf_HC_OPTS += -fno-warn-incomplete-patterns
595 parser/Parser_HC_OPTS += -fno-warn-incomplete-patterns
597 ifeq "$(ghc_ge_603)" "NO"
598 # Use -fvia-C since the NCG can't handle the narrow16Int# (and intToInt16#?)
599 # primops on all platforms.
600 parser/Parser_HC_OPTS += -fvia-C
601 # because the NCG can't handle the 64-bit math in here
602 prelude/PrelRules_HC_OPTS += -fvia-C
603 # ByteCodeItbls uses primops that the NCG doesn't support.
604 ghci/ByteCodeItbls_HC_OPTS += -fvia-C
605 ghci/ByteCodeLink_HC_OPTS += -fvia-C -monly-3-regs
608 # Careful optimisation of the parser: we don't want to throw everything
609 # at it, because that takes too long and doesn't buy much, but we do want
610 # to inline certain key external functions, so we instruct GHC not to
611 # throw away inlinings as it would normally do in -Onot mode:
612 parser/Parser_HC_OPTS += -Onot -fno-ignore-interface-pragmas
614 ifeq "$(HOSTPLATFORM)" "hppa1.1-hp-hpux9"
615 rename/RnMonad_HC_OPTS = -O2 -O2-for-C
618 utils/Digraph_HC_OPTS = -fglasgow-exts
620 basicTypes/SrcLoc_HC_OPTS = -funbox-strict-fields
622 # We always optimise some low-level modules, otherwise performance of
623 # a non-optimised compiler is severely affected.
624 main/BinIface_HC_OPTS += -O
625 utils/Binary_HC_OPTS += -O -funbox-strict-fields
626 utils/FastMutInt_HC_OPTS += -O
627 utils/Encoding_HC_OPTS += -O
628 utils/StringBuffer_HC_OPTS += -O -funbox-strict-fields
629 utils/FastString_HC_OPTS += -O -funbox-strict-fields
631 # ---- Profiling ----
632 #simplCore/Simplify_HC_OPTS = -auto-all
633 #simplCore/SimplEnv_HC_OPTS = -auto-all
634 #simplCore/SimplUtils_HC_OPTS = -auto-all
636 # CSE interacts badly with top-level IORefs (reportedly in DriverState and
637 # DriverMkDepend), causing some of them to be commoned up. We have a fix for
638 # this in 5.00+, but earlier versions of the compiler will need CSE turned off.
639 # To be on the safe side, we disable CSE in *all* modules with top-level IORefs.
640 ghci/InteractiveUI_HC_OPTS = -fno-cse
641 main/CmdLineOpts_HC_OPTS = -fno-cse
642 main/DriverMkDepend_HC_OPTS = -fno-cse
643 main/DriverPipeline_HC_OPTS = -fno-cse
644 main/Finder_HC_OPTS = -fno-cse
645 main/SysTools_HC_OPTS = -fno-cse
646 main/StaticFlags_HC_OPTS = -fno-cse
648 # The #include is vital for the via-C route, else the C
649 # compiler doesn't realise that the stcall foreign imports are indeed
650 # stdcall, and doesn't generate the Foo@8 name for them
651 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
652 main/SysTools_HC_OPTS += '-\#include <windows.h>' '-\#include <process.h>'
655 parser/Lexer_HC_OPTS += -funbox-strict-fields
657 # ghc_strlen percolates through so many modules that it is easier to get its
658 # prototype via a global option instead of a myriad of per-file OPTIONS
659 SRC_HC_OPTS += '-\#include "cutils.h"'
661 # ----------------------------------------------------------------------------
662 # Generate supporting stuff for prelude/PrimOp.lhs
663 # from prelude/primops.txt
665 PRIMOP_BITS=primop-data-decl.hs-incl \
667 primop-list.hs-incl \
668 primop-has-side-effects.hs-incl \
669 primop-out-of-line.hs-incl \
670 primop-commutable.hs-incl \
671 primop-needs-wrapper.hs-incl \
672 primop-can-fail.hs-incl \
673 primop-strictness.hs-incl \
674 primop-primop-info.hs-incl
676 CLEAN_FILES += prelude/primops.txt
677 CLEAN_FILES += $(PRIMOP_BITS)
679 SRC_CPP_OPTS += -I$(GHC_INCLUDE_DIR)
680 SRC_CPP_OPTS += ${GhcCppOpts}
682 ifneq "$(BootingFromHc)" "YES"
683 prelude/PrimOp.lhs $(odir)/prelude/PrimOp.o: $(PRIMOP_BITS)
686 ifneq "$(BootingFromHc)" "YES"
687 depend :: $(PRIMOP_BITS)
690 # This is an ugly hack: we need stage1/$(PLATFORM_H) built before we
691 # preprocess primops.txt.pp, but we don't want to just add that
692 # dependency because we don't want $(PLATFORM_H) built during normal
693 # operations, because we don't have have dependencies from the .hs
694 # sources on it, and we don't want those dependencies because that
695 # would cause everything to be rebuilt every time the Makefile
696 # changed. So here we add the required dependency only when making
698 ifneq "$(findstring boot, $(MAKECMDGOALS))$(findstring depend, $(MAKECMDGOALS))" ""
699 prelude/primops.txt.pp : stage1/$(PLATFORM_H)
702 primop-data-decl.hs-incl: prelude/primops.txt
703 $(GENPRIMOP) --data-decl < $< > $@
704 primop-tag.hs-incl: prelude/primops.txt
705 $(GENPRIMOP) --primop-tag < $< > $@
706 primop-list.hs-incl: prelude/primops.txt
707 $(GENPRIMOP) --primop-list < $< > $@
708 primop-has-side-effects.hs-incl: prelude/primops.txt
709 $(GENPRIMOP) --has-side-effects < $< > $@
710 primop-out-of-line.hs-incl: prelude/primops.txt
711 $(GENPRIMOP) --out-of-line < $< > $@
712 primop-commutable.hs-incl: prelude/primops.txt
713 $(GENPRIMOP) --commutable < $< > $@
714 primop-needs-wrapper.hs-incl: prelude/primops.txt
715 $(GENPRIMOP) --needs-wrapper < $< > $@
716 primop-can-fail.hs-incl: prelude/primops.txt
717 $(GENPRIMOP) --can-fail < $< > $@
718 primop-strictness.hs-incl: prelude/primops.txt
719 $(GENPRIMOP) --strictness < $< > $@
720 primop-primop-info.hs-incl: prelude/primops.txt
721 $(GENPRIMOP) --primop-primop-info < $< > $@
723 # Usages aren't used any more; but the generator
724 # can still generate them if we want them back
725 primop-usage.hs-incl: prelude/primops.txt
726 $(GENPRIMOP) --usage < $< > $@
729 #-----------------------------------------------------------------------------
732 # Include libghccompat in stage1 only. In stage2 onwards, all these
733 # libraries will be available from the main libraries.
736 include $(GHC_COMPAT_DIR)/compat.mk
739 SRC_LD_OPTS += -no-link-chk
741 # -----------------------------------------------------------------------------
742 # create ghc-inplace, a convenient way to run ghc from the build tree...
743 # See comments in $(FPTOOLS_TOP)/utils/ghc-pkg/Makefile for why we use
744 # a real binary here rather than a shell script.
746 INPLACE_SRC = $(odir)/ghc-inplace.c
747 INPLACE_PROG = $(odir)/ghc-inplace$(_way)$(exeext)
748 INPLACE_EXTRA_FLAGS = -I$(TOP)/includes
749 EXCLUDED_C_SRCS += ghc-inplace.c
751 CLEAN_FILES += $(INPLACE_SRC)
753 GHC_PATH=$(FPTOOLS_TOP_ABS)/$(GHC_COMPILER_DIR_REL)/$(GHC_PROG)$(exeext)
755 $(INPLACE_PROG): ghc-inplace.c
756 $(SED) -e "s@GHC_PATH@$(GHC_PATH)@g" -e "s@TOP_ABS@$(FPTOOLS_TOP_ABS)@g" < $< > $(INPLACE_SRC)
757 $(HC) -cpp $(INPLACE_EXTRA_FLAGS) $(INPLACE_SRC) -o $@
759 all :: $(INPLACE_PROG)
761 CLEAN_FILES += $(INPLACE_PROG)
764 ghc-inplace : $(INPLACE_PROG)
765 $(RM) -f $@ && $(LN_S) $< $@
769 CLEAN_FILES += ghc-inplace
772 #-----------------------------------------------------------------------------
775 # We don't want ghc treated as an ordinary executable,
776 # but put it together with the libraries.
777 # Also don't want any interface files installed
779 DESTDIR = $(INSTALL_LIBRARY_DIR_GHC)
781 ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
782 INSTALL_LIBEXECS += $(GHC_PROG)
784 INSTALL_PROGS += $(GHC_PROG)
787 # ----------------------------------------------------------------------------
790 # rename/RnBinds_HC_OPTS += -auto-all
791 # rename/RnEnv_HC_OPTS += -auto-all
792 # rename/RnExpr_HC_OPTS += -auto-all
793 # rename/RnHiFiles_HC_OPTS += -auto-all
794 # rename/RnHsSyn_HC_OPTS += -auto-all
795 # rename/Rename_HC_OPTS += -auto-all
796 # rename/RnIfaces_HC_OPTS += -auto-all
797 # rename/RnNames_HC_OPTS += -auto-all
798 # rename/RnSource_HC_OPTS += -auto-all
799 # rename/RnTypes_HC_OPTS += -auto-all
801 # typecheck/Inst_HC_OPTS += -auto-all
802 # typecheck/TcBinds_HC_OPTS += -auto-all
803 # typecheck/TcClassDcl_HC_OPTS += -auto-all
804 # typecheck/TcDefaults_HC_OPTS += -auto-all
805 # typecheck/TcDeriv_HC_OPTS += -auto-all
806 # typecheck/TcEnv_HC_OPTS += -auto-all
807 # typecheck/TcExpr_HC_OPTS += -auto-all
808 # typecheck/TcForeign_HC_OPTS += -auto-all
809 # typecheck/TcGenDeriv_HC_OPTS += -auto-all
810 # typecheck/TcHsSyn_HC_OPTS += -auto-all
811 # typecheck/TcIfaceSig_HC_OPTS += -auto-all
812 # typecheck/TcInstDcls_HC_OPTS += -auto-all
813 # typecheck/TcMatches_HC_OPTS += -auto-all
814 # typecheck/TcMonoType_HC_OPTS += -auto-all
815 # typecheck/TcMType_HC_OPTS += -auto-all
816 # typecheck/TcPat_HC_OPTS += -auto-all
817 # typecheck/TcRnDriver_HC_OPTS += -auto-all
818 # #typecheck/TcRnMonad_HC_OPTS += -auto-all
819 # #typecheck/TcRnTypes_HC_OPTS += -auto-all
820 # typecheck/TcRules_HC_OPTS += -auto-all
821 # typecheck/TcSimplify_HC_OPTS += -auto-all
822 # typecheck/TcSplice_HC_OPTS += -auto-all
823 # typecheck/TcTyClsDecls_HC_OPTS += -auto-all
824 # typecheck/TcTyDecls_HC_OPTS += -auto-all
825 # typecheck/TcType_HC_OPTS += -auto-all
826 # typecheck/TcUnify_HC_OPTS += -auto-all
828 # coreSyn/CorePrep_HC_OPTS += -auto-all
829 # parser/Parser_HC_OPTS += -fasm
831 #-----------------------------------------------------------------------------
832 # Building the GHC package
834 # The GHC package is made from the stage 2 build and later.
835 # Fortunately the package build system framework more or less does the
836 # right thing for us here.
838 ifneq "$(findstring $(stage), 2 3)" ""
839 BUILD_GHC_PACKAGE=YES
842 ifeq "$(BUILD_GHC_PACKAGE)" "YES"
844 HIERARCHICAL_LIB = NO
845 VERSION = $(ProjectVersion)
846 PKG_DEPENDS += base haskell98
847 LIB_LD_OPTS += $(foreach pkg,$(PKG_DEPENDS),-package $(pkg))
848 # We have to expand each package dependency with its version, which we
849 # can do by calling "ghc-pkg list $pkg --simple-output".
850 PACKAGE_CPP_OPTS += -DPKG_DEPENDS='$(foreach pkg,$(PKG_DEPENDS),$(shell $(GHC_PKG_INPLACE) latest --global $(pkg)))'
851 PACKAGE_CPP_OPTS += -DSTAGE='"$(stage)"'
853 # Omit Main from the library, the client will want to plug their own Main in
854 LIBOBJS = $(filter-out $(odir)/main/Main.$(way_)o $(odir)/parser/hschooks.$(way_)o, $(OBJS))
856 # disable splitting: it won't really help with GHC, and the specialised
857 # build system for compiler/ isn't set up to handle it.
860 # the package build system likes to set WAYS=$(GhcLibWays), but we don't
861 # really want to build the whole of GHC multiple ways... if you do,
862 # set GhcCompilerWays instead.
863 GhcLibWays = $(GhcCompilerWays)
865 # override $(GhcLibHcOpts): we want GhcStage2HcOpts to take precedence
868 ifeq "$(DOING_BIN_DIST)" "YES"
869 # This is derived from the sources when we are in a source tree, but we
870 # don't have any sources in a bindist, so we have to shortcut it
871 HS_IFACES := $(wildcard stage$(stage)/*/*.hi)
873 # override default definition of HS_IFACES so we can add $(odir)
874 HS_IFACES = $(addsuffix .$(way_)hi,$(basename $(HS_OBJS)))
877 # Haddock can't handle recursive modules currently, so we disable it for now.
878 override HADDOCK_DOCS = NO
880 # Tell package.mk not to set $(HC)
883 # The stage 2 GHC binary itself is built by compiling main/Main.hs
884 # (the same as used in stage 1) against the GHC package.
886 # This is done by compiling Main.hs separately and linking it with
887 # -package ghc. This is done using a separate Makefile, Makefile.ghcbin
888 # Why? See comments in Makefile.ghcbin
890 # The stage 2 and stage 3 package.conf.in files are different, because they
891 # point to either the stage2/ or stage3/ dirs in import-dirs. Hence before
892 # linking the ghc binary we must install the correct version of the package
893 # configuration. Yeuch... maybe one day this will all be done more cleanly.
894 STAMP_PKG_CONF = $(GHC_DRIVER_DIR)/stamp-pkg-conf-$(PACKAGE)
896 # Propagate standard targets to Makefile.ghcbin
897 docs runtests $(BOOT_TARGET) TAGS clean distclean mostlyclean maintainer-clean $(INSTALL_TARGET) $(INSTALL_DOCS_TARGET) html chm HxS ps dvi txt::
898 $(MAKE) -f Makefile.ghcbin $(MFLAGS) $@
901 #-----------------------------------------------------------------------------
904 MAINTAINER_CLEAN_FILES += parser/Parser.info main/ParsePkgConf.info
906 #-----------------------------------------------------------------------------
907 # Include target-rule boilerplate
909 # Don't use the default MKDEPENDHS stuff... we'll do our own, below
913 # Make doesn't work this out for itself, it seems
914 parser/Parser.y : parser/Parser.y.pp
915 EXTRA_SRCS += parser/Parser.y
918 #-----------------------------------------------------------------------------
919 # Source files for tags file generation
921 # We want to excluded derived sources, because they won't be in the source
922 # tree, which is where we are going to move the TAGS file to.a
924 TAGS_HS_SRCS = parser/Parser.y.pp $(filter-out $(DERIVED_SRCS) main/Config.hs parser/Parser.y, $(sort $(SRCS)))
926 WRONG_GHCTAGS_HS_SRCS = $(filter-out $(DERIVED_SRCS) main/Config.hs parser/Parser.y, $(sort $(SRCS)))
927 # above is wrong because of the following problem:
928 # module `main:DataCon' is defined in multiple files: basicTypes/DataCon.lhs
929 # basicTypes/DataCon.lhs-boot
931 GHCTAGS_HS_SRCS = $(HS_SRCS)
932 GHCTAGS_HC_OPTS = $(patsubst -i$(odir)/%, -i%, $(HC_OPTS))
933 GHCTAGS_HC_OPTS += -DSTAGE='"$(stage)"'
935 #------------------------------------------------------------
940 ghctags :: $(GHCTAGS_HS_SRCS) $(TAGS_C_SRCS)
941 @if [ "$(stage)" != 2 ]; then echo "Must use 'make stage=2 ghctags'"; exit 1; fi
944 @echo SOURCES ARE "$(GHCTAGS_HS_SRCS)"
945 : ifneq "$(GHCTAGS_HS_SRCS)" ""
946 @echo TIME TO ROCK AND ROLL
947 # $(GHCTAGS_INPLACE) -- $(MKDEPENDHS_OPTS) $(filter-out -split-objs, $(MKDEPENDHS_HC_OPTS)) -- $(GHCTAGS_HS_SRCS)
948 $(GHCTAGS_INPLACE) -- $(GHCTAGS_HC_OPTS) -- $(GHCTAGS_HS_SRCS)
950 ifneq "$(TAGS_C_SRCS)" ""
951 etags -a $(TAGS_C_SRCS)
953 @( 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?
955 include $(TOP)/mk/target.mk
957 ifeq "$(BUILD_GHC_PACKAGE)" "YES"
961 $(odir)/main/Config.$(way_)o: SRC_HC_OPTS+=-DSTAGE=$(DQ)$(stage)$(DQ)
963 ifneq "$(findstring $(stage), 2 3)" ""
964 $(warning LIBRARY is $(LIBRARY))
966 ifneq "$(DOING_BIN_DIST)" "YES"
967 $(GHC_PROG) : $(LIBRARY) main/Main.hs
968 $(RM) package.conf.inplace
969 $(RM) $(STAMP_PKG_CONF)
970 $(MAKE) way="" $(STAMP_PKG_CONF)
971 $(MAKE) -f Makefile.ghcbin $(MFLAGS) HS_PROG=$(GHC_PROG) $@
976 #-----------------------------------------------------------------------------
980 $(INSTALL_DIR) $(BIN_DIST_DIR)/compiler
981 $(INSTALL_DIR) $(BIN_DIST_DIR)/compiler/stage$(stage)
982 echo "stage=$(stage)" > $(BIN_DIST_DIR)/compiler/Makefile
983 cat Makefile >> $(BIN_DIST_DIR)/compiler/Makefile
984 $(INSTALL_DATA) package.conf.in $(BIN_DIST_DIR)/compiler/
985 set -e; for d in stage$(stage)/*/; do $(INSTALL_DIR) $(BIN_DIST_DIR)/compiler/$$d; done
986 set -e; for f in $(HS_IFACES); do $(INSTALL_DATA) $$f $(BIN_DIST_DIR)/compiler/$$f; done
987 ifneq "$(INSTALL_LIBS)" ""
988 set -e; for f in $(INSTALL_LIBS); do $(INSTALL_DATA) $$f $(BIN_DIST_DIR)/compiler/$$f; done
990 ifneq "$(INSTALL_PROGS)" ""
991 set -e; for f in $(INSTALL_PROGS); do $(INSTALL_PROGRAM) $$f $(BIN_DIST_DIR)/compiler/$$f; done
993 ifneq "$(INSTALL_LIBEXECS)" ""
994 set -e; for f in $(INSTALL_LIBEXECS); do $(INSTALL_PROGRAM) $$f $(BIN_DIST_DIR)/compiler/$$f; done
997 # -----------------------------------------------------------------------------
998 # Explicit dependencies
1000 # Some .hs files #include other source files, but since ghc -M doesn't spit out
1001 # these dependencies we have to include them manually.
1003 # We don't add dependencies on HsVersions.h, ghcautoconf.h, or ghc_boot_platform.h,
1004 # because then modifying one of these files would force recompilation of everything,
1005 # which is probably not what you want. However, it does mean you have to be
1006 # careful to recompile stuff you need if you reconfigure or change HsVersions.h.
1008 # Aargh, these don't work properly anyway, because GHC's recompilation checker
1009 # just reports "compilation NOT required". Do we have to add -no-recomp for each
1010 # of these .hs files? I haven't done anything about this yet.
1012 $(odir)/codeGen/Bitmap.$(way_)o : ../includes/MachDeps.h
1013 $(odir)/codeGen/CgCallConv.$(way_)o : ../includes/StgFun.h
1014 $(odir)/codeGen/CgProf.$(way_)o : ../includes/MachDeps.h
1015 $(odir)/codeGen/CgProf.$(way_)o : ../includes/Constants.h
1016 $(odir)/codeGen/CgProf.$(way_)o : ../includes/DerivedConstants.h
1017 $(odir)/codeGen/CgTicky.$(way_)o : ../includes/DerivedConstants.h
1018 $(odir)/codeGen/ClosureInfo.$(way_)o : ../includes/MachDeps.h
1019 $(odir)/codeGen/SMRep.$(way_)o : ../includes/MachDeps.h
1020 $(odir)/codeGen/SMRep.$(way_)o : ../includes/ClosureTypes.h
1021 $(odir)/ghci/ByteCodeAsm.$(way_)o : ../includes/Bytecodes.h
1022 $(odir)/ghci/ByteCodeFFI.$(way_)o : nativeGen/NCG.h
1023 $(odir)/ghci/ByteCodeInstr.$(way_)o : ../includes/MachDeps.h
1024 $(odir)/ghci/ByteCodeItbls.$(way_)o : ../includes/ClosureTypes.h
1025 $(odir)/ghci/ByteCodeItbls.$(way_)o : nativeGen/NCG.h
1026 $(odir)/main/Constants.$(way_)o : ../includes/MachRegs.h
1027 $(odir)/main/Constants.$(way_)o : ../includes/Constants.h
1028 $(odir)/main/Constants.$(way_)o : ../includes/MachDeps.h
1029 $(odir)/main/Constants.$(way_)o : ../includes/DerivedConstants.h
1030 $(odir)/main/Constants.$(way_)o : ../includes/GHCConstants.h
1031 $(odir)/nativeGen/AsmCodeGen.$(way_)o : nativeGen/NCG.h
1032 $(odir)/nativeGen/MachCodeGen.$(way_)o : nativeGen/NCG.h
1033 $(odir)/nativeGen/MachCodeGen.$(way_)o : ../includes/MachDeps.h
1034 $(odir)/nativeGen/MachInstrs.$(way_)o : nativeGen/NCG.h
1035 $(odir)/nativeGen/MachRegs.$(way_)o : nativeGen/NCG.h
1036 $(odir)/nativeGen/MachRegs.$(way_)o : ../includes/MachRegs.h
1037 $(odir)/nativeGen/PositionIndependentCode.$(way_)o : nativeGen/NCG.h
1038 $(odir)/nativeGen/PprMach.$(way_)o : nativeGen/NCG.h
1039 $(odir)/nativeGen/RegAllocInfo.$(way_)o : nativeGen/NCG.h
1040 $(odir)/typecheck/TcForeign.$(way_)o : nativeGen/NCG.h
1041 $(odir)/utils/Binary.$(way_)o : ../includes/MachDeps.h
1042 $(odir)/utils/FastMutInt.$(way_)o : ../includes/MachDeps.h
1044 # -----------------------------------------------------------------------------
1047 MKDEPENDHS_HC_OPTS = $(patsubst -i$(odir)/%, -i%, $(HC_OPTS))
1051 # Must do this *after* including target.mk, because $(HS_SRCS) isn't set yet.
1052 depend :: $(STAGE_PLATFORM_H) $(HS_SRCS) $(C_SRCS)
1054 ifneq "$(BootingFromHc)" "YES"
1055 $(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)
1057 $(MKDEPENDC) -f .depend-BASE $(MKDEPENDC_OPTS) $(foreach way,$(WAYS),-s $(way)) -- $(CC_OPTS) -- $(C_SRCS)
1058 $(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)
1059 # The binmode stuff tells perl not to add stupid ^M's to the output
1061 # The /lib/compat replacement is to workaround a bug in the
1062 # -optdep--exclude-module flag in GHC 6.4. It is not required for any
1063 # other version of GHC, but doesn't do any harm.
1065 ifeq "$(MakefileDeps)" "YES"
1066 $(CONFIG_HS) : Makefile
1067 stage1/$(PLATFORM_H) : Makefile
1068 stage2/$(PLATFORM_H) : Makefile
1071 -include .depend-$(stage)