3 include $(TOP)/mk/boilerplate.mk
4 include $(TOP)/mk/cabal-flags.mk
10 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
13 INSTALL_FLAGS = --enable-shell-wrappers
16 # Don't strip the inplace versions, we might need to debug them
17 INPLACE_INSTALL_FLAGS += --disable-executable-stripping
19 boot:: boot.stage.$(stage)
21 all:: build.stage.$(stage)
24 -$(CABAL) clean --distpref dist-stage$(stage)
25 $(RM) -rf stage$(stage)-inplace
37 ifeq "$(CLEAN_ALL_STAGES)" "YES"
38 clean distclean:: clean.stage.1 clean.stage.2 clean.stage.3
40 clean distclean:: clean.stage.$(stage)
44 -$(CABAL) clean --distpref dist-stage$*
45 $(RM) -rf stage$*-inplace
47 CONFIGURE_FLAGS_STAGE1 += --flags=-ghci
49 ifeq "$(GhcWithInterpreter)" "YES"
50 CONFIGURE_FLAGS_STAGE2PLUS += --flags=ghci
52 CONFIGURE_FLAGS_STAGE2PLUS += --flags=-ghci
55 ifeq "$(GhcProfiled)" "YES"
56 CONFIGURE_FLAGS_STAGE2PLUS += --enable-executable-profiling
58 ifeq "$(GhcDebugged)" "YES"
59 CONFIGURE_FLAGS_STAGE2PLUS += --ghc-option=-debug
61 ifeq "$(GhcThreaded)" "YES"
62 # Use threaded RTS with GHCi, so threads don't get blocked at the prompt.
63 CONFIGURE_FLAGS_STAGE2PLUS += --ghc-option=-threaded
66 ifeq "$(BuildSharedLibs)" "YES"
67 CONFIGURE_FLAGS_STAGE2PLUS += --ghc-option=-dynamic
70 CONFIGURE_FLAGS_STAGE2 = $(CONFIGURE_FLAGS_STAGE2PLUS)
71 CONFIGURE_FLAGS_STAGE3 = $(CONFIGURE_FLAGS_STAGE2PLUS)
73 CONFIGURE_FLAGS_STAGE1 += $(USE_BOOT_CONFIGURE_FLAGS)
74 CONFIGURE_FLAGS_STAGE2 += $(USE_STAGE1_CONFIGURE_FLAGS)
75 CONFIGURE_FLAGS_STAGE3 += $(USE_STAGE2_CONFIGURE_FLAGS)
77 CONFIGURE_FLAGS_STAGE1 += $(foreach flag, $(GhcStage1HcOpts), --ghc-option=$(flag))
78 CONFIGURE_FLAGS_STAGE2 += $(foreach flag, $(GhcStage2HcOpts), --ghc-option=$(flag))
79 CONFIGURE_FLAGS_STAGE3 += $(foreach flag, $(GhcStage3HcOpts), --ghc-option=$(flag))
81 # Allow EXTRA_HC_OPTS to be used from the command line to add options
82 # when building (e.g. -v)
83 BUILD_FLAGS=$(patsubst %, --ghc-option=%, $(EXTRA_HC_OPTS))
85 # XXX In stage2+ we should really use the inplace ghc-pkg
86 # It works because installPackage doesn't actually use ghc-pkg, as there's
87 # no library to register
90 ifeq "$(ghc_ge_609)" "NO"
91 # GHC 6.9+ can handle cross-package recompilation checking, but
92 # we don't rely on the bootstrapping compiler being able to do this.
93 TOUCH_MAIN = $(RM) dist-stage1/build/ghc/ghc-tmp/Main.o
97 dist-stage1 dist-stage2 dist-stage3: dist-stage%: boot.stage.%
100 $(CABAL) configure --distpref dist-stage$* \
101 $(INSTALL_DIRS_CONFIGURE_FLAGS) \
102 $(CONFIGURE_FLAGS_STAGE$*) \
103 $(COMMON_CONFIGURE_FLAGS) \
105 --datadir='$$libdir' \
108 build.stage.%: dist-stage%
110 $(CABAL) build --distpref dist-stage$* $(BUILD_FLAGS)
111 $(INSTALL_PACKAGE) install '$(GHC_PKG_PROG)' 'XXX/package.conf' "" \
112 $(FPTOOLS_TOP_ABS)/ghc/stage$*-inplace \
113 $(FPTOOLS_TOP_ABS)/ghc/stage$*-inplace \
115 '$(INPLACE_DATA_DIR)' \
118 '$(INPLACE_DATA_DIR)' \
122 --distpref dist-stage$* \
123 $(INPLACE_INSTALL_FLAGS) \
126 # XXX For now we always install the stage 2 compiler
128 $(INSTALL_PACKAGE) install UNUSED UNUSED '$(DESTDIR)' '$(prefix)' \
129 '$(prefix)' '$(bindir)' '$(libdir)' \
130 '$(libexecdir)' '$(dynlibdir)' '$(datadir)' \
131 '$(docdir)' '$(htmldir)' '$(haddockdir)' \
132 --distpref dist-stage2 \
141 include $(TOP)/mk/bindist.mk
142 EXE_DIST_DIR = dist-stage2