Install the compiler during make install
[ghc-hetmet.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:
17         @:
18
19 all:: build.stage.$(stage)
20
21 stage1 ::
22         $(MAKE) stage=1
23
24 stage2 ::
25         $(MAKE) stage=2
26
27 stage3 ::
28         $(MAKE) stage=3
29
30 clean distclean::
31         -$(CABAL) clean --distpref dist-stage1
32         -$(CABAL) clean --distpref dist-stage2
33         $(RM) -rf stage1-inplace
34         $(RM) -rf stage2-inplace
35
36 # XXX Eugh, can we do this better? The problem is making extra-gcc-opts
37 # infdable on both Linux and Windows. I guess this will go away when we
38 # drop the mangler?
39 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
40 SET_DATA_SUBDIR = --datasubdir=.
41 INPLACE_DATA_DIR = '$$prefix'
42 else
43 SET_DATA_SUBDIR =
44 INPLACE_DATA_DIR = '$$prefix/data'
45 endif
46
47 CONFIGURE_FLAGS_STAGE1 += --flags=-ghci
48
49 ifeq "$(GhcWithInterpreter)" "YES"
50 CONFIGURE_FLAGS_STAGE2 += --flags=ghci
51 else
52 CONFIGURE_FLAGS_STAGE2 += --flags=-ghci
53 endif
54
55 ifeq "$(GhcProfiled)" "YES"
56 CONFIGURE_FLAGS_STAGE2 += --enable-executable-profiling
57 endif
58 ifeq "$(GhcDebugged)" "YES"
59 CONFIGURE_FLAGS_STAGE2 += --ghc-option=-debug
60 endif
61 ifeq "$(GhcThreaded)" "YES"
62 # Use threaded RTS with GHCi, so threads don't get blocked at the prompt.
63 CONFIGURE_FLAGS_STAGE2 += --ghc-option=-threaded
64 endif
65
66 CONFIGURE_FLAGS_STAGE3 = $(CONFIGURE_FLAGS_STAGE2)
67
68 CONFIGURE_FLAGS_STAGE1 += $(USE_BOOT_CONFIGURE_FLAGS)
69 CONFIGURE_FLAGS_STAGE2 += $(USE_STAGE1_CONFIGURE_FLAGS)
70 CONFIGURE_FLAGS_STAGE3 += $(USE_STAGE2_CONFIGURE_FLAGS)
71
72 # XXX In stage2+ we should really use the inplace ghc-pkg
73 # It works because installPackage doesn't actually use ghc-pkg, as there's
74 # no library to register
75
76 build.stage.%:
77         $(CABAL) configure --distpref dist-stage$* \
78                            $(SET_DATA_SUBDIR) \
79                            $(INSTALL_DIRS_CONFIGURE_FLAGS) \
80                            $(CONFIGURE_FLAGS_STAGE$*) \
81                            $(COMMON_CONFIGURE_FLAGS)
82         $(CABAL) build     --distpref dist-stage$* $(BUILD_FLAGS)
83         $(INSTALL_PACKAGE) install '$(GHC_PKG_PROG)' 'XXX/package.conf' "" \
84                            $(FPTOOLS_TOP_ABS)/ghc/stage$*-inplace \
85                            $(FPTOOLS_TOP_ABS)/ghc/stage$*-inplace \
86                            '$$prefix/bin' \
87                            '$$prefix/lib' \
88                            '$$prefix/libexec' \
89                            '$$prefix/dynlib' \
90                            $(INPLACE_DATA_DIR) \
91                            '$$prefix/doc' \
92                            '$$prefix/html' \
93                            '$$prefix/haddock' \
94                            --distpref dist-stage$* \
95                            $(INSTALL_FLAGS)
96
97 # XXX For now we always install the stage 2 compiler
98 install:
99         $(INSTALL_PACKAGE) install UNUSED UNUSED '$(DESTDIR)' '$(prefix)' \
100                            '$(prefix)' '$(bindir)' '$(libdir)'            \
101                        '$(libexecdir)' '$(dynlibdir)' '$(datadir)'    \
102                        '$(docdir)' '$(htmldir)' '$(haddockdir)'       \
103                            --distpref dist-stage2                         \
104                            $(INSTALL_FLAGS)
105
106 # XXX fix:
107 #binary-dist:
108 #       $(INSTALL_DIR)                      $(BIN_DIST_DIR)/utils/hsc2hs
109 #       $(INSTALL_DATA)    Makefile         $(BIN_DIST_DIR)/utils/hsc2hs/
110 #       $(INSTALL_DATA)    hsc2hs.sh        $(BIN_DIST_DIR)/utils/hsc2hs/
111 #       $(INSTALL_DATA)    $(INSTALL_DATAS) $(BIN_DIST_DIR)/utils/hsc2hs/
112 #       $(INSTALL_PROGRAM) $(HS_PROG)       $(BIN_DIST_DIR)/utils/hsc2hs/
113