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.
90 $(MKDIRHIER) stage$(stage)
91 for i in $(ALL_DIRS); do \
92 $(MKDIRHIER) stage$(stage)/$$i; \
94 # On Windows, we can't use symbolic links for the -hi-boot files
95 # because GHC itself is a Mingw program and does not understand
96 # symbolic links. So we have to copy the files instead of link them.
97 # That means that if you modify a .hi-boot file in Windows, you
98 # have to to say 'make boot' again.
100 # PS: 'ln -s foo baz' takes 'foo' relative to the path to 'baz'
101 # whereas 'cp foo baz' treats the two paths independently.
102 # Hence the "../.." in the ln command line
103 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
104 for i in */*hi-boot*; do \
105 cp -u -f $$i stage$(stage)/$$i; \
108 for i in */*hi-boot*; do \
109 $(LN_S) -f ../../$$i stage$(stage)/$$i || true ; \
140 SRC_HC_OPTS += $(patsubst %, -i$(odir)/%, $(ALL_DIRS))
142 HS_OBJS = $(patsubst %, $(odir)/%, $(addsuffix .$(way_)o,$(basename $(HS_SRCS))))
143 C_OBJS = $(patsubst %, $(odir)/%, $(addsuffix .$(way_)o,$(basename $(C_SRCS))))
145 CLEAN_FILES += $(odir)/*/*.hi
148 mostlyclean clean distclean maintainer-clean ::
153 # -----------------------------------------------------------------------------
156 # Note: there have been reports of people running up against the ARG_MAX limit
157 # when linking ghc with all its constituent object files. The likely source of
158 # the problem is that the environment is a bit too big, so a workaround could
159 # be to do `env PATH=$(PATH) make ghc' to minimise the environment. (or the
160 # equivalent of `env' if it doesn't exist locally).
162 ifneq "$(BuildPackageGHC)" "YES"
164 ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
165 HS_PROG=$(odir)/ghc$(_way)-$(ProjectVersion)
167 HS_PROG=$(odir)/ghc$(_way)
170 HS_PROG=$(odir)/ghc-$(ProjectVersion)
174 # -----------------------------------------------------------------------------
175 # Create compiler configuration
177 # The 'echo' commands simply spit the values of various make variables
178 # into Config.hs, whence they can be compiled and used by GHC itself
180 CONFIG_HS = main/Config.hs
183 $(CONFIG_HS) : $(FPTOOLS_TOP)/mk/config.mk Makefile
184 @$(RM) -f $(CONFIG_HS)
185 @echo "Creating $(CONFIG_HS) ... "
186 @echo "module Config where" >>$(CONFIG_HS)
187 @echo "cProjectName = \"$(ProjectName)\"" >> $(CONFIG_HS)
188 @echo "cProjectVersion = \"$(ProjectVersion)\"" >> $(CONFIG_HS)
189 @echo "cProjectVersionInt = \"$(ProjectVersionInt)\"" >> $(CONFIG_HS)
190 @echo "cProjectPatchLevel = \"$(ProjectPatchLevel)\"" >> $(CONFIG_HS)
191 @echo "cBooterVersion = \"$(GhcVersion)\"" >> $(CONFIG_HS)
192 @echo "cHscIfaceFileVersion = \"$(HscIfaceFileVersion)\"" >> $(CONFIG_HS)
193 @echo "cHOSTPLATFORM = \"$(HOSTPLATFORM)\"" >> $(CONFIG_HS)
194 @echo "cTARGETPLATFORM = \"$(TARGETPLATFORM)\"" >> $(CONFIG_HS)
195 @echo "cGhcWithNativeCodeGen = \"$(GhcWithNativeCodeGen)\"" >> $(CONFIG_HS)
196 @echo "cGhcUnregisterised = \"$(GhcUnregisterised)\"" >> $(CONFIG_HS)
197 @echo "cLeadingUnderscore = \"$(LeadingUnderscore)\"" >> $(CONFIG_HS)
198 @echo "cRAWCPP_FLAGS = \"$(RAWCPP_FLAGS)\"" >> $(CONFIG_HS)
199 @echo "cGCC = \"$(WhatGccIsCalled)\"" >> $(CONFIG_HS)
200 @echo "cMKDLL = \"$(BLD_DLL)\"" >> $(CONFIG_HS)
201 @echo "cPROJECT_DIR = \"$(PROJECT_DIR)\"" >> $(CONFIG_HS)
202 @echo "cGHC_DRIVER_DIR_REL = \"$(GHC_DRIVER_DIR_REL)\"" >> $(CONFIG_HS)
203 @echo "cGHC_TOUCHY_PGM = \"$(GHC_TOUCHY_PGM)\"" >> $(CONFIG_HS)
204 @echo "cGHC_TOUCHY_DIR_REL = \"$(GHC_TOUCHY_DIR_REL)\"" >> $(CONFIG_HS)
205 @echo "cGHC_UNLIT_PGM = \"$(GHC_UNLIT_PGM)\"" >> $(CONFIG_HS)
206 @echo "cGHC_UNLIT_DIR_REL = \"$(GHC_UNLIT_DIR_REL)\"" >> $(CONFIG_HS)
207 @echo "cGHC_MANGLER_PGM = \"$(GHC_MANGLER_PGM)\"" >> $(CONFIG_HS)
208 @echo "cGHC_MANGLER_DIR_REL = \"$(GHC_MANGLER_DIR_REL)\"" >> $(CONFIG_HS)
209 @echo "cGHC_SPLIT_PGM = \"$(GHC_SPLIT_PGM)\"" >> $(CONFIG_HS)
210 @echo "cGHC_SPLIT_DIR_REL = \"$(GHC_SPLIT_DIR_REL)\"" >> $(CONFIG_HS)
211 @echo "cGHC_SYSMAN_PGM = \"$(GHC_SYSMAN)\"" >> $(CONFIG_HS)
212 @echo "cGHC_SYSMAN_DIR_REL = \"$(GHC_SYSMAN_DIR)\"" >> $(CONFIG_HS)
213 @echo "cGHC_CP = \"$(GHC_CP)\"" >> $(CONFIG_HS)
214 @echo "cGHC_PERL = \"$(GHC_PERL)\"" >> $(CONFIG_HS)
215 ifeq ($(GhcWithIlx),YES)
216 @echo "cILX2IL = \"$(ILX2IL)\"" >> $(CONFIG_HS)
217 @echo "cILASM = \"$(ILASM)\"" >> $(CONFIG_HS)
219 @echo "cEnableWin32DLLs = \"$(EnableWin32DLLs)\"" >> $(CONFIG_HS)
220 @echo "cCONTEXT_DIFF = \"$(CONTEXT_DIFF)\"" >> $(CONFIG_HS)
221 @echo "cUSER_WAY_NAMES = \"$(USER_WAY_NAMES)\"" >> $(CONFIG_HS)
222 @echo "cUSER_WAY_OPTS = \"$(USER_WAY_OPTS)\"" >> $(CONFIG_HS)
223 @echo "cDEFAULT_TMPDIR = \"$(DEFAULT_TMPDIR)\"" >> $(CONFIG_HS)
226 CLEAN_FILES += $(CONFIG_HS)
228 # -----------------------------------------------------------------------------
231 # First figure out ALL_DIRS, the source sub-directories
234 utils basicTypes types hsSyn prelude rename typecheck deSugar coreSyn \
235 specialise simplCore stranal stgSyn simplStg codeGen absCSyn main \
236 profiling parser cprAnalysis compMan ndpFlatten cbits iface
238 # Make sure we include Config.hs even if it doesn't exist yet...
239 ALL_SRCS += $(CONFIG_HS)
241 # HsGeneric.hs is not used just now
242 EXCLUDED_SRCS += hsSyn/HsGeneric.hs
244 ifeq ($(GhcWithNativeCodeGen),YES)
245 ALL_DIRS += nativeGen
247 SRC_HC_OPTS += -DOMIT_NATIVE_CODEGEN
250 ifeq ($(GhcWithIlx),YES)
255 ifeq ($(GhcWithJavaGen),YES)
257 SRC_HC_OPTS += -DJAVA
260 ifeq "$(BootingFromHc)" "YES"
261 # HC files are always from a self-booted compiler
263 compiling_with_4xx=NO
265 ifneq "$(findstring $(stage), 2 3)" ""
267 compiling_with_4xx = NO
269 bootstrapped = $(shell if (test $(GhcCanonVersion) -ge $(ProjectVersionInt) -a $(GhcPatchLevel) -ge $(ProjectPatchLevel)); then echo YES; else echo NO; fi)
270 compiling_with_4xx = $(shell if (test $(GhcCanonVersion) -lt 500); then echo YES; else echo NO; fi)
274 # Only include GHCi if we're bootstrapping with at least version 411
275 ifeq "$(GhcWithInterpreter) $(bootstrapped)" "YES YES"
276 # Yes, include the interpreter, readline, and Template Haskell extensions
277 SRC_HC_OPTS += -DGHCI -package template-haskell
278 ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
279 SRC_HC_OPTS += -package unix
280 ifeq "$(GhcLibsWithReadline)" "YES"
281 SRC_HC_OPTS += -package readline
286 # No interpreter, so exclude Template Haskell modules
287 EXCLUDED_SRCS += deSugar/DsMeta.hs typecheck/TcSplice.lhs hsSyn/Convert.lhs
290 # There are some C files to include in HS_PROG, so add these to HS_OBJS
293 # -----------------------------------------------
296 # Big Fudge to get around inherent problem that Makefile setup
297 # has got with 'mkdependC'.
299 SRC_MKDEPENDC_OPTS += -D__GLASGOW_HASKELL__=$(ProjectVersionInt)
301 # XXX not really correct, hschooks.c actually gets include files like
302 # RtsFlags.c from the installed GHC, but we can't tell mkdependC about that.
303 SRC_MKDEPENDC_OPTS += -I$(GHC_INCLUDE_DIR)
305 # -----------------------------------------------------------------------------
306 # Haskell compilations
309 -cpp -fglasgow-exts -Rghc-timing \
310 -I. -IcodeGen -InativeGen -Iparser
312 # Omitted: -I$(GHC_INCLUDE_DIR)
313 # We should have -I$(GHC_INCLUDE_DIR) in SRC_HC_OPTS,
314 # to avoid the use of an explicit path in GHC source files
315 # (include "../includes/config.h"
316 # But alas GHC 4.08 (and others for all I know) uses this very
317 # same include path when compiling the .hc files it generates.
318 # Disaster! Then the hc file sees the GHC 5.02 (or whatever)
319 # include files. For the moment we've reverted to using
320 # an explicit path in the .hs sources
322 # For the benefit of <5.00 compilers, do include GHC_INCLUDE_DIR
323 # when generating dependencies. (=> it gets passed onto mkdependHS,
325 SRC_MKDEPENDHS_OPTS += -I$(GHC_INCLUDE_DIR)
327 # When bootstrapped, we don't make use of *any* packages
328 # (except possibly readline if GHCi is enabled, see above)
329 ifneq "$(bootstrapped)" "YES"
330 ifneq "$(mingw32_HOST_OS)" "1"
331 SRC_HC_OPTS += -package concurrent -package posix -package util
333 SRC_HC_OPTS += -package concurrent -package util
337 SRC_CC_OPTS += -Iparser -I. -O
338 SRC_HC_OPTS += -recomp $(GhcHcOpts) $(GhcStage$(stage)HcOpts)
341 ifeq "$(BootingFromHc)" "YES"
342 SRC_CC_OPTS += -D__GLASGOW_HASKELL__=$(ProjectVersionInt)
345 # Special flags for particular modules
346 # The standard suffix rule for compiling a Haskell file
347 # adds these flags to the command line
349 # There used to be a -no-recomp flag on PrimOp, but why?
350 # It's an expensive module to recompile!
351 prelude/PrimOp_HC_OPTS = -H80m
353 # because the NCG can't handle the 64-bit math in here
354 prelude/PrelRules_HC_OPTS = -fvia-C
356 main/ParsePkgConf_HC_OPTS += -fno-warn-incomplete-patterns
357 # Use -fvia-C since the NCG can't handle the narrow16Int# (and intToInt16#?)
358 # primops on all platforms.
359 parser/Parser_HC_OPTS += -fno-warn-incomplete-patterns -fvia-C
361 # Careful optimisation of the parser: we don't want to throw everything
362 # at it, because that takes too long and doesn't buy much, but we do want
363 # to inline certain key external functions, so we instruct GHC not to
364 # throw away inlinings as it would normally do in -Onot mode:
365 parser/Parser_HC_OPTS += -Onot -fno-ignore-interface-pragmas
367 ifeq "$(HOSTPLATFORM)" "hppa1.1-hp-hpux9"
368 rename/RnMonad_HC_OPTS = -O2 -O2-for-C
371 utils/Digraph_HC_OPTS = -fglasgow-exts
373 basicTypes/SrcLoc_HC_OPTS = -funbox-strict-fields
375 ifeq "$(bootstrapped)" "YES"
376 utils/Binary_HC_OPTS = -funbox-strict-fields
379 # 4.08.2's NCG can't cope with Binary
380 ifeq "$(compiling_with_4xx)" "YES"
381 utils/Binary_HC_OPTS += -fvia-C
384 # ByteCodeItbls uses primops that the NCG doesn't support yet.
385 ghci/ByteCodeItbls_HC_OPTS += -fvia-C
386 ghci/ByteCodeLink_HC_OPTS += -fvia-C -monly-3-regs
388 # BinIface and Binary take ages to both compile and run if you don's use -O
389 main/BinIface_HC_OPTS += -O
390 utils/Binary_HC_OPTS += -O
391 utils/FastMutInt_HC_OPTS += -O
394 # CSE interacts badly with top-level IORefs (reportedly in DriverState and
395 # DriverMkDepend), causing some of them to be commoned up. We have a fix for
396 # this in 5.00+, but earlier versions of the compiler will need CSE turned off.
397 # To be on the safe side, we disable CSE in *all* modules with top-level IORefs.
398 compMan/CompManager_HC_OPTS = -fno-cse
399 ghci/InteractiveUI_HC_OPTS = -fno-cse
400 main/CmdLineOpts_HC_OPTS = -fno-cse
401 main/DriverFlags_HC_OPTS = -fno-cse
402 main/DriverMkDepend_HC_OPTS = -fno-cse
403 main/DriverPipeline_HC_OPTS = -fno-cse
404 main/DriverState_HC_OPTS = -fno-cse
405 main/DriverUtil_HC_OPTS = -fno-cse
406 main/Finder_HC_OPTS = -fno-cse
407 main/SysTools_HC_OPTS = -fno-cse
409 # The #include is vital for the via-C route, else the C
410 # compiler doesn't realise that the stcall foreign imports are indeed
411 # stdcall, and doesn't generate the Foo@8 name for them
412 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
413 main/SysTools_HC_OPTS += '-\#include <windows.h>' '-\#include <process.h>'
416 # Required due to use of Concurrent.myThreadId
417 utils/Panic_HC_OPTS += -fvia-C
419 parser/Lexer_HC_OPTS += -funbox-strict-fields
421 # ghc_strlen percolates through so many modules that it is easier to get its
422 # prototype via a global option instead of a myriad of per-file OPTIONS
423 SRC_HC_OPTS += '-\#include "hschooks.h"'
425 # ----------------------------------------------------------------------------
426 # Generate supporting stuff for prelude/PrimOp.lhs
427 # from prelude/primops.txt
429 GENPOC=$(TOP)/utils/genprimopcode/genprimopcode
431 PRIMOP_BITS=primop-data-decl.hs-incl \
433 primop-list.hs-incl \
434 primop-has-side-effects.hs-incl \
435 primop-out-of-line.hs-incl \
436 primop-commutable.hs-incl \
437 primop-needs-wrapper.hs-incl \
438 primop-can-fail.hs-incl \
439 primop-strictness.hs-incl \
440 primop-primop-info.hs-incl
442 CLEAN_FILES += prelude/primops.txt
443 CLEAN_FILES += $(PRIMOP_BITS)
445 SRC_CPP_OPTS += -I$(GHC_INCLUDE_DIR)
446 SRC_CPP_OPTS += ${GhcCppOpts}
448 ifneq "$(BootingFromHc)" "YES"
449 prelude/PrimOp.lhs $(odir)/prelude/PrimOp.o: $(PRIMOP_BITS)
452 ifneq "$(BootingFromHc)" "YES"
453 depend :: $(PRIMOP_BITS)
456 primop-data-decl.hs-incl: prelude/primops.txt
457 $(GENPOC) --data-decl < $< > $@
458 primop-tag.hs-incl: prelude/primops.txt
459 $(GENPOC) --primop-tag < $< > $@
460 primop-list.hs-incl: prelude/primops.txt
461 $(GENPOC) --primop-list < $< > $@
462 primop-has-side-effects.hs-incl: prelude/primops.txt
463 $(GENPOC) --has-side-effects < $< > $@
464 primop-out-of-line.hs-incl: prelude/primops.txt
465 $(GENPOC) --out-of-line < $< > $@
466 primop-commutable.hs-incl: prelude/primops.txt
467 $(GENPOC) --commutable < $< > $@
468 primop-needs-wrapper.hs-incl: prelude/primops.txt
469 $(GENPOC) --needs-wrapper < $< > $@
470 primop-can-fail.hs-incl: prelude/primops.txt
471 $(GENPOC) --can-fail < $< > $@
472 primop-strictness.hs-incl: prelude/primops.txt
473 $(GENPOC) --strictness < $< > $@
474 primop-primop-info.hs-incl: prelude/primops.txt
475 $(GENPOC) --primop-primop-info < $< > $@
477 # Usages aren't used any more; but the generator
478 # can still generate them if we want them back
479 primop-usage.hs-incl: prelude/primops.txt
480 $(GENPOC) --usage < $< > $@
483 #-----------------------------------------------------------------------------
486 SRC_LD_OPTS += -no-link-chk
488 # -----------------------------------------------------------------------------
489 # create ghc-inplace, a convenient way to run ghc from the build tree...
491 all :: $(odir)/ghc-inplace ghc-inplace
493 $(odir)/ghc-inplace : $(HS_PROG)
495 echo '#!/bin/sh' >>$@
496 echo exec $(FPTOOLS_TOP_ABS)/ghc/compiler/$(HS_PROG) '-B$(subst \,\\,$(FPTOOLS_TOP_ABS_PLATFORM))' '"$$@"' >>$@
499 ghc-inplace : stage1/ghc-inplace
502 CLEAN_FILES += $(odir)/ghc-inplace ghc-inplace
504 #-----------------------------------------------------------------------------
507 # We don't want ghc treated as an ordinary executable,
508 # but put it together with the libraries.
509 # Also don't want any interface files installed
511 DESTDIR = $(INSTALL_LIBRARY_DIR_GHC)
513 ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
514 INSTALL_LIBEXECS += $(HS_PROG)
516 INSTALL_PROGS += $(HS_PROG)
519 # ----------------------------------------------------------------------------
522 # rename/RnBinds_HC_OPTS += -auto-all
523 # rename/RnEnv_HC_OPTS += -auto-all
524 # rename/RnExpr_HC_OPTS += -auto-all
525 # rename/RnHiFiles_HC_OPTS += -auto-all
526 # rename/RnHsSyn_HC_OPTS += -auto-all
527 # rename/Rename_HC_OPTS += -auto-all
528 # rename/RnIfaces_HC_OPTS += -auto-all
529 # rename/RnNames_HC_OPTS += -auto-all
530 # rename/RnSource_HC_OPTS += -auto-all
531 # rename/RnTypes_HC_OPTS += -auto-all
533 # typecheck/Inst_HC_OPTS += -auto-all
534 # typecheck/TcBinds_HC_OPTS += -auto-all
535 # typecheck/TcClassDcl_HC_OPTS += -auto-all
536 # typecheck/TcDefaults_HC_OPTS += -auto-all
537 # typecheck/TcDeriv_HC_OPTS += -auto-all
538 # typecheck/TcEnv_HC_OPTS += -auto-all
539 # typecheck/TcExpr_HC_OPTS += -auto-all
540 # typecheck/TcForeign_HC_OPTS += -auto-all
541 # typecheck/TcGenDeriv_HC_OPTS += -auto-all
542 # typecheck/TcHsSyn_HC_OPTS += -auto-all
543 # typecheck/TcIfaceSig_HC_OPTS += -auto-all
544 # typecheck/TcInstDcls_HC_OPTS += -auto-all
545 # typecheck/TcMatches_HC_OPTS += -auto-all
546 # typecheck/TcMonoType_HC_OPTS += -auto-all
547 # typecheck/TcMType_HC_OPTS += -auto-all
548 # typecheck/TcPat_HC_OPTS += -auto-all
549 # typecheck/TcRnDriver_HC_OPTS += -auto-all
550 # #typecheck/TcRnMonad_HC_OPTS += -auto-all
551 # #typecheck/TcRnTypes_HC_OPTS += -auto-all
552 # typecheck/TcRules_HC_OPTS += -auto-all
553 # typecheck/TcSimplify_HC_OPTS += -auto-all
554 # typecheck/TcSplice_HC_OPTS += -auto-all
555 # typecheck/TcTyClsDecls_HC_OPTS += -auto-all
556 # typecheck/TcTyDecls_HC_OPTS += -auto-all
557 # typecheck/TcType_HC_OPTS += -auto-all
558 # typecheck/TcUnify_HC_OPTS += -auto-all
560 # absCSyn/PprAbsC_HC_OPTS += -auto-all
562 coreSyn/CorePrep_HC_OPTS += -auto-all
564 #-----------------------------------------------------------------------------
565 # Building GHC package
567 ifeq "$(BuildPackageGHC)" "YES"
570 STANDALONE_PACKAGE = YES
571 PACKAGE_DEPS = base haskell98
575 #-----------------------------------------------------------------------------
578 MAINTAINER_CLEAN_FILES += parser/Parser.info main/ParsePkgConf.info
580 #-----------------------------------------------------------------------------
581 # Include target-rule boilerplate
583 # Don't use the default MKDEPENDHS stuff... we'll do our own, below
587 # Make doesn't work this out for itself, it seems
588 parser/Parser.y : parser/Parser.y.pp
589 EXTRA_SRCS += parser/Parser.y
591 include $(TOP)/mk/target.mk
593 # -----------------------------------------------------------------------------
596 MKDEPENDHS_HC_OPTS = $(patsubst -i$(odir)/%, -i%, $(HC_OPTS))
600 # Must do this *after* including target.mk, because $(HS_SRCS) isn't set yet.
601 depend :: $(HS_SRCS) $(C_SRCS)
603 ifneq "$(BootingFromHc)" "YES"
604 $(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)
606 $(MKDEPENDC) -f .depend-BASE $(MKDEPENDC_OPTS) $(foreach way,$(WAYS),-s $(way)) -- $(CC_OPTS) -- $(C_SRCS)
607 $(PERL) -pe 'binmode(stdin); binmode(stdout); s@^(\S*\.o)@stage$(stage)/$$1@g; s@(\S*\.hi)@stage$(stage)/$$1@g' <.depend-BASE >.depend-$(stage)
608 # The binmode stuff tells perl not to add stupid ^M's to the output
610 -include .depend-$(stage)