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 # XXX DQ is now the same on all platforms, so get rid of it
103 $(MKDIRHIER) stage$(stage)
104 for i in $(ALL_DIRS); do \
105 $(MKDIRHIER) stage$(stage)/$$i; \
111 ifneq "$(findstring $(stage), 2 3)" ""
119 # On Windows, we can't use symbolic links for the -hi-boot files
120 # because GHC itself is a Mingw program and does not understand
121 # symbolic links. So we have to copy the files instead of link them.
122 # That means that if you modify a .hi-boot file in Windows, you
123 # have to to say 'make boot' again.
125 # PS: 'ln -s foo baz' takes 'foo' relative to the path to 'baz'
126 # whereas 'cp foo baz' treats the two paths independently.
127 # Hence the "../.." in the ln command line
128 ifeq "$(UsingHsBoot)" "NO"
129 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
130 for i in */*hi-boot*; do \
131 cp -u -f $$i stage$(stage)/$$i; \
134 for i in */*hi-boot*; do \
135 ($(RM) -f stage$(stage)/$$i \
136 && $(LN_S) ../../$$i stage$(stage)/$$i) || true ; \
164 SRC_HC_OPTS += $(patsubst %, -i$(odir)/%, $(ALL_DIRS))
166 SRC_HC_OPTS += -Wall -fno-warn-name-shadowing
167 # Turn off orphan warnings, but only if the flag exists (i.e. not if we
168 # are building stage 1 and using GHC < 6.3).
169 ifneq "$(stage)" "1 NO"
170 SRC_HC_OPTS += -fno-warn-orphans
173 HS_OBJS = $(patsubst %, $(odir)/%, $(addsuffix .$(way_)o,$(basename $(HS_SRCS))))
174 C_OBJS = $(patsubst %, $(odir)/%, $(addsuffix .$(way_)o,$(basename $(C_SRCS))))
176 # Our standard cleaning rules don't know that we're doing our output
177 # into $(odir), so we have to augment CLEAN_FILES appropriateliy.
179 CLEAN_FILES += $(odir)/*/*.$(way_)hi $(odir)/*/*.$(way_)hi-boot $(odir)/*/*.$(way_)o-boot
181 ifeq "$(UsingHsBoot)" "YES"
182 CLEAN_FILES += $(odir)/*/*.hi-boot $(odir)/*/*.o-boot
186 mostlyclean clean distclean maintainer-clean ::
191 # -----------------------------------------------------------------------------
194 # Note: there have been reports of people running up against the ARG_MAX limit
195 # when linking ghc with all its constituent object files. The likely source of
196 # the problem is that the environment is a bit too big, so a workaround could
197 # be to do `env PATH=$(PATH) make ghc' to minimise the environment. (or the
198 # equivalent of `env' if it doesn't exist locally).
200 ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
201 GHC_PROG=$(odir)/ghc$(_way)-$(ProjectVersion)
203 GHC_PROG=$(odir)/ghc$(_way)
207 HS_PROG = $(GHC_PROG)
210 # -----------------------------------------------------------------------------
211 # Create compiler configuration
213 # The 'echo' commands simply spit the values of various make variables
214 # into Config.hs, whence they can be compiled and used by GHC itself
216 CONFIG_HS = main/Config.hs
219 $(CONFIG_HS) : $(FPTOOLS_TOP)/mk/config.mk
220 @$(RM) -f $(CONFIG_HS)
221 @echo "Creating $(CONFIG_HS) ... "
222 @echo "{-# OPTIONS -w #-}" >>$(CONFIG_HS)
223 @echo "module Config where" >>$(CONFIG_HS)
224 @echo "cProjectName :: String" >> $(CONFIG_HS)
225 @echo "cProjectName = \"$(ProjectName)\"" >> $(CONFIG_HS)
226 @echo "cProjectVersion :: String" >> $(CONFIG_HS)
227 @echo "cProjectVersion = \"$(ProjectVersion)\"" >> $(CONFIG_HS)
228 @echo "cProjectVersionInt :: String" >> $(CONFIG_HS)
229 @echo "cProjectVersionInt = \"$(ProjectVersionInt)\"" >> $(CONFIG_HS)
230 @echo "cProjectPatchLevel :: String" >> $(CONFIG_HS)
231 @echo "cProjectPatchLevel = \"$(ProjectPatchLevel)\"" >> $(CONFIG_HS)
232 @echo "cBooterVersion :: String" >> $(CONFIG_HS)
233 @echo "cBooterVersion = \"$(GhcVersion)\"" >> $(CONFIG_HS)
234 @echo "cStage :: String" >> $(CONFIG_HS)
235 @echo "cStage = STAGE" >> $(CONFIG_HS)
236 @echo "cHscIfaceFileVersion :: String" >> $(CONFIG_HS)
237 @echo "cHscIfaceFileVersion = \"$(HscIfaceFileVersion)\"" >> $(CONFIG_HS)
238 @echo "cSplitObjs :: String" >> $(CONFIG_HS)
239 @echo "cSplitObjs = \"$(SplitObjs)\"" >> $(CONFIG_HS)
240 @echo "cGhcWithInterpreter :: String" >> $(CONFIG_HS)
241 @echo "cGhcWithInterpreter = \"$(GhcWithInterpreter)\"" >> $(CONFIG_HS)
242 @echo "cGhcWithNativeCodeGen :: String" >> $(CONFIG_HS)
243 @echo "cGhcWithNativeCodeGen = \"$(GhcWithNativeCodeGen)\"" >> $(CONFIG_HS)
244 @echo "cGhcWithSMP :: String" >> $(CONFIG_HS)
245 @echo "cGhcWithSMP = \"$(GhcWithSMP)\"" >> $(CONFIG_HS)
246 @echo "cGhcRTSWays :: String" >> $(CONFIG_HS)
247 @echo "cGhcRTSWays = \"$(GhcRTSWays)\"" >> $(CONFIG_HS)
248 @echo "cGhcUnregisterised :: String" >> $(CONFIG_HS)
249 @echo "cGhcUnregisterised = \"$(GhcUnregisterised)\"" >> $(CONFIG_HS)
250 @echo "cGhcEnableTablesNextToCode :: String" >> $(CONFIG_HS)
251 @echo "cGhcEnableTablesNextToCode = \"$(GhcEnableTablesNextToCode)\"" >> $(CONFIG_HS)
252 @echo "cLeadingUnderscore :: String" >> $(CONFIG_HS)
253 @echo "cLeadingUnderscore = \"$(LeadingUnderscore)\"" >> $(CONFIG_HS)
254 @echo "cRAWCPP_FLAGS :: String" >> $(CONFIG_HS)
255 @echo "cRAWCPP_FLAGS = \"$(RAWCPP_FLAGS)\"" >> $(CONFIG_HS)
256 @echo "cGCC :: String" >> $(CONFIG_HS)
257 @echo "cGCC = \"$(WhatGccIsCalled)\"" >> $(CONFIG_HS)
258 @echo "cMKDLL :: String" >> $(CONFIG_HS)
259 @echo "cMKDLL = \"$(BLD_DLL)\"" >> $(CONFIG_HS)
260 @echo "cLdIsGNULd :: String" >> $(CONFIG_HS)
261 @echo "cLdIsGNULd = \"$(LdIsGNULd)\"" >> $(CONFIG_HS)
262 @echo "cLD_X :: String" >> $(CONFIG_HS)
263 @echo "cLD_X = \"$(LD_X)\"" >> $(CONFIG_HS)
264 @echo "cPROJECT_DIR :: String" >> $(CONFIG_HS)
265 @echo "cPROJECT_DIR = \"$(PROJECT_DIR)\"" >> $(CONFIG_HS)
266 @echo "cGHC_DRIVER_DIR_REL :: String" >> $(CONFIG_HS)
267 @echo "cGHC_DRIVER_DIR_REL = \"$(GHC_DRIVER_DIR_REL)\"" >> $(CONFIG_HS)
268 @echo "cGHC_TOUCHY_PGM :: String" >> $(CONFIG_HS)
269 @echo "cGHC_TOUCHY_PGM = \"$(GHC_TOUCHY_PGM)\"" >> $(CONFIG_HS)
270 @echo "cGHC_TOUCHY_DIR_REL :: String" >> $(CONFIG_HS)
271 @echo "cGHC_TOUCHY_DIR_REL = \"$(GHC_TOUCHY_DIR_REL)\"" >> $(CONFIG_HS)
272 @echo "cGHC_UNLIT_PGM :: String" >> $(CONFIG_HS)
273 @echo "cGHC_UNLIT_PGM = \"$(GHC_UNLIT_PGM)\"" >> $(CONFIG_HS)
274 @echo "cGHC_UNLIT_DIR_REL :: String" >> $(CONFIG_HS)
275 @echo "cGHC_UNLIT_DIR_REL = \"$(GHC_UNLIT_DIR_REL)\"" >> $(CONFIG_HS)
276 @echo "cGHC_MANGLER_PGM :: String" >> $(CONFIG_HS)
277 @echo "cGHC_MANGLER_PGM = \"$(GHC_MANGLER_PGM)\"" >> $(CONFIG_HS)
278 @echo "cGHC_MANGLER_DIR_REL :: String" >> $(CONFIG_HS)
279 @echo "cGHC_MANGLER_DIR_REL = \"$(GHC_MANGLER_DIR_REL)\"" >> $(CONFIG_HS)
280 @echo "cGHC_SPLIT_PGM :: String" >> $(CONFIG_HS)
281 @echo "cGHC_SPLIT_PGM = \"$(GHC_SPLIT_PGM)\"" >> $(CONFIG_HS)
282 @echo "cGHC_SPLIT_DIR_REL :: String" >> $(CONFIG_HS)
283 @echo "cGHC_SPLIT_DIR_REL = \"$(GHC_SPLIT_DIR_REL)\"" >> $(CONFIG_HS)
284 @echo "cGHC_SYSMAN_PGM :: String" >> $(CONFIG_HS)
285 @echo "cGHC_SYSMAN_PGM = \"$(GHC_SYSMAN)\"" >> $(CONFIG_HS)
286 @echo "cGHC_SYSMAN_DIR_REL :: String" >> $(CONFIG_HS)
287 @echo "cGHC_SYSMAN_DIR_REL = \"$(GHC_SYSMAN_DIR)\"" >> $(CONFIG_HS)
288 @echo "cGHC_CP :: String" >> $(CONFIG_HS)
289 @echo "cGHC_CP = \"$(GHC_CP)\"" >> $(CONFIG_HS)
290 @echo "cGHC_PERL :: String" >> $(CONFIG_HS)
291 @echo "cGHC_PERL = \"$(GHC_PERL)\"" >> $(CONFIG_HS)
292 ifeq ($(GhcWithIlx),YES)
293 @echo "cILX2IL :: String" >> $(CONFIG_HS)
294 @echo "cILX2IL = \"$(ILX2IL)\"" >> $(CONFIG_HS)
295 @echo "cILASM :: String" >> $(CONFIG_HS)
296 @echo "cILASM = \"$(ILASM)\"" >> $(CONFIG_HS)
298 @echo "cEnableWin32DLLs :: String" >> $(CONFIG_HS)
299 @echo "cEnableWin32DLLs = \"$(EnableWin32DLLs)\"" >> $(CONFIG_HS)
300 @echo "cCONTEXT_DIFF :: String" >> $(CONFIG_HS)
301 @echo "cCONTEXT_DIFF = \"$(CONTEXT_DIFF)\"" >> $(CONFIG_HS)
302 @echo "cUSER_WAY_NAMES :: String" >> $(CONFIG_HS)
303 @echo "cUSER_WAY_NAMES = \"$(USER_WAY_NAMES)\"" >> $(CONFIG_HS)
304 @echo "cUSER_WAY_OPTS :: String" >> $(CONFIG_HS)
305 @echo "cUSER_WAY_OPTS = \"$(USER_WAY_OPTS)\"" >> $(CONFIG_HS)
306 @echo "cDEFAULT_TMPDIR :: String" >> $(CONFIG_HS)
307 @echo "cDEFAULT_TMPDIR = \"$(DEFAULT_TMPDIR)\"" >> $(CONFIG_HS)
308 @echo "cRelocatableBuild :: Bool" >> $(CONFIG_HS)
309 ifeq "$(RelocatableBuild)" "YES"
310 @echo "cRelocatableBuild = True" >> $(CONFIG_HS)
312 @echo "cRelocatableBuild = False" >> $(CONFIG_HS)
314 @echo "cLibFFI :: Bool" >> $(CONFIG_HS)
315 ifeq "$(UseLibFFI)" "YES"
316 @echo "cLibFFI = True" >> $(CONFIG_HS)
318 @echo "cLibFFI = False" >> $(CONFIG_HS)
322 CLEAN_FILES += $(CONFIG_HS)
324 # -----------------------------------------------------------------------------
325 # Create platform includes
327 # Here we generate a little header file containing CPP symbols that GHC
328 # uses to determine which platform it is building on/for. The platforms
329 # can differ between stage1 and stage2 if we're cross-compiling, so we
330 # need one of these header files per stage.
332 PLATFORM_H = ghc_boot_platform.h
334 stage1/$(PLATFORM_H) : stage_dirs $(FPTOOLS_TOP)/mk/config.mk
335 @echo "Creating $@..."
337 @echo "#ifndef __PLATFORM_H__" >$@
338 @echo "#define __PLATFORM_H__" >>$@
340 @echo "#define BuildPlatform_NAME \"$(BUILDPLATFORM)\"" >> $@
341 @echo "#define HostPlatform_NAME \"$(HOSTPLATFORM)\"" >> $@
342 @echo "#define TargetPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
344 @echo "#define $(BuildPlatform_CPP)_BUILD 1" >> $@
345 @echo "#define $(HostPlatform_CPP)_HOST 1" >> $@
346 @echo "#define $(TargetPlatform_CPP)_TARGET 1" >> $@
348 @echo "#define $(BuildArch_CPP)_BUILD_ARCH 1" >> $@
349 @echo "#define $(HostArch_CPP)_HOST_ARCH 1" >> $@
350 @echo "#define $(TargetArch_CPP)_TARGET_ARCH 1" >> $@
351 @echo "#define BUILD_ARCH \"$(BuildArch_CPP)\"" >> $@
352 @echo "#define HOST_ARCH \"$(HostArch_CPP)\"" >> $@
353 @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
355 @echo "#define $(BuildOS_CPP)_BUILD_OS 1" >> $@
356 @echo "#define $(HostOS_CPP)_HOST_OS 1" >> $@
357 @echo "#define $(TargetOS_CPP)_TARGET_OS 1" >> $@
358 @echo "#define BUILD_OS \"$(BuildOS_CPP)\"" >> $@
359 @echo "#define HOST_OS \"$(HostOS_CPP)\"" >> $@
360 @echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@
361 ifeq "$(HostOS_CPP)" "irix"
362 @echo "#ifndef $(IRIX_MAJOR)_TARGET_OS " >> $@
363 @echo "#define $(IRIX_MAJOR)_TARGET_OS 1" >> $@
364 @echo "#endif " >> $@
367 @echo "#define $(BuildVendor_CPP)_BUILD_VENDOR 1" >> $@
368 @echo "#define $(HostVendor_CPP)_HOST_VENDOR 1" >> $@
369 @echo "#define $(TargetVendor_CPP)_TARGET_VENDOR 1" >> $@
370 @echo "#define BUILD_VENDOR \"$(BuildVendor_CPP)\"" >> $@
371 @echo "#define HOST_VENDOR \"$(HostVendor_CPP)\"" >> $@
372 @echo "#define TARGET_VENDOR \"$(TargetVendor_CPP)\"" >> $@
374 @echo "#endif /* __PLATFORM_H__ */" >> $@
377 # For stage2 and above, the BUILD platform is the HOST of stage1, and
378 # the HOST platform is the TARGET of stage1. The TARGET remains the same
379 # (stage1 is the cross-compiler, not stage2).
380 stage2/$(PLATFORM_H) : stage_dirs $(FPTOOLS_TOP)/mk/config.mk
381 @echo "Creating $@..."
383 @echo "#ifndef __PLATFORM_H__" >$@
384 @echo "#define __PLATFORM_H__" >>$@
386 @echo "#define BuildPlatform_NAME \"$(HOSTPLATFORM)\"" >> $@
387 @echo "#define HostPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
388 @echo "#define TargetPlatform_NAME \"$(TARGETPLATFORM)\"" >> $@
390 @echo "#define $(HostPlatform_CPP)_BUILD 1" >> $@
391 @echo "#define $(TargetPlatform_CPP)_HOST 1" >> $@
392 @echo "#define $(TargetPlatform_CPP)_TARGET 1" >> $@
394 @echo "#define $(HostArch_CPP)_BUILD_ARCH 1" >> $@
395 @echo "#define $(TargetArch_CPP)_HOST_ARCH 1" >> $@
396 @echo "#define $(TargetArch_CPP)_TARGET_ARCH 1" >> $@
397 @echo "#define BUILD_ARCH \"$(HostArch_CPP)\"" >> $@
398 @echo "#define HOST_ARCH \"$(TargetArch_CPP)\"" >> $@
399 @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
401 @echo "#define $(HostOS_CPP)_BUILD_OS 1" >> $@
402 @echo "#define $(TargetOS_CPP)_HOST_OS 1" >> $@
403 @echo "#define $(TargetOS_CPP)_TARGET_OS 1" >> $@
404 @echo "#define BUILD_OS \"$(HostOS_CPP)\"" >> $@
405 @echo "#define HOST_OS \"$(TargetOS_CPP)\"" >> $@
406 @echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@
407 ifeq "$(HostOS_CPP)" "irix"
408 @echo "#ifndef $(IRIX_MAJOR)_TARGET_OS " >> $@
409 @echo "#define $(IRIX_MAJOR)_TARGET_OS 1" >> $@
410 @echo "#endif " >> $@
413 @echo "#define $(HostVendor_CPP)_BUILD_VENDOR 1" >> $@
414 @echo "#define $(TargetVendor_CPP)_HOST_VENDOR 1" >> $@
415 @echo "#define $(TargetVendor_CPP)_TARGET_VENDOR 1" >> $@
416 @echo "#define BUILD_VENDOR \"$(HostVendor_CPP)\"" >> $@
417 @echo "#define HOST_VENDOR \"$(TargetVendor_CPP)\"" >> $@
418 @echo "#define TARGET_VENDOR \"$(TargetVendor_CPP)\"" >> $@
420 @echo "#endif /* __PLATFORM_H__ */" >> $@
423 stage3/$(PLATFORM_H) : stage_dirs stage2/$(PLATFORM_H)
424 $(CP) stage2/$(PLATFORM_H) stage3/$(PLATFORM_H)
426 STAGE_PLATFORM_H = stage$(stage)/$(PLATFORM_H)
428 boot :: $(STAGE_PLATFORM_H)
430 SRC_HC_OPTS += -Istage$(stage)
432 # -----------------------------------------------------------------------------
435 # First figure out ALL_DIRS, the source sub-directories
438 utils basicTypes types hsSyn prelude rename typecheck deSugar coreSyn \
439 vectorise specialise simplCore stranal stgSyn simplStg codeGen main \
440 profiling parser cprAnalysis ndpFlatten iface cmm
442 # Make sure we include Config.hs even if it doesn't exist yet...
443 ALL_SRCS += $(CONFIG_HS)
445 # HsGeneric.hs is not used just now
446 EXCLUDED_SRCS += hsSyn/HsGeneric.hs
448 ifeq ($(GhcWithNativeCodeGen),YES)
449 ALL_DIRS += nativeGen
451 SRC_HC_OPTS += -DOMIT_NATIVE_CODEGEN
454 ifeq ($(GhcWithIlx),YES)
459 ifeq ($(GhcWithJavaGen),YES)
461 SRC_HC_OPTS += -DJAVA
464 ifeq ($(UseLibFFI),YES)
465 SRC_HC_OPTS += -DUSE_LIBFFI
466 SRC_HSC2HS_OPTS += -DUSE_LIBFFI
469 ifeq "$(BootingFromHc)" "YES"
470 # HC files are always from a self-booted compiler
473 ifneq "$(findstring $(stage), 2 3)" ""
480 # -----------------------------------------------------------------------------
481 # Building a compiler with interpreter support
483 # The interpreter, GHCi interface, Template Haskell and Hpc are only
484 # enabled when we are bootstrapping with the same version of GHC, and
485 # the interpreter is supported on this platform.
487 ifeq "$(bootstrapped)" "YES"
488 SRC_HC_OPTS += -package hpc -package bytestring
489 PKG_DEPENDS += hpc bytestring
492 ifeq "$(GhcWithInterpreter) $(bootstrapped)" "YES YES"
494 # Yes, include the interepreter and Template Haskell extensions
495 SRC_HC_OPTS += -DGHCI -package template-haskell
496 PKG_DEPENDS += template-haskell
498 # Should GHCI be building info tables in the TABLES_NEXT_TO_CODE style
500 ifeq "$(GhcEnableTablesNextToCode) $(GhcUnregisterised)" "YES NO"
501 SRC_HC_OPTS += -DGHCI_TABLES_NEXT_TO_CODE
504 ifeq "$(GhcThreaded)" "YES"
505 # Use threaded RTS with GHCi, so threads don't get blocked at the prompt.
506 SRC_LD_OPTS += -threaded
508 ifeq "$(GhcProfiled)" "YES"
511 ifeq "$(GhcDebugged)" "YES"
512 SRC_LD_OPTS += -debug
517 # If we are going to use dynamic libraries instead of .o files for ghci,
518 # we will need to always retain CAFs in the compiler.
519 # ghci/keepCAFsForGHCi contains a GNU C __attribute__((constructor))
520 # function which sets the keepCAFs flag for the RTS before any Haskell
522 ifeq "$(GhcBuildDylibs)" "YES"
524 EXCLUDED_SRCS += ghci/keepCAFsForGHCi.c
527 # Enable readline if either:
528 # - we're building stage 1 and $(GhcHasReadline)="YES"
529 # - we're building stage 2/3, and we have built the readline package
531 # But we don't enable readline on Windows, because readline is fairly
534 ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
536 ifeq "$(GhcHasReadline)" "YES"
537 SRC_HC_OPTS += -package readline -DUSE_READLINE
538 PKG_DEPENDS += readline
541 ifeq "$(wildcard $(FPTOOLS_TOP_ABS)/libraries/readline/unbuildable)" ""
542 SRC_HC_OPTS += -package readline -DUSE_READLINE
543 PKG_DEPENDS += readline
550 # No interpreter, so exclude Template Haskell modules
551 EXCLUDED_SRCS += deSugar/DsMeta.hs typecheck/TcSplice.lhs hsSyn/Convert.lhs
553 endif # bootstrapped with interpreter
555 # -----------------------------------------------
558 # Big Fudge to get around inherent problem that Makefile setup
559 # has got with 'mkdependC'.
561 SRC_MKDEPENDC_OPTS += -D__GLASGOW_HASKELL__=$(ProjectVersionInt)
563 # XXX not really correct, hschooks.c actually gets include files like
564 # RtsFlags.c from the installed GHC, but we can't tell mkdependC about that.
565 SRC_MKDEPENDC_OPTS += -I$(GHC_INCLUDE_DIR)
567 # -----------------------------------------------------------------------------
568 # Haskell compilations
571 -cpp -fglasgow-exts -fno-generics -Rghc-timing \
574 # Omitted: -I$(GHC_INCLUDE_DIR)
575 # We should have -I$(GHC_INCLUDE_DIR) in SRC_HC_OPTS,
576 # to avoid the use of an explicit path in GHC source files
577 # (include "../includes/config.h"
578 # But alas GHC 4.08 (and others for all I know) uses this very
579 # same include path when compiling the .hc files it generates.
580 # Disaster! Then the hc file sees the GHC 5.02 (or whatever)
581 # include files. For the moment we've reverted to using
582 # an explicit path in the .hs sources
584 # For the benefit of <5.00 compilers, do include GHC_INCLUDE_DIR
585 # when generating dependencies. (=> it gets passed onto mkdependHS,
587 SRC_MKDEPENDHS_OPTS += -I$(GHC_INCLUDE_DIR)
589 # We need System.Posix (or Posix when ghc < 6.2)
590 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
591 ifeq "$(bootstrapped)" "YES"
592 SRC_HC_OPTS += -package Win32
596 ifeq "$(bootstrapped) $(ghc_ge_601)" "NO NO"
597 SRC_HC_OPTS += -package posix
599 SRC_HC_OPTS += -package unix
604 # We use the Cabal package in stages 2/3 only; in stage 1 we're using
605 # the libcompat library which provides the Cabal modules.
607 SRC_HC_OPTS += -package Cabal
611 # Ignore lang, to avoid potential clash with the Generics module if
612 # lang happens to be a dependency of some exposed package in the local
613 # GHC installation (eg. wxHaskell did this around 6.4).
614 SRC_HC_OPTS += -ignore-package lang
616 SRC_CC_OPTS += -Iparser -I. -O
617 SRC_HC_OPTS += -recomp $(GhcHcOpts) $(GhcStage$(stage)HcOpts)
620 ifeq "$(BootingFromHc)" "YES"
621 SRC_CC_OPTS += -D__GLASGOW_HASKELL__=$(ProjectVersionInt)
624 # Special flags for particular modules
625 # The standard suffix rule for compiling a Haskell file
626 # adds these flags to the command line
628 # There used to be a -no-recomp flag on PrimOp, but why?
629 # It's an expensive module to recompile!
630 prelude/PrimOp_HC_OPTS = -H80m
633 main/ParsePkgConf_HC_OPTS += -fno-warn-incomplete-patterns
634 parser/Parser_HC_OPTS += -fno-warn-incomplete-patterns
636 # Careful optimisation of the parser: we don't want to throw everything
637 # at it, because that takes too long and doesn't buy much, but we do want
638 # to inline certain key external functions, so we instruct GHC not to
639 # throw away inlinings as it would normally do in -Onot mode:
640 parser/Parser_HC_OPTS += -Onot -fno-ignore-interface-pragmas
642 ifeq "$(HOSTPLATFORM)" "hppa1.1-hp-hpux9"
643 rename/RnMonad_HC_OPTS = -O2 -O2-for-C
646 utils/Digraph_HC_OPTS = -fglasgow-exts
648 # basicTypes/SrcLoc_HC_OPTS = -funbox-strict-fields
650 # We always optimise some low-level modules, otherwise performance of
651 # a non-optimised compiler is severely affected.
652 main/BinIface_HC_OPTS += -O
653 utils/Binary_HC_OPTS += -O -funbox-strict-fields
654 utils/FastMutInt_HC_OPTS += -O
655 utils/Encoding_HC_OPTS += -O
656 utils/StringBuffer_HC_OPTS += -O -funbox-strict-fields
657 utils/FastString_HC_OPTS += -O -funbox-strict-fields
659 # ---- Profiling ----
660 #simplCore/Simplify_HC_OPTS = -auto-all
661 #simplCore/SimplEnv_HC_OPTS = -auto-all
662 #simplCore/SimplUtils_HC_OPTS = -auto-all
664 # CSE interacts badly with top-level IORefs (reportedly in DriverState and
665 # DriverMkDepend), causing some of them to be commoned up. We have a fix for
666 # this in 5.00+, but earlier versions of the compiler will need CSE turned off.
667 # To be on the safe side, we disable CSE in *all* modules with top-level IORefs.
668 ghci/InteractiveUI_HC_OPTS = -fno-cse
669 main/CmdLineOpts_HC_OPTS = -fno-cse
670 main/DriverMkDepend_HC_OPTS = -fno-cse
671 main/DriverPipeline_HC_OPTS = -fno-cse
672 main/Finder_HC_OPTS = -fno-cse
673 main/SysTools_HC_OPTS = -fno-cse
674 main/StaticFlags_HC_OPTS = -fno-cse
676 # The #include is vital for the via-C route, else the C
677 # compiler doesn't realise that the stcall foreign imports are indeed
678 # stdcall, and doesn't generate the Foo@8 name for them
679 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
680 main/SysTools_HC_OPTS += '-\#include <windows.h>' '-\#include <process.h>'
683 parser/Lexer_HC_OPTS += -funbox-strict-fields
685 # ghc_strlen percolates through so many modules that it is easier to get its
686 # prototype via a global option instead of a myriad of per-file OPTIONS
687 SRC_HC_OPTS += '-\#include "cutils.h"'
689 # ----------------------------------------------------------------------------
690 # Generate supporting stuff for prelude/PrimOp.lhs
691 # from prelude/primops.txt
693 PRIMOP_BITS=primop-data-decl.hs-incl \
695 primop-list.hs-incl \
696 primop-has-side-effects.hs-incl \
697 primop-out-of-line.hs-incl \
698 primop-commutable.hs-incl \
699 primop-needs-wrapper.hs-incl \
700 primop-can-fail.hs-incl \
701 primop-strictness.hs-incl \
702 primop-primop-info.hs-incl
704 CLEAN_FILES += prelude/primops.txt
705 CLEAN_FILES += $(PRIMOP_BITS)
707 SRC_CPP_OPTS += -I$(GHC_INCLUDE_DIR)
708 SRC_CPP_OPTS += ${GhcCppOpts}
710 ifneq "$(BootingFromHc)" "YES"
711 prelude/PrimOp.lhs $(odir)/prelude/PrimOp.o: $(PRIMOP_BITS)
714 ifneq "$(BootingFromHc)" "YES"
715 depend :: $(PRIMOP_BITS)
718 # This is an ugly hack: we need stage1/$(PLATFORM_H) built before we
719 # preprocess primops.txt.pp, but we don't want to just add that
720 # dependency because we don't want $(PLATFORM_H) built during normal
721 # operations, because we don't have have dependencies from the .hs
722 # sources on it, and we don't want those dependencies because that
723 # would cause everything to be rebuilt every time the Makefile
724 # changed. So here we add the required dependency only when making
726 ifneq "$(findstring boot, $(MAKECMDGOALS))$(findstring depend, $(MAKECMDGOALS))" ""
727 prelude/primops.txt.pp : stage1/$(PLATFORM_H)
730 primop-data-decl.hs-incl: prelude/primops.txt
731 $(GENPRIMOP) --data-decl < $< > $@
732 primop-tag.hs-incl: prelude/primops.txt
733 $(GENPRIMOP) --primop-tag < $< > $@
734 primop-list.hs-incl: prelude/primops.txt
735 $(GENPRIMOP) --primop-list < $< > $@
736 primop-has-side-effects.hs-incl: prelude/primops.txt
737 $(GENPRIMOP) --has-side-effects < $< > $@
738 primop-out-of-line.hs-incl: prelude/primops.txt
739 $(GENPRIMOP) --out-of-line < $< > $@
740 primop-commutable.hs-incl: prelude/primops.txt
741 $(GENPRIMOP) --commutable < $< > $@
742 primop-needs-wrapper.hs-incl: prelude/primops.txt
743 $(GENPRIMOP) --needs-wrapper < $< > $@
744 primop-can-fail.hs-incl: prelude/primops.txt
745 $(GENPRIMOP) --can-fail < $< > $@
746 primop-strictness.hs-incl: prelude/primops.txt
747 $(GENPRIMOP) --strictness < $< > $@
748 primop-primop-info.hs-incl: prelude/primops.txt
749 $(GENPRIMOP) --primop-primop-info < $< > $@
751 # Usages aren't used any more; but the generator
752 # can still generate them if we want them back
753 primop-usage.hs-incl: prelude/primops.txt
754 $(GENPRIMOP) --usage < $< > $@
757 #-----------------------------------------------------------------------------
760 # Include libghccompat in stage1 only. In stage2 onwards, all these
761 # libraries will be available from the main libraries.
764 include $(GHC_COMPAT_DIR)/compat.mk
767 SRC_LD_OPTS += -no-link-chk
769 # -----------------------------------------------------------------------------
770 # create ghc-inplace, a convenient way to run ghc from the build tree...
771 # See comments in $(FPTOOLS_TOP)/utils/ghc-pkg/Makefile for why we use
772 # a real binary here rather than a shell script.
774 INPLACE_SRC = $(odir)/ghc-inplace.c
775 INPLACE_PROG = $(odir)/ghc-inplace$(_way)$(exeext)
776 INPLACE_EXTRA_FLAGS = -I$(TOP)/includes
777 EXCLUDED_C_SRCS += ghc-inplace.c
779 CLEAN_FILES += $(INPLACE_SRC)
781 GHC_PATH=$(FPTOOLS_TOP_ABS)/$(GHC_COMPILER_DIR_REL)/$(GHC_PROG)$(exeext)
783 $(INPLACE_PROG): ghc-inplace.c
784 $(SED) -e "s@GHC_PATH@$(GHC_PATH)@g" -e "s@TOP_ABS@$(FPTOOLS_TOP_ABS)@g" < $< > $(INPLACE_SRC)
785 $(HC) -cpp $(INPLACE_EXTRA_FLAGS) $(INPLACE_SRC) -o $@
787 all :: $(INPLACE_PROG)
789 CLEAN_FILES += $(INPLACE_PROG)
792 ghc-inplace : $(INPLACE_PROG)
793 $(RM) -f $@ && $(LN_S) $< $@
797 CLEAN_FILES += ghc-inplace
800 #-----------------------------------------------------------------------------
803 # We don't want ghc treated as an ordinary executable,
804 # but put it together with the libraries.
805 # Also don't want any interface files installed
807 DESTDIR = $(INSTALL_LIBRARY_DIR_GHC)
809 ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
810 INSTALL_LIBEXECS += $(GHC_PROG)
812 INSTALL_PROGS += $(GHC_PROG)
815 # ----------------------------------------------------------------------------
818 # rename/RnBinds_HC_OPTS += -auto-all
819 # rename/RnEnv_HC_OPTS += -auto-all
820 # rename/RnExpr_HC_OPTS += -auto-all
821 # rename/RnHiFiles_HC_OPTS += -auto-all
822 # rename/RnHsSyn_HC_OPTS += -auto-all
823 # rename/Rename_HC_OPTS += -auto-all
824 # rename/RnIfaces_HC_OPTS += -auto-all
825 # rename/RnNames_HC_OPTS += -auto-all
826 # rename/RnSource_HC_OPTS += -auto-all
827 # rename/RnTypes_HC_OPTS += -auto-all
829 # typecheck/Inst_HC_OPTS += -auto-all
830 # typecheck/TcBinds_HC_OPTS += -auto-all
831 # typecheck/TcClassDcl_HC_OPTS += -auto-all
832 # typecheck/TcDefaults_HC_OPTS += -auto-all
833 # typecheck/TcDeriv_HC_OPTS += -auto-all
834 # typecheck/TcEnv_HC_OPTS += -auto-all
835 # typecheck/TcExpr_HC_OPTS += -auto-all
836 # typecheck/TcForeign_HC_OPTS += -auto-all
837 # typecheck/TcGenDeriv_HC_OPTS += -auto-all
838 # typecheck/TcHsSyn_HC_OPTS += -auto-all
839 # typecheck/TcIfaceSig_HC_OPTS += -auto-all
840 # typecheck/TcInstDcls_HC_OPTS += -auto-all
841 # typecheck/TcMatches_HC_OPTS += -auto-all
842 # typecheck/TcMonoType_HC_OPTS += -auto-all
843 # typecheck/TcMType_HC_OPTS += -auto-all
844 # typecheck/TcPat_HC_OPTS += -auto-all
845 # typecheck/TcRnDriver_HC_OPTS += -auto-all
846 # #typecheck/TcRnMonad_HC_OPTS += -auto-all
847 # #typecheck/TcRnTypes_HC_OPTS += -auto-all
848 # typecheck/TcRules_HC_OPTS += -auto-all
849 # typecheck/TcSimplify_HC_OPTS += -auto-all
850 # typecheck/TcSplice_HC_OPTS += -auto-all
851 # typecheck/TcTyClsDecls_HC_OPTS += -auto-all
852 # typecheck/TcTyDecls_HC_OPTS += -auto-all
853 # typecheck/TcType_HC_OPTS += -auto-all
854 # typecheck/TcUnify_HC_OPTS += -auto-all
856 # coreSyn/CorePrep_HC_OPTS += -auto-all
857 # parser/Parser_HC_OPTS += -fasm
859 #-----------------------------------------------------------------------------
860 # Building the GHC package
862 # The GHC package is made from the stage 2 build and later.
863 # Fortunately the package build system framework more or less does the
864 # right thing for us here.
866 ifneq "$(findstring $(stage), 2 3)" ""
867 BUILD_GHC_PACKAGE=YES
870 ifeq "$(BUILD_GHC_PACKAGE)" "YES"
872 HIERARCHICAL_LIB = NO
873 VERSION = $(ProjectVersion)
874 PKG_DEPENDS += base haskell98
875 LIB_LD_OPTS += $(foreach pkg,$(PKG_DEPENDS),-package $(pkg))
876 # We have to expand each package dependency with its version, which we
877 # can do by calling "ghc-pkg list $pkg --simple-output".
878 PACKAGE_CPP_OPTS += -DPKG_DEPENDS='$(foreach pkg,$(PKG_DEPENDS),$(shell $(GHC_PKG_INPLACE) latest --global $(pkg)))'
879 PACKAGE_CPP_OPTS += -DSTAGE='"$(stage)"'
881 # Omit Main from the library, the client will want to plug their own Main in
882 LIBOBJS = $(filter-out $(odir)/main/Main.$(way_)o $(odir)/parser/hschooks.$(way_)o, $(OBJS))
884 # disable splitting: it won't really help with GHC, and the specialised
885 # build system for compiler/ isn't set up to handle it.
888 # the package build system likes to set WAYS=$(GhcLibWays), but we don't
889 # really want to build the whole of GHC multiple ways... if you do,
890 # set GhcCompilerWays instead.
891 GhcLibWays = $(GhcCompilerWays)
893 # override $(GhcLibHcOpts): we want GhcStage2HcOpts to take precedence
896 ifeq "$(DOING_BIN_DIST)" "YES"
897 # This is derived from the sources when we are in a source tree, but we
898 # don't have any sources in a bindist, so we have to shortcut it
899 HS_IFACES := $(wildcard stage$(stage)/*/*.hi)
901 # override default definition of HS_IFACES so we can add $(odir)
902 HS_IFACES = $(addsuffix .$(way_)hi,$(basename $(HS_OBJS)))
905 # Haddock can't handle recursive modules currently, so we disable it for now.
906 override HADDOCK_DOCS = NO
908 # Tell package.mk not to set $(HC)
911 # The stage 2 GHC binary itself is built by compiling main/Main.hs
912 # (the same as used in stage 1) against the GHC package.
914 # This is done by compiling Main.hs separately and linking it with
915 # -package ghc. This is done using a separate Makefile, Makefile.ghcbin
916 # Why? See comments in Makefile.ghcbin
918 # The stage 2 and stage 3 package.conf.in files are different, because they
919 # point to either the stage2/ or stage3/ dirs in import-dirs. Hence before
920 # linking the ghc binary we must install the correct version of the package
921 # configuration. Yeuch... maybe one day this will all be done more cleanly.
922 STAMP_PKG_CONF = $(GHC_DRIVER_DIR)/stamp-pkg-conf-$(PACKAGE)
924 # Propagate standard targets to Makefile.ghcbin
925 docs runtests $(BOOT_TARGET) TAGS clean distclean mostlyclean maintainer-clean $(INSTALL_TARGET) $(INSTALL_DOCS_TARGET) html chm HxS ps dvi txt::
926 $(MAKE) -f Makefile.ghcbin $(MFLAGS) $@
929 #-----------------------------------------------------------------------------
932 MAINTAINER_CLEAN_FILES += parser/Parser.info main/ParsePkgConf.info
934 #-----------------------------------------------------------------------------
935 # Include target-rule boilerplate
937 # Don't use the default MKDEPENDHS stuff... we'll do our own, below
941 # Make doesn't work this out for itself, it seems
942 parser/Parser.y : parser/Parser.y.pp
943 EXTRA_SRCS += parser/Parser.y
946 #-----------------------------------------------------------------------------
947 # Source files for tags file generation
949 # We want to excluded derived sources, because they won't be in the source
950 # tree, which is where we are going to move the TAGS file to.a
952 TAGS_HS_SRCS = parser/Parser.y.pp $(filter-out $(DERIVED_SRCS) main/Config.hs parser/Parser.y, $(sort $(SRCS)))
954 WRONG_GHCTAGS_HS_SRCS = $(filter-out $(DERIVED_SRCS) main/Config.hs parser/Parser.y, $(sort $(SRCS)))
955 # above is wrong because of the following problem:
956 # module `main:DataCon' is defined in multiple files: basicTypes/DataCon.lhs
957 # basicTypes/DataCon.lhs-boot
959 GHCTAGS_HS_SRCS = $(HS_SRCS)
960 GHCTAGS_HC_OPTS = $(patsubst -i$(odir)/%, -i%, $(HC_OPTS))
961 GHCTAGS_HC_OPTS += -DSTAGE='"$(stage)"'
963 #------------------------------------------------------------
968 ghctags :: $(GHCTAGS_HS_SRCS) $(TAGS_C_SRCS)
969 @if [ "$(stage)" != 2 ]; then echo "Must use 'make stage=2 ghctags'"; exit 1; fi
972 @echo SOURCES ARE "$(GHCTAGS_HS_SRCS)"
973 : ifneq "$(GHCTAGS_HS_SRCS)" ""
974 @echo TIME TO ROCK AND ROLL
975 # $(GHCTAGS_INPLACE) -- $(MKDEPENDHS_OPTS) $(filter-out -split-objs, $(MKDEPENDHS_HC_OPTS)) -- $(GHCTAGS_HS_SRCS)
976 $(GHCTAGS_INPLACE) -- $(GHCTAGS_HC_OPTS) -- $(GHCTAGS_HS_SRCS)
978 ifneq "$(TAGS_C_SRCS)" ""
979 etags -a $(TAGS_C_SRCS)
981 @( 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?
983 include $(TOP)/mk/target.mk
985 ifeq "$(BUILD_GHC_PACKAGE)" "YES"
989 $(odir)/main/Config.$(way_)o: SRC_HC_OPTS+=-DSTAGE=$(DQ)$(stage)$(DQ)
991 ifneq "$(findstring $(stage), 2 3)" ""
992 $(warning LIBRARY is $(LIBRARY))
994 ifneq "$(DOING_BIN_DIST)" "YES"
995 $(GHC_PROG) : $(LIBRARY) main/Main.hs
996 $(RM) package.conf.inplace
997 $(RM) $(STAMP_PKG_CONF)
998 $(MAKE) way="" $(STAMP_PKG_CONF)
999 $(MAKE) -f Makefile.ghcbin $(MFLAGS) HS_PROG=$(GHC_PROG) $@
1004 #-----------------------------------------------------------------------------
1008 $(INSTALL_DIR) $(BIN_DIST_DIR)/compiler
1009 $(INSTALL_DIR) $(BIN_DIST_DIR)/compiler/stage$(stage)
1010 echo "stage=$(stage)" > $(BIN_DIST_DIR)/compiler/Makefile
1011 cat Makefile >> $(BIN_DIST_DIR)/compiler/Makefile
1012 $(INSTALL_DATA) package.conf.in $(BIN_DIST_DIR)/compiler/
1013 set -e; for d in stage$(stage)/*/; do $(INSTALL_DIR) $(BIN_DIST_DIR)/compiler/$$d; done
1014 set -e; for f in $(HS_IFACES); do $(INSTALL_DATA) $$f $(BIN_DIST_DIR)/compiler/$$f; done
1015 ifneq "$(INSTALL_LIBS)" ""
1016 set -e; for f in $(INSTALL_LIBS); do $(INSTALL_DATA) $$f $(BIN_DIST_DIR)/compiler/$$f; done
1018 ifneq "$(INSTALL_PROGS)" ""
1019 set -e; for f in $(INSTALL_PROGS); do $(INSTALL_PROGRAM) $$f $(BIN_DIST_DIR)/compiler/$$f; done
1021 ifneq "$(INSTALL_LIBEXECS)" ""
1022 set -e; for f in $(INSTALL_LIBEXECS); do $(INSTALL_PROGRAM) $$f $(BIN_DIST_DIR)/compiler/$$f; done
1025 # -----------------------------------------------------------------------------
1026 # Explicit dependencies
1028 # Some .hs files #include other source files, but since ghc -M doesn't spit out
1029 # these dependencies we have to include them manually.
1031 # We don't add dependencies on HsVersions.h, ghcautoconf.h, or ghc_boot_platform.h,
1032 # because then modifying one of these files would force recompilation of everything,
1033 # which is probably not what you want. However, it does mean you have to be
1034 # careful to recompile stuff you need if you reconfigure or change HsVersions.h.
1036 # Aargh, these don't work properly anyway, because GHC's recompilation checker
1037 # just reports "compilation NOT required". Do we have to add -no-recomp for each
1038 # of these .hs files? I haven't done anything about this yet.
1040 $(odir)/codeGen/Bitmap.$(way_)o : ../includes/MachDeps.h
1041 $(odir)/codeGen/CgCallConv.$(way_)o : ../includes/StgFun.h
1042 $(odir)/codeGen/CgProf.$(way_)o : ../includes/MachDeps.h
1043 $(odir)/codeGen/CgProf.$(way_)o : ../includes/Constants.h
1044 $(odir)/codeGen/CgProf.$(way_)o : ../includes/DerivedConstants.h
1045 $(odir)/codeGen/CgTicky.$(way_)o : ../includes/DerivedConstants.h
1046 $(odir)/codeGen/ClosureInfo.$(way_)o : ../includes/MachDeps.h
1047 $(odir)/codeGen/SMRep.$(way_)o : ../includes/MachDeps.h
1048 $(odir)/codeGen/SMRep.$(way_)o : ../includes/ClosureTypes.h
1049 $(odir)/ghci/ByteCodeAsm.$(way_)o : ../includes/Bytecodes.h
1050 $(odir)/ghci/ByteCodeFFI.$(way_)o : nativeGen/NCG.h
1051 $(odir)/ghci/ByteCodeInstr.$(way_)o : ../includes/MachDeps.h
1052 $(odir)/ghci/ByteCodeItbls.$(way_)o : ../includes/ClosureTypes.h
1053 $(odir)/ghci/ByteCodeItbls.$(way_)o : nativeGen/NCG.h
1054 $(odir)/main/Constants.$(way_)o : ../includes/MachRegs.h
1055 $(odir)/main/Constants.$(way_)o : ../includes/Constants.h
1056 $(odir)/main/Constants.$(way_)o : ../includes/MachDeps.h
1057 $(odir)/main/Constants.$(way_)o : ../includes/DerivedConstants.h
1058 $(odir)/main/Constants.$(way_)o : ../includes/GHCConstants.h
1059 $(odir)/nativeGen/AsmCodeGen.$(way_)o : nativeGen/NCG.h
1060 $(odir)/nativeGen/MachCodeGen.$(way_)o : nativeGen/NCG.h
1061 $(odir)/nativeGen/MachCodeGen.$(way_)o : ../includes/MachDeps.h
1062 $(odir)/nativeGen/MachInstrs.$(way_)o : nativeGen/NCG.h
1063 $(odir)/nativeGen/MachRegs.$(way_)o : nativeGen/NCG.h
1064 $(odir)/nativeGen/MachRegs.$(way_)o : ../includes/MachRegs.h
1065 $(odir)/nativeGen/PositionIndependentCode.$(way_)o : nativeGen/NCG.h
1066 $(odir)/nativeGen/PprMach.$(way_)o : nativeGen/NCG.h
1067 $(odir)/nativeGen/RegAllocInfo.$(way_)o : nativeGen/NCG.h
1068 $(odir)/typecheck/TcForeign.$(way_)o : nativeGen/NCG.h
1069 $(odir)/utils/Binary.$(way_)o : ../includes/MachDeps.h
1070 $(odir)/utils/FastMutInt.$(way_)o : ../includes/MachDeps.h
1072 # -----------------------------------------------------------------------------
1075 MKDEPENDHS_HC_OPTS = $(patsubst -i$(odir)/%, -i%, $(HC_OPTS))
1079 # Must do this *after* including target.mk, because $(HS_SRCS) isn't set yet.
1080 depend :: $(STAGE_PLATFORM_H) $(HS_SRCS) $(C_SRCS)
1082 ifneq "$(BootingFromHc)" "YES"
1083 $(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)
1085 $(MKDEPENDC) -f .depend-BASE $(MKDEPENDC_OPTS) $(foreach way,$(WAYS),-s $(way)) -- $(CC_OPTS) -- $(C_SRCS)
1086 $(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)
1087 # The binmode stuff tells perl not to add stupid ^M's to the output
1089 # The /lib/compat replacement is to workaround a bug in the
1090 # -optdep--exclude-module flag in GHC 6.4. It is not required for any
1091 # other version of GHC, but doesn't do any harm.
1093 ifeq "$(MakefileDeps)" "YES"
1094 $(CONFIG_HS) : Makefile
1095 stage1/$(PLATFORM_H) : Makefile
1096 stage2/$(PLATFORM_H) : Makefile
1099 -include .depend-$(stage)