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 # - we use explicit -o and -ohi options to direct the output from C &
56 # Haskell compilations.
58 # - we generate a different .depend file for each build. They need to be
59 # different, because each stage might include different files: stage1
60 # might not include GHCi, for example. For each stage, a normal .depend
61 # file is generated, and then post-processed to add the correct stageN/
62 # prefix to each object and .hi filename. The resulting .depend file
63 # is named .depend-$(stage). See the end of this Makefile for details.
65 # - normal implicit rules don't work any more, because they're of the form
69 # whereas we really need
73 # so suffix.mk now defines the appropriate suffix rules when
74 # $(odir) is set to a non-empty value. Here we set $(odir) to
75 # stage1, stage2, or stage3.
77 # There are other plausible designs that might work, but each has different
80 # - using -odir and -hidir:
81 # -odir puts all the objects in one directory (strips off the
82 # subdirectory part), which eventually forces us to use VPATH to find
83 # the sources. I have a really bad feeling about VPATH.
85 # - invoke make in the stageN subdirectory. This probably requires VPATH
88 # - create a link tree. The problem with requiring link trees is that
89 # Windows doesn't support symbolic links.
97 $(MKDIRHIER) stage$(stage)
98 for i in $(ALL_DIRS); do \
99 $(MKDIRHIER) stage$(stage)/$$i; \
105 ifneq "$(findstring $(stage), 2 3)" ""
137 SRC_HC_OPTS += $(patsubst %, -i$(odir)/%, $(ALL_DIRS))
139 SRC_HC_OPTS += -Wall -fno-warn-name-shadowing -fno-warn-orphans
141 HS_OBJS = $(patsubst %, $(odir)/%, $(addsuffix .$(way_)o,$(basename $(HS_SRCS))))
142 C_OBJS = $(patsubst %, $(odir)/%, $(addsuffix .$(way_)o,$(basename $(C_SRCS))))
144 # Our standard cleaning rules don't know that we're doing our output
145 # into $(odir), so we have to augment CLEAN_FILES appropriateliy.
147 CLEAN_FILES += $(odir)/*/*.$(way_)hi $(odir)/*/*.$(way_)hi-boot $(odir)/*/*.$(way_)o-boot
149 ifeq "$(UsingHsBoot)" "YES"
150 CLEAN_FILES += $(odir)/*/*.hi-boot $(odir)/*/*.o-boot
154 mostlyclean clean distclean maintainer-clean ::
159 # -----------------------------------------------------------------------------
162 # Note: there have been reports of people running up against the ARG_MAX limit
163 # when linking ghc with all its constituent object files. The likely source of
164 # the problem is that the environment is a bit too big, so a workaround could
165 # be to do `env PATH=$(PATH) make ghc' to minimise the environment. (or the
166 # equivalent of `env' if it doesn't exist locally).
168 ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
169 GHC_PROG=$(odir)/ghc$(_way)-$(ProjectVersion)
171 GHC_PROG=$(odir)/ghc$(_way)
175 HS_PROG = $(GHC_PROG)
178 # -----------------------------------------------------------------------------
179 # Create compiler configuration
181 # The 'echo' commands simply spit the values of various make variables
182 # into Config.hs, whence they can be compiled and used by GHC itself
184 CONFIG_HS = main/Config.hs
187 $(CONFIG_HS) : $(FPTOOLS_TOP)/mk/config.mk
188 @$(RM) -f $(CONFIG_HS)
189 @echo "Creating $(CONFIG_HS) ... "
190 @echo "module Config where" >>$(CONFIG_HS)
191 @echo "cProjectName :: String" >> $(CONFIG_HS)
192 @echo "cProjectName = \"$(ProjectName)\"" >> $(CONFIG_HS)
193 @echo "cProjectVersion :: String" >> $(CONFIG_HS)
194 @echo "cProjectVersion = \"$(ProjectVersion)\"" >> $(CONFIG_HS)
195 @echo "cProjectVersionInt :: String" >> $(CONFIG_HS)
196 @echo "cProjectVersionInt = \"$(ProjectVersionInt)\"" >> $(CONFIG_HS)
197 @echo "cProjectPatchLevel :: String" >> $(CONFIG_HS)
198 @echo "cProjectPatchLevel = \"$(ProjectPatchLevel)\"" >> $(CONFIG_HS)
199 @echo "cBooterVersion :: String" >> $(CONFIG_HS)
200 @echo "cBooterVersion = \"$(GhcVersion)\"" >> $(CONFIG_HS)
201 @echo "cStage :: String" >> $(CONFIG_HS)
202 @echo "cStage = STAGE" >> $(CONFIG_HS)
203 @echo "cHscIfaceFileVersion :: String" >> $(CONFIG_HS)
204 @echo "cHscIfaceFileVersion = \"$(HscIfaceFileVersion)\"" >> $(CONFIG_HS)
205 @echo "cSplitObjs :: String" >> $(CONFIG_HS)
206 @echo "cSplitObjs = \"$(SplitObjs)\"" >> $(CONFIG_HS)
207 @echo "cGhcWithInterpreter :: String" >> $(CONFIG_HS)
208 @echo "cGhcWithInterpreter = \"$(GhcWithInterpreter)\"" >> $(CONFIG_HS)
209 @echo "cGhcWithNativeCodeGen :: String" >> $(CONFIG_HS)
210 @echo "cGhcWithNativeCodeGen = \"$(GhcWithNativeCodeGen)\"" >> $(CONFIG_HS)
211 @echo "cGhcWithSMP :: String" >> $(CONFIG_HS)
212 @echo "cGhcWithSMP = \"$(GhcWithSMP)\"" >> $(CONFIG_HS)
213 @echo "cGhcRTSWays :: String" >> $(CONFIG_HS)
214 @echo "cGhcRTSWays = \"$(GhcRTSWays)\"" >> $(CONFIG_HS)
215 @echo "cGhcUnregisterised :: String" >> $(CONFIG_HS)
216 @echo "cGhcUnregisterised = \"$(GhcUnregisterised)\"" >> $(CONFIG_HS)
217 @echo "cGhcEnableTablesNextToCode :: String" >> $(CONFIG_HS)
218 @echo "cGhcEnableTablesNextToCode = \"$(GhcEnableTablesNextToCode)\"" >> $(CONFIG_HS)
219 @echo "cLeadingUnderscore :: String" >> $(CONFIG_HS)
220 @echo "cLeadingUnderscore = \"$(LeadingUnderscore)\"" >> $(CONFIG_HS)
221 @echo "cRAWCPP_FLAGS :: String" >> $(CONFIG_HS)
222 @echo "cRAWCPP_FLAGS = \"$(RAWCPP_FLAGS)\"" >> $(CONFIG_HS)
223 @echo "cGCC :: String" >> $(CONFIG_HS)
224 @echo "cGCC = \"$(WhatGccIsCalled)\"" >> $(CONFIG_HS)
225 @echo "cMKDLL :: String" >> $(CONFIG_HS)
226 @echo "cMKDLL = \"$(BLD_DLL)\"" >> $(CONFIG_HS)
227 @echo "cLdIsGNULd :: String" >> $(CONFIG_HS)
228 @echo "cLdIsGNULd = \"$(LdIsGNULd)\"" >> $(CONFIG_HS)
229 @echo "cLD_X :: String" >> $(CONFIG_HS)
230 @echo "cLD_X = \"$(LD_X)\"" >> $(CONFIG_HS)
231 @echo "cGHC_DRIVER_DIR_REL :: String" >> $(CONFIG_HS)
232 @echo "cGHC_DRIVER_DIR_REL = \"$(GHC_DRIVER_DIR_REL)\"" >> $(CONFIG_HS)
233 @echo "cGHC_TOUCHY_PGM :: String" >> $(CONFIG_HS)
234 @echo "cGHC_TOUCHY_PGM = \"$(GHC_TOUCHY_PGM)\"" >> $(CONFIG_HS)
235 @echo "cGHC_TOUCHY_DIR_REL :: String" >> $(CONFIG_HS)
236 @echo "cGHC_TOUCHY_DIR_REL = \"$(GHC_TOUCHY_DIR_REL)\"" >> $(CONFIG_HS)
237 @echo "cGHC_UNLIT_PGM :: String" >> $(CONFIG_HS)
238 @echo "cGHC_UNLIT_PGM = \"$(GHC_UNLIT_PGM)\"" >> $(CONFIG_HS)
239 @echo "cGHC_UNLIT_DIR_REL :: String" >> $(CONFIG_HS)
240 @echo "cGHC_UNLIT_DIR_REL = \"$(GHC_UNLIT_DIR_REL)\"" >> $(CONFIG_HS)
241 @echo "cGHC_MANGLER_PGM :: String" >> $(CONFIG_HS)
242 @echo "cGHC_MANGLER_PGM = \"$(GHC_MANGLER_PGM)\"" >> $(CONFIG_HS)
243 @echo "cGHC_MANGLER_DIR_REL :: String" >> $(CONFIG_HS)
244 @echo "cGHC_MANGLER_DIR_REL = \"$(GHC_MANGLER_DIR_REL)\"" >> $(CONFIG_HS)
245 @echo "cGHC_SPLIT_PGM :: String" >> $(CONFIG_HS)
246 @echo "cGHC_SPLIT_PGM = \"$(GHC_SPLIT_PGM)\"" >> $(CONFIG_HS)
247 @echo "cGHC_SPLIT_DIR_REL :: String" >> $(CONFIG_HS)
248 @echo "cGHC_SPLIT_DIR_REL = \"$(GHC_SPLIT_DIR_REL)\"" >> $(CONFIG_HS)
249 @echo "cGHC_SYSMAN_PGM :: String" >> $(CONFIG_HS)
250 @echo "cGHC_SYSMAN_PGM = \"$(GHC_SYSMAN)\"" >> $(CONFIG_HS)
251 @echo "cGHC_SYSMAN_DIR_REL :: String" >> $(CONFIG_HS)
252 @echo "cGHC_SYSMAN_DIR_REL = \"$(GHC_SYSMAN_DIR)\"" >> $(CONFIG_HS)
253 @echo "cGHC_CP :: String" >> $(CONFIG_HS)
254 @echo "cGHC_CP = \"$(GHC_CP)\"" >> $(CONFIG_HS)
255 @echo "cGHC_PERL :: String" >> $(CONFIG_HS)
256 @echo "cGHC_PERL = \"$(GHC_PERL)\"" >> $(CONFIG_HS)
257 @echo "cEnableWin32DLLs :: String" >> $(CONFIG_HS)
258 @echo "cEnableWin32DLLs = \"$(EnableWin32DLLs)\"" >> $(CONFIG_HS)
259 @echo "cCONTEXT_DIFF :: String" >> $(CONFIG_HS)
260 @echo "cCONTEXT_DIFF = \"$(CONTEXT_DIFF)\"" >> $(CONFIG_HS)
261 @echo "cUSER_WAY_NAMES :: String" >> $(CONFIG_HS)
262 @echo "cUSER_WAY_NAMES = \"$(USER_WAY_NAMES)\"" >> $(CONFIG_HS)
263 @echo "cUSER_WAY_OPTS :: String" >> $(CONFIG_HS)
264 @echo "cUSER_WAY_OPTS = \"$(USER_WAY_OPTS)\"" >> $(CONFIG_HS)
265 @echo "cDEFAULT_TMPDIR :: String" >> $(CONFIG_HS)
266 @echo "cDEFAULT_TMPDIR = \"$(DEFAULT_TMPDIR)\"" >> $(CONFIG_HS)
267 @echo "cRelocatableBuild :: Bool" >> $(CONFIG_HS)
268 ifeq "$(RelocatableBuild)" "YES"
269 @echo "cRelocatableBuild = True" >> $(CONFIG_HS)
271 @echo "cRelocatableBuild = False" >> $(CONFIG_HS)
273 @echo "cLibFFI :: Bool" >> $(CONFIG_HS)
274 ifeq "$(UseLibFFIForAdjustors)" "YES"
275 @echo "cLibFFI = True" >> $(CONFIG_HS)
277 @echo "cLibFFI = False" >> $(CONFIG_HS)
281 CLEAN_FILES += $(CONFIG_HS)
283 # -----------------------------------------------------------------------------
284 # Create platform includes
286 # Here we generate a little header file containing CPP symbols that GHC
287 # uses to determine which platform it is building on/for. The platforms
288 # can differ between stage1 and stage2 if we're cross-compiling, so we
289 # need one of these header files per stage.
291 PLATFORM_H = ghc_boot_platform.h
293 stage1/$(PLATFORM_H) : stage_dirs $(FPTOOLS_TOP)/mk/config.mk
294 @echo "Creating $@..."
296 @echo "#ifndef __PLATFORM_H__" >$@
297 @echo "#define __PLATFORM_H__" >>$@
299 @echo "#define BuildPlatform_NAME \"$(BUILDPLATFORM)\"" >> $@
300 @echo "#define HostPlatform_NAME \"$(HOSTPLATFORM)\"" >> $@
301 @echo "#define TargetPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
303 @echo "#define $(BuildPlatform_CPP)_BUILD 1" >> $@
304 @echo "#define $(HostPlatform_CPP)_HOST 1" >> $@
305 @echo "#define $(TargetPlatform_CPP)_TARGET 1" >> $@
307 @echo "#define $(BuildArch_CPP)_BUILD_ARCH 1" >> $@
308 @echo "#define $(HostArch_CPP)_HOST_ARCH 1" >> $@
309 @echo "#define $(TargetArch_CPP)_TARGET_ARCH 1" >> $@
310 @echo "#define BUILD_ARCH \"$(BuildArch_CPP)\"" >> $@
311 @echo "#define HOST_ARCH \"$(HostArch_CPP)\"" >> $@
312 @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
314 @echo "#define $(BuildOS_CPP)_BUILD_OS 1" >> $@
315 @echo "#define $(HostOS_CPP)_HOST_OS 1" >> $@
316 @echo "#define $(TargetOS_CPP)_TARGET_OS 1" >> $@
317 @echo "#define BUILD_OS \"$(BuildOS_CPP)\"" >> $@
318 @echo "#define HOST_OS \"$(HostOS_CPP)\"" >> $@
319 @echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@
320 ifeq "$(HostOS_CPP)" "irix"
321 @echo "#ifndef $(IRIX_MAJOR)_TARGET_OS " >> $@
322 @echo "#define $(IRIX_MAJOR)_TARGET_OS 1" >> $@
323 @echo "#endif " >> $@
326 @echo "#define $(BuildVendor_CPP)_BUILD_VENDOR 1" >> $@
327 @echo "#define $(HostVendor_CPP)_HOST_VENDOR 1" >> $@
328 @echo "#define $(TargetVendor_CPP)_TARGET_VENDOR 1" >> $@
329 @echo "#define BUILD_VENDOR \"$(BuildVendor_CPP)\"" >> $@
330 @echo "#define HOST_VENDOR \"$(HostVendor_CPP)\"" >> $@
331 @echo "#define TARGET_VENDOR \"$(TargetVendor_CPP)\"" >> $@
333 @echo "#endif /* __PLATFORM_H__ */" >> $@
336 # For stage2 and above, the BUILD platform is the HOST of stage1, and
337 # the HOST platform is the TARGET of stage1. The TARGET remains the same
338 # (stage1 is the cross-compiler, not stage2).
339 stage2/$(PLATFORM_H) : stage_dirs $(FPTOOLS_TOP)/mk/config.mk
340 @echo "Creating $@..."
342 @echo "#ifndef __PLATFORM_H__" >$@
343 @echo "#define __PLATFORM_H__" >>$@
345 @echo "#define BuildPlatform_NAME \"$(HOSTPLATFORM)\"" >> $@
346 @echo "#define HostPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
347 @echo "#define TargetPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
349 @echo "#define $(HostPlatform_CPP)_BUILD 1" >> $@
350 @echo "#define $(TargetPlatform_CPP)_HOST 1" >> $@
351 @echo "#define $(TargetPlatform_CPP)_TARGET 1" >> $@
353 @echo "#define $(HostArch_CPP)_BUILD_ARCH 1" >> $@
354 @echo "#define $(TargetArch_CPP)_HOST_ARCH 1" >> $@
355 @echo "#define $(TargetArch_CPP)_TARGET_ARCH 1" >> $@
356 @echo "#define BUILD_ARCH \"$(HostArch_CPP)\"" >> $@
357 @echo "#define HOST_ARCH \"$(TargetArch_CPP)\"" >> $@
358 @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
360 @echo "#define $(HostOS_CPP)_BUILD_OS 1" >> $@
361 @echo "#define $(TargetOS_CPP)_HOST_OS 1" >> $@
362 @echo "#define $(TargetOS_CPP)_TARGET_OS 1" >> $@
363 @echo "#define BUILD_OS \"$(HostOS_CPP)\"" >> $@
364 @echo "#define HOST_OS \"$(TargetOS_CPP)\"" >> $@
365 @echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@
366 ifeq "$(HostOS_CPP)" "irix"
367 @echo "#ifndef $(IRIX_MAJOR)_TARGET_OS " >> $@
368 @echo "#define $(IRIX_MAJOR)_TARGET_OS 1" >> $@
369 @echo "#endif " >> $@
372 @echo "#define $(HostVendor_CPP)_BUILD_VENDOR 1" >> $@
373 @echo "#define $(TargetVendor_CPP)_HOST_VENDOR 1" >> $@
374 @echo "#define $(TargetVendor_CPP)_TARGET_VENDOR 1" >> $@
375 @echo "#define BUILD_VENDOR \"$(HostVendor_CPP)\"" >> $@
376 @echo "#define HOST_VENDOR \"$(TargetVendor_CPP)\"" >> $@
377 @echo "#define TARGET_VENDOR \"$(TargetVendor_CPP)\"" >> $@
379 @echo "#endif /* __PLATFORM_H__ */" >> $@
382 stage3/$(PLATFORM_H) : stage_dirs stage2/$(PLATFORM_H)
383 $(CP) stage2/$(PLATFORM_H) stage3/$(PLATFORM_H)
385 STAGE_PLATFORM_H = stage$(stage)/$(PLATFORM_H)
387 boot :: $(STAGE_PLATFORM_H)
389 SRC_HC_OPTS += -Istage$(stage)
391 # -----------------------------------------------------------------------------
394 # First figure out ALL_DIRS, the source sub-directories
397 utils basicTypes types hsSyn prelude rename typecheck deSugar coreSyn \
398 vectorise specialise simplCore stranal stgSyn simplStg codeGen main \
399 profiling parser cprAnalysis iface cmm
401 # Make sure we include Config.hs even if it doesn't exist yet...
402 ALL_SRCS += $(CONFIG_HS)
404 # HsGeneric.hs is not used just now
405 EXCLUDED_SRCS += hsSyn/HsGeneric.hs
407 ifeq ($(GhcWithNativeCodeGen),YES)
408 ALL_DIRS += nativeGen
410 SRC_HC_OPTS += -DOMIT_NATIVE_CODEGEN
413 ifeq "$(BootingFromHc)" "YES"
414 # HC files are always from a self-booted compiler
417 ifneq "$(findstring $(stage), 2 3)" ""
424 # Beyond stage 1, honour any Mac OS X depolyment target options. If we use
425 # these options in stage 1 we get a linker error if the bootstrap compiler is
426 # for a more recent OS version
427 ifneq "$(findstring $(stage), 2 3)" ""
428 SRC_CC_OPTS += $(MACOSX_DEPLOYMENT_CC_OPTS)
429 SRC_HC_OPTS += $(addprefix -optc, $(MACOSX_DEPLOYMENT_CC_OPTS))
430 SRC_LD_OPTS += $(addprefix -optl, $(MACOSX_DEPLOYMENT_LD_OPTS))
433 # -----------------------------------------------------------------------------
434 # Building a compiler with interpreter support
436 # The interpreter, GHCi interface, Template Haskell and Hpc are only
437 # enabled when we are bootstrapping with the same version of GHC, and
438 # the interpreter is supported on this platform.
440 ifeq "$(bootstrapped)" "YES"
441 SRC_HC_OPTS += -package bytestring
442 PKG_DEPENDS += bytestring
445 SRC_HC_OPTS += -package hpc
448 ifeq "$(GhcWithInterpreter) $(bootstrapped)" "YES YES"
450 # Yes, include the interepreter and Template Haskell extensions
451 SRC_HC_OPTS += -DGHCI -package template-haskell
452 PKG_DEPENDS += template-haskell
454 # Should GHCI be building info tables in the TABLES_NEXT_TO_CODE style
456 ifeq "$(GhcEnableTablesNextToCode) $(GhcUnregisterised)" "YES NO"
457 SRC_HC_OPTS += -DGHCI_TABLES_NEXT_TO_CODE
460 ifeq "$(GhcThreaded)" "YES"
461 # Use threaded RTS with GHCi, so threads don't get blocked at the prompt.
462 SRC_LD_OPTS += -threaded
464 ifeq "$(GhcProfiled)" "YES"
467 ifeq "$(GhcDebugged)" "YES"
468 SRC_LD_OPTS += -debug
471 SRC_HC_OPTS += -I$(FPTOOLS_TOP)/libffi/build/include
472 SRC_HSC2HS_OPTS += -I$(FPTOOLS_TOP)/libffi/build/include
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 editline if either:
487 # - we're building stage 1 and $(GhcHasEditline)="YES"
488 # - we're building stage 2/3, and we have built the editline package
490 # But we don't enable editline on Windows, as Windows terminals have
491 # editline-like support builtin.
493 ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
495 ifeq "$(GhcHasEditline)" "YES"
496 SRC_HC_OPTS += -package editline -DUSE_EDITLINE
497 PKG_DEPENDS += editline
500 ifeq "$(wildcard $(FPTOOLS_TOP_ABS)/libraries/editline/unbuildable)" ""
501 SRC_HC_OPTS += -package editline -DUSE_EDITLINE
502 PKG_DEPENDS += editline
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
529 SRC_HC_OPTS += -cpp -fglasgow-exts -Rghc-timing -I. -Iparser -Iutil
531 ifeq "$(ghc_ge_609)" "NO"
532 SRC_HC_OPTS += -fno-generics
534 SRC_HC_OPTS += -XNoGenerics
537 # Omitted: -I$(GHC_INCLUDE_DIR)
538 # We should have -I$(GHC_INCLUDE_DIR) in SRC_HC_OPTS,
539 # to avoid the use of an explicit path in GHC source files
540 # (include "../includes/config.h"
541 # But alas GHC 4.08 (and others for all I know) uses this very
542 # same include path when compiling the .hc files it generates.
543 # Disaster! Then the hc file sees the GHC 5.02 (or whatever)
544 # include files. For the moment we've reverted to using
545 # an explicit path in the .hs sources
547 # We need System.Posix (or Posix when ghc < 6.2)
548 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
549 ifeq "$(bootstrapped)" "YES"
550 SRC_HC_OPTS += -package Win32
554 SRC_HC_OPTS += -package unix
558 SRC_HC_OPTS += -package Cabal
561 # Ignore lang, to avoid potential clash with the Generics module if
562 # lang happens to be a dependency of some exposed package in the local
563 # GHC installation (eg. wxHaskell did this around 6.4).
564 SRC_HC_OPTS += -ignore-package lang
566 SRC_CC_OPTS += -Iparser -I. -O
567 SRC_HC_OPTS += $(GhcHcOpts) $(GhcStage$(stage)HcOpts)
570 ifeq "$(BootingFromHc)" "YES"
571 SRC_CC_OPTS += -D__GLASGOW_HASKELL__=$(ProjectVersionInt)
574 # ---- Profiling ----
575 #simplCore/Simplify_HC_OPTS = -auto-all
576 #simplCore/SimplEnv_HC_OPTS = -auto-all
577 #simplCore/SimplUtils_HC_OPTS = -auto-all
579 # CSE interacts badly with top-level IORefs (reportedly in DriverState and
580 # DriverMkDepend), causing some of them to be commoned up. We have a fix for
581 # this in 5.00+, but earlier versions of the compiler will need CSE turned off.
582 # To be on the safe side, we disable CSE in *all* modules with top-level IORefs.
583 ghci/InteractiveUI_HC_OPTS = -fno-cse
584 main/CmdLineOpts_HC_OPTS = -fno-cse
585 main/DriverMkDepend_HC_OPTS = -fno-cse
586 main/DriverPipeline_HC_OPTS = -fno-cse
587 main/Finder_HC_OPTS = -fno-cse
588 main/SysTools_HC_OPTS = -fno-cse
589 main/StaticFlags_HC_OPTS = -fno-cse
591 # The #include is vital for the via-C route, else the C
592 # compiler doesn't realise that the stcall foreign imports are indeed
593 # stdcall, and doesn't generate the Foo@8 name for them
594 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
595 main/SysTools_HC_OPTS += '-\#include <windows.h>' '-\#include <process.h>'
598 # ghc_strlen percolates through so many modules that it is easier to get its
599 # prototype via a global option instead of a myriad of per-file OPTIONS
600 SRC_HC_OPTS += '-\#include "cutils.h"'
602 ifeq "$(ghc_ge_605)" "NO"
603 utils/LazyUniqFM_HC_OPTS += -fallow-undecidable-instances
606 # ----------------------------------------------------------------------------
607 # Generate supporting stuff for prelude/PrimOp.lhs
608 # from prelude/primops.txt
610 PRIMOP_BITS=primop-data-decl.hs-incl \
612 primop-list.hs-incl \
613 primop-has-side-effects.hs-incl \
614 primop-out-of-line.hs-incl \
615 primop-commutable.hs-incl \
616 primop-needs-wrapper.hs-incl \
617 primop-can-fail.hs-incl \
618 primop-strictness.hs-incl \
619 primop-primop-info.hs-incl
621 CLEAN_FILES += prelude/primops.txt
622 CLEAN_FILES += $(PRIMOP_BITS)
624 SRC_CPP_OPTS += -I$(GHC_INCLUDE_DIR)
625 SRC_CPP_OPTS += ${GhcCppOpts}
627 ifneq "$(BootingFromHc)" "YES"
628 prelude/PrimOp.lhs $(odir)/prelude/PrimOp.o: $(PRIMOP_BITS)
631 ifneq "$(BootingFromHc)" "YES"
632 depend :: $(PRIMOP_BITS)
635 # This is an ugly hack: we need stage1/$(PLATFORM_H) built before we
636 # preprocess primops.txt.pp, but we don't want to just add that
637 # dependency because we don't want $(PLATFORM_H) built during normal
638 # operations, because we don't have have dependencies from the .hs
639 # sources on it, and we don't want those dependencies because that
640 # would cause everything to be rebuilt every time the Makefile
641 # changed. So here we add the required dependency only when making
643 ifneq "$(findstring boot, $(MAKECMDGOALS))$(findstring depend, $(MAKECMDGOALS))" ""
644 prelude/primops.txt.pp : stage1/$(PLATFORM_H)
647 primop-data-decl.hs-incl: prelude/primops.txt
648 $(GENPRIMOP) --data-decl < $< > $@
649 primop-tag.hs-incl: prelude/primops.txt
650 $(GENPRIMOP) --primop-tag < $< > $@
651 primop-list.hs-incl: prelude/primops.txt
652 $(GENPRIMOP) --primop-list < $< > $@
653 primop-has-side-effects.hs-incl: prelude/primops.txt
654 $(GENPRIMOP) --has-side-effects < $< > $@
655 primop-out-of-line.hs-incl: prelude/primops.txt
656 $(GENPRIMOP) --out-of-line < $< > $@
657 primop-commutable.hs-incl: prelude/primops.txt
658 $(GENPRIMOP) --commutable < $< > $@
659 primop-needs-wrapper.hs-incl: prelude/primops.txt
660 $(GENPRIMOP) --needs-wrapper < $< > $@
661 primop-can-fail.hs-incl: prelude/primops.txt
662 $(GENPRIMOP) --can-fail < $< > $@
663 primop-strictness.hs-incl: prelude/primops.txt
664 $(GENPRIMOP) --strictness < $< > $@
665 primop-primop-info.hs-incl: prelude/primops.txt
666 $(GENPRIMOP) --primop-primop-info < $< > $@
668 # Usages aren't used any more; but the generator
669 # can still generate them if we want them back
670 primop-usage.hs-incl: prelude/primops.txt
671 $(GENPRIMOP) --usage < $< > $@
674 #-----------------------------------------------------------------------------
677 ifeq "$(GhcUnregisterised)" "NO"
678 ifeq "$(HOSTPLATFORM)" "ia64-unknown-linux"
679 # needed for generating proper relocation in large binaries: trac #856
680 SRC_LD_OPTS += -optl-Wl,--relax
684 # -----------------------------------------------------------------------------
685 # create ghc-inplace, a convenient way to run ghc from the build tree...
686 # See comments in $(FPTOOLS_TOP)/utils/ghc-pkg/Makefile for why we use
687 # a real binary here rather than a shell script.
689 INPLACE_SRC = $(odir)/ghc-inplace.c
690 INPLACE_PROG = $(odir)/ghc-inplace$(_way)$(exeext)
691 INPLACE_EXTRA_FLAGS = -I$(TOP)/includes
692 EXCLUDED_C_SRCS += ghc-inplace.c
694 CLEAN_FILES += $(INPLACE_SRC)
696 GHC_PATH=$(FPTOOLS_TOP_ABS)/$(GHC_COMPILER_DIR_REL)/$(GHC_PROG)$(exeext)
698 $(INPLACE_PROG): ghc-inplace.c
699 $(SED) -e "s@GHC_PATH@$(GHC_PATH)@g" -e "s@TOP_ABS@$(FPTOOLS_TOP_ABS)@g" < $< > $(INPLACE_SRC)
700 $(HC) -cpp $(INPLACE_EXTRA_FLAGS) $(INPLACE_SRC) -o $@
702 all :: $(INPLACE_PROG)
704 CLEAN_FILES += $(INPLACE_PROG)
707 ghc-inplace : $(INPLACE_PROG)
708 $(RM) -f $@ && $(LN_S) $< $@
712 CLEAN_FILES += ghc-inplace
715 #-----------------------------------------------------------------------------
718 # We don't want ghc treated as an ordinary executable,
719 # but put it together with the libraries.
720 # Also don't want any interface files installed
722 DESTDIR = $(INSTALL_LIBRARY_DIR_GHC)
724 ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
725 INSTALL_LIBEXECS += $(GHC_PROG)
727 INSTALL_PROGS += $(GHC_PROG)
730 # ----------------------------------------------------------------------------
733 # rename/RnBinds_HC_OPTS += -auto-all
734 # rename/RnEnv_HC_OPTS += -auto-all
735 # rename/RnExpr_HC_OPTS += -auto-all
736 # rename/RnHiFiles_HC_OPTS += -auto-all
737 # rename/RnHsSyn_HC_OPTS += -auto-all
738 # rename/Rename_HC_OPTS += -auto-all
739 # rename/RnIfaces_HC_OPTS += -auto-all
740 # rename/RnNames_HC_OPTS += -auto-all
741 # rename/RnSource_HC_OPTS += -auto-all
742 # rename/RnTypes_HC_OPTS += -auto-all
744 # typecheck/Inst_HC_OPTS += -auto-all
745 # typecheck/TcBinds_HC_OPTS += -auto-all
746 # typecheck/TcClassDcl_HC_OPTS += -auto-all
747 # typecheck/TcDefaults_HC_OPTS += -auto-all
748 # typecheck/TcDeriv_HC_OPTS += -auto-all
749 # typecheck/TcEnv_HC_OPTS += -auto-all
750 # typecheck/TcExpr_HC_OPTS += -auto-all
751 # typecheck/TcForeign_HC_OPTS += -auto-all
752 # typecheck/TcGenDeriv_HC_OPTS += -auto-all
753 # typecheck/TcHsSyn_HC_OPTS += -auto-all
754 # typecheck/TcIfaceSig_HC_OPTS += -auto-all
755 # typecheck/TcInstDcls_HC_OPTS += -auto-all
756 # typecheck/TcMatches_HC_OPTS += -auto-all
757 # typecheck/TcMonoType_HC_OPTS += -auto-all
758 # typecheck/TcMType_HC_OPTS += -auto-all
759 # typecheck/TcPat_HC_OPTS += -auto-all
760 # typecheck/TcRnDriver_HC_OPTS += -auto-all
761 # #typecheck/TcRnMonad_HC_OPTS += -auto-all
762 # #typecheck/TcRnTypes_HC_OPTS += -auto-all
763 # typecheck/TcRules_HC_OPTS += -auto-all
764 # typecheck/TcSimplify_HC_OPTS += -auto-all
765 # typecheck/TcSplice_HC_OPTS += -auto-all
766 # typecheck/TcTyClsDecls_HC_OPTS += -auto-all
767 # typecheck/TcTyDecls_HC_OPTS += -auto-all
768 # typecheck/TcType_HC_OPTS += -auto-all
769 # typecheck/TcUnify_HC_OPTS += -auto-all
771 # coreSyn/CorePrep_HC_OPTS += -auto-all
773 #-----------------------------------------------------------------------------
774 # Building the GHC package
776 # The GHC package is made from the stage 2 build and later.
777 # Fortunately the package build system framework more or less does the
778 # right thing for us here.
780 ifneq "$(findstring $(stage), 2 3)" ""
781 BUILD_GHC_PACKAGE=YES
784 ifeq "$(BUILD_GHC_PACKAGE)" "YES"
786 HIERARCHICAL_LIB = NO
787 VERSION = $(ProjectVersion)
788 PKG_DEPENDS += base haskell98
789 LIB_LD_OPTS += $(foreach pkg,$(PKG_DEPENDS),-package $(pkg))
790 # We have to expand each package dependency with its version, which we
791 # can do by calling "ghc-pkg list $pkg --simple-output".
792 PACKAGE_CPP_OPTS += -DPKG_DEPENDS='$(foreach pkg,$(PKG_DEPENDS),$(shell $(GHC_PKG_INPLACE) latest --global $(pkg)))'
793 # We want to define STAGE to be like "2" in the Haskell code, so we need
794 # to quote the "s so that they don't get interpreted by the shell.
795 PACKAGE_CPP_OPTS += -DSTAGE='"$(stage)"'
797 # Omit Main from the library, the client will want to plug their own Main in
798 LIBOBJS = $(filter-out $(odir)/main/Main.$(way_)o $(odir)/parser/hschooks.$(way_)o, $(OBJS))
800 # disable splitting: it won't really help with GHC, and the specialised
801 # build system for compiler/ isn't set up to handle it.
804 # the package build system likes to set WAYS=$(GhcLibWays), but we don't
805 # really want to build the whole of GHC multiple ways... if you do,
806 # set GhcCompilerWays instead.
807 GhcLibWays = $(GhcCompilerWays)
809 # override $(GhcLibHcOpts): we want GhcStage2HcOpts to take precedence
812 ifeq "$(DOING_BIN_DIST)" "YES"
813 # This is derived from the sources when we are in a source tree, but we
814 # don't have any sources in a bindist, so we have to shortcut it
815 HS_IFACES := $(wildcard stage$(stage)/*/*.hi)
817 # override default definition of HS_IFACES so we can add $(odir)
818 HS_IFACES = $(addsuffix .$(way_)hi,$(basename $(HS_OBJS)))
821 # Haddock can't handle recursive modules currently, so we disable it for now.
822 override HADDOCK_DOCS = NO
824 # Tell package.mk not to set $(HC)
827 # The stage 2 GHC binary itself is built by compiling main/Main.hs
828 # (the same as used in stage 1) against the GHC package.
830 # This is done by compiling Main.hs separately and linking it with
831 # -package ghc. This is done using a separate Makefile, Makefile.ghcbin
832 # Why? See comments in Makefile.ghcbin
834 # The stage 2 and stage 3 package.conf.in files are different, because they
835 # point to either the stage2/ or stage3/ dirs in import-dirs. Hence before
836 # linking the ghc binary we must install the correct version of the package
837 # configuration. Yeuch... maybe one day this will all be done more cleanly.
838 STAMP_PKG_CONF = $(GHC_DRIVER_DIR)/stamp-pkg-conf-$(PACKAGE)
840 # Propagate standard targets to Makefile.ghcbin
841 docs runtests $(BOOT_TARGET) TAGS clean distclean mostlyclean maintainer-clean $(INSTALL_TARGET) $(INSTALL_DOCS_TARGET) html chm HxS ps dvi txt::
842 $(MAKE) -f Makefile.ghcbin $(MFLAGS) $@
845 #-----------------------------------------------------------------------------
848 MAINTAINER_CLEAN_FILES += parser/Parser.info main/ParsePkgConf.info
850 #-----------------------------------------------------------------------------
851 # Include target-rule boilerplate
853 # Don't use the default MKDEPENDHS stuff... we'll do our own, below
857 # Make doesn't work this out for itself, it seems
858 parser/Parser.y : parser/Parser.y.pp
859 EXTRA_SRCS += parser/Parser.y
862 #-----------------------------------------------------------------------------
863 # Source files for tags file generation
865 # We want to excluded derived sources, because they won't be in the source
866 # tree, which is where we are going to move the TAGS file to.a
868 TAGS_HS_SRCS = parser/Parser.y.pp $(filter-out $(DERIVED_SRCS) main/Config.hs parser/Parser.y, $(sort $(SRCS)))
870 WRONG_GHCTAGS_HS_SRCS = $(filter-out $(DERIVED_SRCS) main/Config.hs parser/Parser.y, $(sort $(SRCS)))
871 # above is wrong because of the following problem:
872 # module `main:DataCon' is defined in multiple files: basicTypes/DataCon.lhs
873 # basicTypes/DataCon.lhs-boot
875 GHCTAGS_HS_SRCS = $(HS_SRCS)
876 GHCTAGS_HC_OPTS = $(patsubst -i$(odir)/%, -i%, $(HC_OPTS))
877 GHCTAGS_HC_OPTS += -DSTAGE='"$(stage)"'
879 #------------------------------------------------------------
884 ghctags :: $(GHCTAGS_HS_SRCS) $(TAGS_C_SRCS)
885 @if [ "$(stage)" != 2 ]; then echo "Must use 'make stage=2 ghctags'"; exit 1; fi
888 @echo SOURCES ARE "$(GHCTAGS_HS_SRCS)"
889 : ifneq "$(GHCTAGS_HS_SRCS)" ""
890 @echo TIME TO ROCK AND ROLL
891 # $(GHCTAGS_INPLACE) -- $(MKDEPENDHS_OPTS) $(filter-out -split-objs, $(MKDEPENDHS_HC_OPTS)) -- $(GHCTAGS_HS_SRCS)
892 $(GHCTAGS_INPLACE) -- $(GHCTAGS_HC_OPTS) -- $(GHCTAGS_HS_SRCS)
894 ifneq "$(TAGS_C_SRCS)" ""
895 etags -a $(TAGS_C_SRCS)
897 @( 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?
899 include $(TOP)/mk/target.mk
901 ifeq "$(BUILD_GHC_PACKAGE)" "YES"
905 $(odir)/main/Config.$(way_)o: SRC_HC_OPTS+=-DSTAGE='"$(stage)"'
907 ifneq "$(findstring $(stage), 2 3)" ""
908 $(warning LIBRARY is $(LIBRARY))
910 ifneq "$(DOING_BIN_DIST)" "YES"
911 $(GHC_PROG) : $(LIBRARY) main/Main.hs
912 $(RM) package.conf.inplace
913 $(RM) $(STAMP_PKG_CONF)
914 $(MAKE) way="" $(STAMP_PKG_CONF)
915 $(MAKE) -f Makefile.ghcbin $(MFLAGS) HS_PROG=$(GHC_PROG) $@
920 #-----------------------------------------------------------------------------
924 $(INSTALL_DIR) $(BIN_DIST_DIR)/compiler
925 $(INSTALL_DIR) $(BIN_DIST_DIR)/compiler/stage$(stage)
926 echo "stage=$(stage)" > $(BIN_DIST_DIR)/compiler/Makefile
927 cat Makefile >> $(BIN_DIST_DIR)/compiler/Makefile
928 $(INSTALL_DATA) package.conf.in $(BIN_DIST_DIR)/compiler/
929 set -e; for d in stage$(stage)/*/; do $(INSTALL_DIR) $(BIN_DIST_DIR)/compiler/$$d; done
930 set -e; for f in $(HS_IFACES); do $(INSTALL_DATA) $$f $(BIN_DIST_DIR)/compiler/$$f; done
931 ifneq "$(INSTALL_LIBS)" ""
932 set -e; for f in $(INSTALL_LIBS); do $(INSTALL_DATA) $$f $(BIN_DIST_DIR)/compiler/$$f; done
934 ifneq "$(INSTALL_PROGS)" ""
935 set -e; for f in $(INSTALL_PROGS); do $(INSTALL_PROGRAM) $$f $(BIN_DIST_DIR)/compiler/$$f; done
937 ifneq "$(INSTALL_LIBEXECS)" ""
938 set -e; for f in $(INSTALL_LIBEXECS); do $(INSTALL_PROGRAM) $$f $(BIN_DIST_DIR)/compiler/$$f; done
941 # -----------------------------------------------------------------------------
942 # Explicit dependencies
944 # Some .hs files #include other source files, but since ghc -M doesn't spit out
945 # these dependencies we have to include them manually.
947 # We don't add dependencies on HsVersions.h, ghcautoconf.h, or ghc_boot_platform.h,
948 # because then modifying one of these files would force recompilation of everything,
949 # which is probably not what you want. However, it does mean you have to be
950 # careful to recompile stuff you need if you reconfigure or change HsVersions.h.
952 # Aargh, these don't work properly anyway, because GHC's recompilation checker
953 # just reports "compilation NOT required". Do we have to add -fforce-recomp for each
954 # of these .hs files? I haven't done anything about this yet.
956 $(odir)/codeGen/Bitmap.$(way_)o : ../includes/MachDeps.h
957 $(odir)/codeGen/CgCallConv.$(way_)o : ../includes/StgFun.h
958 $(odir)/codeGen/CgProf.$(way_)o : ../includes/MachDeps.h
959 $(odir)/codeGen/CgProf.$(way_)o : ../includes/Constants.h
960 $(odir)/codeGen/CgProf.$(way_)o : ../includes/DerivedConstants.h
961 $(odir)/codeGen/CgTicky.$(way_)o : ../includes/DerivedConstants.h
962 $(odir)/codeGen/ClosureInfo.$(way_)o : ../includes/MachDeps.h
963 $(odir)/codeGen/SMRep.$(way_)o : ../includes/MachDeps.h
964 $(odir)/codeGen/SMRep.$(way_)o : ../includes/ClosureTypes.h
965 $(odir)/ghci/ByteCodeAsm.$(way_)o : ../includes/Bytecodes.h
966 $(odir)/ghci/ByteCodeFFI.$(way_)o : nativeGen/NCG.h
967 $(odir)/ghci/ByteCodeInstr.$(way_)o : ../includes/MachDeps.h
968 $(odir)/ghci/ByteCodeItbls.$(way_)o : ../includes/ClosureTypes.h
969 $(odir)/ghci/ByteCodeItbls.$(way_)o : nativeGen/NCG.h
970 $(odir)/main/Constants.$(way_)o : ../includes/MachRegs.h
971 $(odir)/main/Constants.$(way_)o : ../includes/Constants.h
972 $(odir)/main/Constants.$(way_)o : ../includes/MachDeps.h
973 $(odir)/main/Constants.$(way_)o : ../includes/DerivedConstants.h
974 $(odir)/main/Constants.$(way_)o : ../includes/GHCConstants.h
975 $(odir)/nativeGen/AsmCodeGen.$(way_)o : nativeGen/NCG.h
976 $(odir)/nativeGen/MachCodeGen.$(way_)o : nativeGen/NCG.h
977 $(odir)/nativeGen/MachCodeGen.$(way_)o : ../includes/MachDeps.h
978 $(odir)/nativeGen/MachInstrs.$(way_)o : nativeGen/NCG.h
979 $(odir)/nativeGen/MachRegs.$(way_)o : nativeGen/NCG.h
980 $(odir)/nativeGen/MachRegs.$(way_)o : ../includes/MachRegs.h
981 $(odir)/nativeGen/PositionIndependentCode.$(way_)o : nativeGen/NCG.h
982 $(odir)/nativeGen/PprMach.$(way_)o : nativeGen/NCG.h
983 $(odir)/nativeGen/RegAllocInfo.$(way_)o : nativeGen/NCG.h
984 $(odir)/typecheck/TcForeign.$(way_)o : nativeGen/NCG.h
985 $(odir)/utils/Binary.$(way_)o : ../includes/MachDeps.h
986 $(odir)/utils/FastMutInt.$(way_)o : ../includes/MachDeps.h
988 # -----------------------------------------------------------------------------
991 MKDEPENDHS_HC_OPTS = $(patsubst -i$(odir)/%, -i%, $(HC_OPTS))
995 # Must do this *after* including target.mk, because $(HS_SRCS) isn't set yet.
996 depend :: $(STAGE_PLATFORM_H) $(HS_SRCS) $(C_SRCS)
998 ifneq "$(BootingFromHc)" "YES"
999 $(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)
1001 $(MKDEPENDC) -f .depend-BASE $(MKDEPENDC_OPTS) $(foreach way,$(WAYS),-s $(way)) -- $(CC_OPTS) -- $(C_SRCS)
1002 $(PERL) -pe 'binmode(stdin); binmode(stdout); s@(\S*[._]o)@stage$(stage)/$$1@g; s@(\S*[._]hi)@stage$(stage)/$$1@g;' <.depend-BASE >.depend-$(stage)
1003 # The binmode stuff tells perl not to add stupid ^M's to the output
1005 ifeq "$(MakefileDeps)" "YES"
1006 $(CONFIG_HS) : Makefile
1007 stage1/$(PLATFORM_H) : Makefile
1008 stage2/$(PLATFORM_H) : Makefile
1011 -include .depend-$(stage)