Fix GHC finding extra-gcc-opts on Windows
[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 build.stage1:
48         $(CABAL) configure --distpref dist-stage1 \
49                            --flags=-ghci \
50                            $(SET_DATA_SUBDIR) \
51                            $(INSTALL_DIRS_CONFIGURE_FLAGS) \
52                            $(USE_BOOT_CONFIGURE_FLAGS) \
53                            $(COMMON_CONFIGURE_FLAGS)
54         $(CABAL) build     --distpref dist-stage1 $(BUILD_FLAGS)
55         $(INSTALL_PACKAGE) install '$(GHC_PKG_PROG)' 'XXX/package.conf' "" \
56                            $(FPTOOLS_TOP_ABS)/ghc/stage1-inplace \
57                            $(FPTOOLS_TOP_ABS)/ghc/stage1-inplace \
58                            '$$prefix/bin' \
59                            '$$prefix/lib' \
60                            '$$prefix/libexec' \
61                            '$$prefix/dynlib' \
62                            $(INPLACE_DATA_DIR) \
63                            '$$prefix/doc' \
64                            '$$prefix/html' \
65                            '$$prefix/haddock' \
66                            --distpref dist-stage1 \
67                            $(INSTALL_FLAGS)
68
69 ifeq "$(GhcWithInterpreter)" "YES"
70 CONFIGURE_FLAGS_STAGE2 += --flags=ghci
71 else
72 CONFIGURE_FLAGS_STAGE2 += --flags=-ghci
73 endif
74
75 ifeq "$(GhcProfiled)" "YES"
76 CONFIGURE_FLAGS_STAGE2 += --enable-executable-profiling
77 endif
78 ifeq "$(GhcDebugged)" "YES"
79 CONFIGURE_FLAGS_STAGE2 += --ghc-option=-debug
80 endif
81 ifeq "$(GhcThreaded)" "YES"
82 # Use threaded RTS with GHCi, so threads don't get blocked at the prompt.
83 CONFIGURE_FLAGS_STAGE2 += --ghc-option=-threaded
84 endif
85
86 # XXX In stage2 we should really use the inplace ghc-pkg
87 # It works because installPackage doesn't actually use ghc-pkg, as there's
88 # no library to register
89
90 build.stage2:
91         $(CABAL) configure --distpref dist-stage2 \
92                            $(SET_DATA_SUBDIR) \
93                            $(CONFIGURE_FLAGS_STAGE2) \
94                            $(INSTALL_DIRS_CONFIGURE_FLAGS) \
95                            $(USE_STAGE1_CONFIGURE_FLAGS) \
96                            $(COMMON_CONFIGURE_FLAGS)
97         $(CABAL) build     --distpref dist-stage2 $(BUILD_FLAGS)
98         $(INSTALL_PACKAGE) install '$(GHC_PKG_PROG)' 'XXX/package.conf' "" \
99                            $(FPTOOLS_TOP_ABS)/ghc/stage2-inplace \
100                            $(FPTOOLS_TOP_ABS)/ghc/stage2-inplace \
101                            '$$prefix/bin' \
102                            '$$prefix/lib' \
103                            '$$prefix/libexec' \
104                            '$$prefix/dynlib' \
105                            $(INPLACE_DATA_DIR) \
106                            '$$prefix/doc' \
107                            '$$prefix/html' \
108                            '$$prefix/haddock' \
109                            --distpref dist-stage2 \
110                            $(INSTALL_FLAGS)
111
112 # XXX fix:
113 #binary-dist:
114 #       $(INSTALL_DIR)                      $(BIN_DIST_DIR)/utils/hsc2hs
115 #       $(INSTALL_DATA)    Makefile         $(BIN_DIST_DIR)/utils/hsc2hs/
116 #       $(INSTALL_DATA)    hsc2hs.sh        $(BIN_DIST_DIR)/utils/hsc2hs/
117 #       $(INSTALL_DATA)    $(INSTALL_DATAS) $(BIN_DIST_DIR)/utils/hsc2hs/
118 #       $(INSTALL_PROGRAM) $(HS_PROG)       $(BIN_DIST_DIR)/utils/hsc2hs/
119