put the inplace GHC in stageN-inplace/ghc instead of stageN-inplace/bin/ghc
[ghc.git] / ghc / Makefile
1
2 TOP=..
3 include $(TOP)/mk/boilerplate.mk
4 include $(TOP)/mk/cabal-flags.mk
5
6 ifeq "$(stage)" ""
7 stage=1
8 endif
9
10 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
11 INSTALL_FLAGS =
12 else
13 INSTALL_FLAGS = --enable-shell-wrappers
14 endif
15
16 boot:: boot.stage.$(stage)
17
18 all:: build.stage.$(stage)
19
20 rebuild ::
21 -$(CABAL) clean --distpref dist-stage$(stage)
22 $(RM) -rf stage$(stage)-inplace
23 $(MAKE) boot all
24
25 stage1 ::
26 $(MAKE) stage=1
27
28 stage2 ::
29 $(MAKE) stage=2
30
31 stage3 ::
32 $(MAKE) stage=3
33
34 clean distclean::
35 -$(CABAL) clean --distpref dist-stage1
36 -$(CABAL) clean --distpref dist-stage2
37 -$(CABAL) clean --distpref dist-stage3
38 $(RM) -rf stage1-inplace
39 $(RM) -rf stage2-inplace
40 $(RM) -rf stage3-inplace
41
42 # XXX This should be defined somewhere more central
43 INPLACE_DATA_DIR = $(FPTOOLS_TOP_ABS)/inplace-datadir
44
45 CONFIGURE_FLAGS_STAGE1 += --flags=-ghci
46
47 ifeq "$(GhcWithInterpreter)" "YES"
48 CONFIGURE_FLAGS_STAGE2 += --flags=ghci
49 else
50 CONFIGURE_FLAGS_STAGE2 += --flags=-ghci
51 endif
52
53 ifeq "$(GhcProfiled)" "YES"
54 CONFIGURE_FLAGS_STAGE2 += --enable-executable-profiling
55 endif
56 ifeq "$(GhcDebugged)" "YES"
57 CONFIGURE_FLAGS_STAGE2 += --ghc-option=-debug
58 endif
59 ifeq "$(GhcThreaded)" "YES"
60 # Use threaded RTS with GHCi, so threads don't get blocked at the prompt.
61 CONFIGURE_FLAGS_STAGE2 += --ghc-option=-threaded
62 endif
63
64 CONFIGURE_FLAGS_STAGE3 = $(CONFIGURE_FLAGS_STAGE2)
65
66 CONFIGURE_FLAGS_STAGE1 += $(USE_BOOT_CONFIGURE_FLAGS)
67 CONFIGURE_FLAGS_STAGE2 += $(USE_STAGE1_CONFIGURE_FLAGS)
68 CONFIGURE_FLAGS_STAGE3 += $(USE_STAGE2_CONFIGURE_FLAGS)
69
70 # XXX In stage2+ we should really use the inplace ghc-pkg
71 # It works because installPackage doesn't actually use ghc-pkg, as there's
72 # no library to register
73
74 boot.stage.%:
75 $(CABAL) configure --distpref dist-stage$* \
76 $(INSTALL_DIRS_CONFIGURE_FLAGS) \
77 $(CONFIGURE_FLAGS_STAGE$*) \
78 $(COMMON_CONFIGURE_FLAGS) \
79 --libsubdir=. \
80 --datadir='$$libdir' \
81 --datasubdir=.
82
83 build.stage.%:
84 $(CABAL) build --distpref dist-stage$* $(BUILD_FLAGS)
85 $(INSTALL_PACKAGE) install '$(GHC_PKG_PROG)' 'XXX/package.conf' "" \
86 $(FPTOOLS_TOP_ABS)/ghc/stage$*-inplace \
87 $(FPTOOLS_TOP_ABS)/ghc/stage$*-inplace \
88 '$$prefix' \
89 '$(INPLACE_DATA_DIR)' \
90 '$$prefix/libexec' \
91 '$$prefix/dynlib' \
92 '$(INPLACE_DATA_DIR)' \
93 '$$prefix/doc' \
94 '$$prefix/html' \
95 '$$prefix/haddock' \
96 --distpref dist-stage$* \
97 $(INSTALL_FLAGS)
98
99 # XXX For now we always install the stage 2 compiler
100 install:
101 $(INSTALL_PACKAGE) install UNUSED UNUSED '$(DESTDIR)' '$(prefix)' \
102 '$(prefix)' '$(bindir)' '$(libdir)' \
103 '$(libexecdir)' '$(dynlibdir)' '$(libdir)' \
104 '$(docdir)' '$(htmldir)' '$(haddockdir)' \
105 --distpref dist-stage2 \
106 $(INSTALL_FLAGS)
107
108 # XXX fix:
109 #binary-dist:
110 # $(INSTALL_DIR) $(BIN_DIST_DIR)/utils/hsc2hs
111 # $(INSTALL_DATA) Makefile $(BIN_DIST_DIR)/utils/hsc2hs/
112 # $(INSTALL_DATA) hsc2hs.sh $(BIN_DIST_DIR)/utils/hsc2hs/
113 # $(INSTALL_DATA) $(INSTALL_DATAS) $(BIN_DIST_DIR)/utils/hsc2hs/
114 # $(INSTALL_PROGRAM) $(HS_PROG) $(BIN_DIST_DIR)/utils/hsc2hs/
115