1 # -----------------------------------------------------------------------------
2 # Main ghc/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 include $(TOP)/mk/boilerplate.mk
26 #-----------------------------------------------------------------------------
27 # Counting source code lines
29 USER_SRCS = $(filter-out $(DERIVED_SRCS),$(SRCS))
31 ./count_lines $(USER_SRCS)
33 #-----------------------------------------------------------------------------
34 # Building ghc different ways (default is just `normal' sequential)
36 WAYS=$(GhcCompilerWays)
38 # -----------------------------------------------------------------------------
41 # The stage1/stage2/stage3 business is quite delicate. Here's how it works:
43 # - the variable $(stage) holds the current stage number. To build a
44 # particular stage, you say 'make stage=N' where N is 1, 2, or 3.
47 # - for stage N, object files and .hi files are placed inside
48 # the directory stageN, in subdirectories as per the sources.
50 # - .hi-boot files are *linked* into the stageN tree, because in GHC 5.05+
51 # the .hi-boot file must reside in the same place as the .hi file.
53 # - we use explicit -o and -ohi options to direct the output from C &
54 # Haskell compilations.
56 # - we generate a different .depend file for each build. They need to be
57 # different, because each stage might include different files: stage1
58 # might not include GHCi, for example. For each stage, a normal .depend
59 # file is generated, and then post-processed to add the correct stageN/
60 # prefix to each object and .hi filename. The resulting .depend file
61 # is named .depend-$(stage). See the end of this Makefile for details.
63 # - normal implicit rules don't work any more, because they're of the form
67 # whereas we really need
71 # so suffix.mk now defines the appropriate suffix rules when
72 # $(odir) is set to a non-empty value. Here we set $(odir) to
73 # stage1, stage2, or stage3.
75 # There are other plausible designs that might work, but each has different
78 # - using -odir and -hidir: GHC <= 4.08 doesn't support -hidir, and
79 # anyway -odir puts all the objects in one directory (strips off the
80 # subdirectory part), which eventually forces us to use VPATH to find
81 # the sources. I have a really bad feeling about VPATH.
83 # - invoke make in the stageN subdirectory. This probably requires VPATH
86 # - create a link tree. The problem with requiring link trees is that
87 # Windows doesn't support symbolic links.
94 $(MKDIRHIER) stage$(stage)
95 for i in $(ALL_DIRS); do \
96 $(MKDIRHIER) stage$(stage)/$$i; \
98 # On Windows, we can't use symbolic links for the -hi-boot files
99 # because GHC itself is a Mingw program and does not understand
100 # symbolic links. So we have to copy the files instead of link them.
101 # That means that if you modify a .hi-boot file in Windows, you
102 # have to to say 'make boot' again.
104 # PS: 'ln -s foo baz' takes 'foo' relative to the path to 'baz'
105 # whereas 'cp foo baz' treats the two paths independently.
106 # Hence the "../.." in the ln command line
108 ifeq "$(ghc_ge_603)" "NO"
109 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
110 for i in */*hi-boot*; do \
111 cp -u -f $$i stage$(stage)/$$i; \
114 for i in */*hi-boot*; do \
115 $(LN_S) -f ../../$$i stage$(stage)/$$i || true ; \
144 SRC_HC_OPTS += $(patsubst %, -i$(odir)/%, $(ALL_DIRS))
146 HS_OBJS = $(patsubst %, $(odir)/%, $(addsuffix .$(way_)o,$(basename $(HS_SRCS))))
147 C_OBJS = $(patsubst %, $(odir)/%, $(addsuffix .$(way_)o,$(basename $(C_SRCS))))
149 CLEAN_FILES += $(odir)/*/*.hi
152 mostlyclean clean distclean maintainer-clean ::
157 # -----------------------------------------------------------------------------
160 # Note: there have been reports of people running up against the ARG_MAX limit
161 # when linking ghc with all its constituent object files. The likely source of
162 # the problem is that the environment is a bit too big, so a workaround could
163 # be to do `env PATH=$(PATH) make ghc' to minimise the environment. (or the
164 # equivalent of `env' if it doesn't exist locally).
166 ifneq "$(BuildPackageGHC)" "YES"
168 ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
169 HS_PROG=$(odir)/ghc$(_way)-$(ProjectVersion)
171 HS_PROG=$(odir)/ghc$(_way)
174 HS_PROG=$(odir)/ghc-$(ProjectVersion)
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 Makefile
188 @$(RM) -f $(CONFIG_HS)
189 @echo "Creating $(CONFIG_HS) ... "
190 @echo "module Config where" >>$(CONFIG_HS)
191 @echo "cProjectName = \"$(ProjectName)\"" >> $(CONFIG_HS)
192 @echo "cProjectVersion = \"$(ProjectVersion)\"" >> $(CONFIG_HS)
193 @echo "cProjectVersionInt = \"$(ProjectVersionInt)\"" >> $(CONFIG_HS)
194 @echo "cProjectPatchLevel = \"$(ProjectPatchLevel)\"" >> $(CONFIG_HS)
195 @echo "cBooterVersion = \"$(GhcVersion)\"" >> $(CONFIG_HS)
196 @echo "cHscIfaceFileVersion = \"$(HscIfaceFileVersion)\"" >> $(CONFIG_HS)
197 @echo "cTARGETPLATFORM = \"$(TARGETPLATFORM)\"" >> $(CONFIG_HS)
198 @echo "cTARGETOS = \"$(TargetOS_CPP)\"" >> $(CONFIG_HS)
199 @echo "cTARGETARCH = \"$(TargetArch_CPP)\"" >> $(CONFIG_HS)
200 @echo "cGhcWithNativeCodeGen = \"$(GhcWithNativeCodeGen)\"" >> $(CONFIG_HS)
201 @echo "cGhcUnregisterised = \"$(GhcUnregisterised)\"" >> $(CONFIG_HS)
202 @echo "cLeadingUnderscore = \"$(LeadingUnderscore)\"" >> $(CONFIG_HS)
203 @echo "cRAWCPP_FLAGS = \"$(RAWCPP_FLAGS)\"" >> $(CONFIG_HS)
204 @echo "cGCC = \"$(WhatGccIsCalled)\"" >> $(CONFIG_HS)
205 @echo "cMKDLL = \"$(BLD_DLL)\"" >> $(CONFIG_HS)
206 @echo "cPROJECT_DIR = \"$(PROJECT_DIR)\"" >> $(CONFIG_HS)
207 @echo "cGHC_DRIVER_DIR_REL = \"$(GHC_DRIVER_DIR_REL)\"" >> $(CONFIG_HS)
208 @echo "cGHC_TOUCHY_PGM = \"$(GHC_TOUCHY_PGM)\"" >> $(CONFIG_HS)
209 @echo "cGHC_TOUCHY_DIR_REL = \"$(GHC_TOUCHY_DIR_REL)\"" >> $(CONFIG_HS)
210 @echo "cGHC_UNLIT_PGM = \"$(GHC_UNLIT_PGM)\"" >> $(CONFIG_HS)
211 @echo "cGHC_UNLIT_DIR_REL = \"$(GHC_UNLIT_DIR_REL)\"" >> $(CONFIG_HS)
212 @echo "cGHC_MANGLER_PGM = \"$(GHC_MANGLER_PGM)\"" >> $(CONFIG_HS)
213 @echo "cGHC_MANGLER_DIR_REL = \"$(GHC_MANGLER_DIR_REL)\"" >> $(CONFIG_HS)
214 @echo "cGHC_SPLIT_PGM = \"$(GHC_SPLIT_PGM)\"" >> $(CONFIG_HS)
215 @echo "cGHC_SPLIT_DIR_REL = \"$(GHC_SPLIT_DIR_REL)\"" >> $(CONFIG_HS)
216 @echo "cGHC_SYSMAN_PGM = \"$(GHC_SYSMAN)\"" >> $(CONFIG_HS)
217 @echo "cGHC_SYSMAN_DIR_REL = \"$(GHC_SYSMAN_DIR)\"" >> $(CONFIG_HS)
218 @echo "cGHC_CP = \"$(GHC_CP)\"" >> $(CONFIG_HS)
219 @echo "cGHC_PERL = \"$(GHC_PERL)\"" >> $(CONFIG_HS)
220 ifeq ($(GhcWithIlx),YES)
221 @echo "cILX2IL = \"$(ILX2IL)\"" >> $(CONFIG_HS)
222 @echo "cILASM = \"$(ILASM)\"" >> $(CONFIG_HS)
224 @echo "cEnableWin32DLLs = \"$(EnableWin32DLLs)\"" >> $(CONFIG_HS)
225 @echo "cCONTEXT_DIFF = \"$(CONTEXT_DIFF)\"" >> $(CONFIG_HS)
226 @echo "cUSER_WAY_NAMES = \"$(USER_WAY_NAMES)\"" >> $(CONFIG_HS)
227 @echo "cUSER_WAY_OPTS = \"$(USER_WAY_OPTS)\"" >> $(CONFIG_HS)
228 @echo "cDEFAULT_TMPDIR = \"$(DEFAULT_TMPDIR)\"" >> $(CONFIG_HS)
231 CLEAN_FILES += $(CONFIG_HS)
233 # -----------------------------------------------------------------------------
236 # First figure out ALL_DIRS, the source sub-directories
239 utils basicTypes types hsSyn prelude rename typecheck deSugar coreSyn \
240 specialise simplCore stranal stgSyn simplStg codeGen main \
241 profiling parser cprAnalysis compMan ndpFlatten iface cmm
243 # Make sure we include Config.hs even if it doesn't exist yet...
244 ALL_SRCS += $(CONFIG_HS)
246 # HsGeneric.hs is not used just now
247 EXCLUDED_SRCS += hsSyn/HsGeneric.hs
249 ifeq ($(GhcWithNativeCodeGen),YES)
250 ALL_DIRS += nativeGen
252 SRC_HC_OPTS += -DOMIT_NATIVE_CODEGEN
255 ifeq ($(GhcWithIlx),YES)
260 ifeq ($(GhcWithJavaGen),YES)
262 SRC_HC_OPTS += -DJAVA
265 ifeq "$(BootingFromHc)" "YES"
266 # HC files are always from a self-booted compiler
269 ifneq "$(findstring $(stage), 2 3)" ""
272 bootstrapped = $(shell if (test $(GhcCanonVersion) -ge $(ProjectVersionInt) -a $(GhcPatchLevel) -ge $(ProjectPatchLevel)); then echo YES; else echo NO; fi)
276 # -----------------------------------------------------------------------------
277 # Building a compiler with interpreter support
279 # The interpreter, GHCi interface, and Template Haskell are only
280 # enabled when we are bootstrapping with the same version of GHC, and
281 # the interpreter is supported on this platform.
283 ifeq "$(GhcWithInterpreter) $(bootstrapped)" "YES YES"
285 # Yes, include the interepreter, readline, and Template Haskell extensions
286 SRC_HC_OPTS += -DGHCI -package template-haskell
288 ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
289 SRC_HC_OPTS += -package unix
294 # Enable readline if either:
295 # - we're building stage 1 and $(GhcHasReadline)="YES"
296 # - we're building stage 2/3, and we have built the readline package
298 # But we don't enable readline on Windows, because readline is fairly
301 ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
303 ifeq "$(GhcHasReadline)" "YES"
304 SRC_HC_OPTS += -package readline -DUSE_READLINE
307 ifeq "$(GhcLibsWithReadline)" "YES"
308 SRC_HC_OPTS += -package readline -DUSE_READLINE
315 # No interpreter, so exclude Template Haskell modules
316 EXCLUDED_SRCS += deSugar/DsMeta.hs typecheck/TcSplice.lhs hsSyn/Convert.lhs
318 endif # bootstrapped with interpreter
320 ifeq "$(bootstrapped)" "YES"
321 SRC_HC_OPTS += -package Cabal
324 # -----------------------------------------------
327 # Big Fudge to get around inherent problem that Makefile setup
328 # has got with 'mkdependC'.
330 SRC_MKDEPENDC_OPTS += -D__GLASGOW_HASKELL__=$(ProjectVersionInt)
332 # XXX not really correct, hschooks.c actually gets include files like
333 # RtsFlags.c from the installed GHC, but we can't tell mkdependC about that.
334 SRC_MKDEPENDC_OPTS += -I$(GHC_INCLUDE_DIR)
336 # -----------------------------------------------------------------------------
337 # Haskell compilations
340 -cpp -fglasgow-exts -fno-generics -Rghc-timing \
341 -I. -IcodeGen -InativeGen -Iparser
343 # Omitted: -I$(GHC_INCLUDE_DIR)
344 # We should have -I$(GHC_INCLUDE_DIR) in SRC_HC_OPTS,
345 # to avoid the use of an explicit path in GHC source files
346 # (include "../includes/config.h"
347 # But alas GHC 4.08 (and others for all I know) uses this very
348 # same include path when compiling the .hc files it generates.
349 # Disaster! Then the hc file sees the GHC 5.02 (or whatever)
350 # include files. For the moment we've reverted to using
351 # an explicit path in the .hs sources
353 # For the benefit of <5.00 compilers, do include GHC_INCLUDE_DIR
354 # when generating dependencies. (=> it gets passed onto mkdependHS,
356 SRC_MKDEPENDHS_OPTS += -I$(GHC_INCLUDE_DIR)
358 # When bootstrapped, we don't make use of *any* packages
359 # (except possibly readline if GHCi is enabled, see above)
360 ifneq "$(bootstrapped)" "YES"
361 ifneq "$(mingw32_HOST_OS)" "1"
362 SRC_HC_OPTS += -package concurrent -package posix -package util
364 SRC_HC_OPTS += -package concurrent -package util
368 SRC_CC_OPTS += -Iparser -I. -O
369 SRC_HC_OPTS += -recomp $(GhcHcOpts) $(GhcStage$(stage)HcOpts)
372 ifeq "$(BootingFromHc)" "YES"
373 SRC_CC_OPTS += -D__GLASGOW_HASKELL__=$(ProjectVersionInt)
376 # Special flags for particular modules
377 # The standard suffix rule for compiling a Haskell file
378 # adds these flags to the command line
380 # There used to be a -no-recomp flag on PrimOp, but why?
381 # It's an expensive module to recompile!
382 prelude/PrimOp_HC_OPTS = -H80m
384 # because the NCG can't handle the 64-bit math in here
385 prelude/PrelRules_HC_OPTS = -fvia-C
387 main/ParsePkgConf_HC_OPTS += -fno-warn-incomplete-patterns
388 # Use -fvia-C since the NCG can't handle the narrow16Int# (and intToInt16#?)
389 # primops on all platforms.
390 parser/Parser_HC_OPTS += -fno-warn-incomplete-patterns -fvia-C
392 # Careful optimisation of the parser: we don't want to throw everything
393 # at it, because that takes too long and doesn't buy much, but we do want
394 # to inline certain key external functions, so we instruct GHC not to
395 # throw away inlinings as it would normally do in -Onot mode:
396 parser/Parser_HC_OPTS += -Onot -fno-ignore-interface-pragmas
398 ifeq "$(HOSTPLATFORM)" "hppa1.1-hp-hpux9"
399 rename/RnMonad_HC_OPTS = -O2 -O2-for-C
402 utils/Digraph_HC_OPTS = -fglasgow-exts
404 basicTypes/SrcLoc_HC_OPTS = -funbox-strict-fields
406 ifeq "$(bootstrapped)" "YES"
407 utils/Binary_HC_OPTS = -funbox-strict-fields
410 # ByteCodeItbls uses primops that the NCG doesn't support yet.
411 ghci/ByteCodeItbls_HC_OPTS += -fvia-C
412 ghci/ByteCodeLink_HC_OPTS += -fvia-C -monly-3-regs
414 # BinIface and Binary take ages to both compile and run if you don's use -O
415 main/BinIface_HC_OPTS += -O
416 utils/Binary_HC_OPTS += -O
417 utils/FastMutInt_HC_OPTS += -O
420 # CSE interacts badly with top-level IORefs (reportedly in DriverState and
421 # DriverMkDepend), causing some of them to be commoned up. We have a fix for
422 # this in 5.00+, but earlier versions of the compiler will need CSE turned off.
423 # To be on the safe side, we disable CSE in *all* modules with top-level IORefs.
424 compMan/CompManager_HC_OPTS = -fno-cse
425 ghci/InteractiveUI_HC_OPTS = -fno-cse
426 main/CmdLineOpts_HC_OPTS = -fno-cse
427 main/DriverFlags_HC_OPTS = -fno-cse
428 main/DriverMkDepend_HC_OPTS = -fno-cse
429 main/DriverPipeline_HC_OPTS = -fno-cse
430 main/DriverState_HC_OPTS = -fno-cse
431 main/DriverUtil_HC_OPTS = -fno-cse
432 main/Finder_HC_OPTS = -fno-cse
433 main/SysTools_HC_OPTS = -fno-cse
435 # The #include is vital for the via-C route, else the C
436 # compiler doesn't realise that the stcall foreign imports are indeed
437 # stdcall, and doesn't generate the Foo@8 name for them
438 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
439 main/SysTools_HC_OPTS += '-\#include <windows.h>' '-\#include <process.h>'
442 parser/Lexer_HC_OPTS += -funbox-strict-fields
444 # ghc_strlen percolates through so many modules that it is easier to get its
445 # prototype via a global option instead of a myriad of per-file OPTIONS
446 SRC_HC_OPTS += '-\#include "hschooks.h"'
448 # ----------------------------------------------------------------------------
449 # Generate supporting stuff for prelude/PrimOp.lhs
450 # from prelude/primops.txt
452 GENPOC=$(TOP)/utils/genprimopcode/genprimopcode
454 PRIMOP_BITS=primop-data-decl.hs-incl \
456 primop-list.hs-incl \
457 primop-has-side-effects.hs-incl \
458 primop-out-of-line.hs-incl \
459 primop-commutable.hs-incl \
460 primop-needs-wrapper.hs-incl \
461 primop-can-fail.hs-incl \
462 primop-strictness.hs-incl \
463 primop-primop-info.hs-incl
465 CLEAN_FILES += prelude/primops.txt
466 CLEAN_FILES += $(PRIMOP_BITS)
468 SRC_CPP_OPTS += -I$(GHC_INCLUDE_DIR)
469 SRC_CPP_OPTS += ${GhcCppOpts}
471 ifneq "$(BootingFromHc)" "YES"
472 prelude/PrimOp.lhs $(odir)/prelude/PrimOp.o: $(PRIMOP_BITS)
475 ifneq "$(BootingFromHc)" "YES"
476 depend :: $(PRIMOP_BITS)
479 primop-data-decl.hs-incl: prelude/primops.txt
480 $(GENPOC) --data-decl < $< > $@
481 primop-tag.hs-incl: prelude/primops.txt
482 $(GENPOC) --primop-tag < $< > $@
483 primop-list.hs-incl: prelude/primops.txt
484 $(GENPOC) --primop-list < $< > $@
485 primop-has-side-effects.hs-incl: prelude/primops.txt
486 $(GENPOC) --has-side-effects < $< > $@
487 primop-out-of-line.hs-incl: prelude/primops.txt
488 $(GENPOC) --out-of-line < $< > $@
489 primop-commutable.hs-incl: prelude/primops.txt
490 $(GENPOC) --commutable < $< > $@
491 primop-needs-wrapper.hs-incl: prelude/primops.txt
492 $(GENPOC) --needs-wrapper < $< > $@
493 primop-can-fail.hs-incl: prelude/primops.txt
494 $(GENPOC) --can-fail < $< > $@
495 primop-strictness.hs-incl: prelude/primops.txt
496 $(GENPOC) --strictness < $< > $@
497 primop-primop-info.hs-incl: prelude/primops.txt
498 $(GENPOC) --primop-primop-info < $< > $@
500 # Usages aren't used any more; but the generator
501 # can still generate them if we want them back
502 primop-usage.hs-incl: prelude/primops.txt
503 $(GENPOC) --usage < $< > $@
506 #-----------------------------------------------------------------------------
509 # Include libghccompat in stage1 only. In stage2 onwards, all these
510 # libraries will be available from the main libraries.
512 SRC_HC_OPTS += -i$(GHC_LIB_COMPAT_DIR)
513 SRC_LD_OPTS += -L$(GHC_LIB_COMPAT_DIR) -lghccompat
515 ifeq "$(Windows)" "YES"
516 # not very nice, but required for -lghccompat on Windows
517 SRC_LD_OPTS += -lshell32
520 # This is horrible. We ought to be able to omit the entire directory
522 SRC_MKDEPENDHS_OPTS += \
523 -optdep--exclude-module=Compat.RawSystem \
524 -optdep--exclude-module=Compat.Directory \
525 -optdep--exclude-module=Distribution.Compat.ReadP \
526 -optdep--exclude-module=Distribution.Extension \
527 -optdep--exclude-module=Distribution.GetOpt \
528 -optdep--exclude-module=Distribution.InstalledPackageInfo \
529 -optdep--exclude-module=Distribution.License \
530 -optdep--exclude-module=Distribution.Package \
531 -optdep--exclude-module=Distribution.ParseUtils \
532 -optdep--exclude-module=Distribution.Setup \
533 -optdep--exclude-module=Distribution.Version \
534 -optdep--exclude-module=System.Directory.Internals
537 SRC_LD_OPTS += -no-link-chk
539 # -----------------------------------------------------------------------------
540 # create ghc-inplace, a convenient way to run ghc from the build tree...
542 all :: $(odir)/ghc-inplace ghc-inplace
544 $(odir)/ghc-inplace : $(HS_PROG)
546 echo '#!/bin/sh' >>$@
547 echo exec $(FPTOOLS_TOP_ABS)/ghc/compiler/$(HS_PROG) '-B$(subst \,\\,$(FPTOOLS_TOP_ABS_PLATFORM))' '"$$@"' >>$@
550 ghc-inplace : stage1/ghc-inplace
553 CLEAN_FILES += $(odir)/ghc-inplace ghc-inplace
555 #-----------------------------------------------------------------------------
558 # We don't want ghc treated as an ordinary executable,
559 # but put it together with the libraries.
560 # Also don't want any interface files installed
562 DESTDIR = $(INSTALL_LIBRARY_DIR_GHC)
564 ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
565 INSTALL_LIBEXECS += $(HS_PROG)
567 INSTALL_PROGS += $(HS_PROG)
570 # ----------------------------------------------------------------------------
573 # rename/RnBinds_HC_OPTS += -auto-all
574 # rename/RnEnv_HC_OPTS += -auto-all
575 # rename/RnExpr_HC_OPTS += -auto-all
576 # rename/RnHiFiles_HC_OPTS += -auto-all
577 # rename/RnHsSyn_HC_OPTS += -auto-all
578 # rename/Rename_HC_OPTS += -auto-all
579 # rename/RnIfaces_HC_OPTS += -auto-all
580 # rename/RnNames_HC_OPTS += -auto-all
581 # rename/RnSource_HC_OPTS += -auto-all
582 # rename/RnTypes_HC_OPTS += -auto-all
584 # typecheck/Inst_HC_OPTS += -auto-all
585 # typecheck/TcBinds_HC_OPTS += -auto-all
586 # typecheck/TcClassDcl_HC_OPTS += -auto-all
587 # typecheck/TcDefaults_HC_OPTS += -auto-all
588 # typecheck/TcDeriv_HC_OPTS += -auto-all
589 # typecheck/TcEnv_HC_OPTS += -auto-all
590 # typecheck/TcExpr_HC_OPTS += -auto-all
591 # typecheck/TcForeign_HC_OPTS += -auto-all
592 # typecheck/TcGenDeriv_HC_OPTS += -auto-all
593 # typecheck/TcHsSyn_HC_OPTS += -auto-all
594 # typecheck/TcIfaceSig_HC_OPTS += -auto-all
595 # typecheck/TcInstDcls_HC_OPTS += -auto-all
596 # typecheck/TcMatches_HC_OPTS += -auto-all
597 # typecheck/TcMonoType_HC_OPTS += -auto-all
598 # typecheck/TcMType_HC_OPTS += -auto-all
599 # typecheck/TcPat_HC_OPTS += -auto-all
600 # typecheck/TcRnDriver_HC_OPTS += -auto-all
601 # #typecheck/TcRnMonad_HC_OPTS += -auto-all
602 # #typecheck/TcRnTypes_HC_OPTS += -auto-all
603 # typecheck/TcRules_HC_OPTS += -auto-all
604 # typecheck/TcSimplify_HC_OPTS += -auto-all
605 # typecheck/TcSplice_HC_OPTS += -auto-all
606 # typecheck/TcTyClsDecls_HC_OPTS += -auto-all
607 # typecheck/TcTyDecls_HC_OPTS += -auto-all
608 # typecheck/TcType_HC_OPTS += -auto-all
609 # typecheck/TcUnify_HC_OPTS += -auto-all
611 coreSyn/CorePrep_HC_OPTS += -auto-all
613 #-----------------------------------------------------------------------------
614 # Building GHC package
616 ifeq "$(BuildPackageGHC)" "YES"
619 STANDALONE_PACKAGE = YES
624 #-----------------------------------------------------------------------------
627 MAINTAINER_CLEAN_FILES += parser/Parser.info main/ParsePkgConf.info
629 #-----------------------------------------------------------------------------
630 # Include target-rule boilerplate
632 # Don't use the default MKDEPENDHS stuff... we'll do our own, below
636 # Make doesn't work this out for itself, it seems
637 parser/Parser.y : parser/Parser.y.pp
638 EXTRA_SRCS += parser/Parser.y
641 #-----------------------------------------------------------------------------
642 # Source files for tags file generation
644 # We want to excluded derived sources, because they won't be in the source
645 # tree, which is where we are going to move the TAGS file to.a
647 TAGS_HS_SRCS = parser/Parser.y.pp $(filter-out $(DERIVED_SRCS) main/Config.hs parser/Parser.y, $(sort $(SRCS)))
650 include $(TOP)/mk/target.mk
652 # -----------------------------------------------------------------------------
655 MKDEPENDHS_HC_OPTS = $(patsubst -i$(odir)/%, -i%, $(HC_OPTS))
659 # Must do this *after* including target.mk, because $(HS_SRCS) isn't set yet.
660 depend :: $(HS_SRCS) $(C_SRCS)
662 ifneq "$(BootingFromHc)" "YES"
663 $(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)
665 $(MKDEPENDC) -f .depend-BASE $(MKDEPENDC_OPTS) $(foreach way,$(WAYS),-s $(way)) -- $(CC_OPTS) -- $(C_SRCS)
666 $(PERL) -pe 'binmode(stdin); binmode(stdout); s@^(\S*\.o)@stage$(stage)/$$1@g; s@(\S*\.hi)@stage$(stage)/$$1@g' <.depend-BASE >.depend-$(stage)
667 # The binmode stuff tells perl not to add stupid ^M's to the output
669 -include .depend-$(stage)