When installing, we can't rely on the ghc-pkg we just installed to work
[ghc-hetmet.git] / mk / cabal.mk
1
2 include $(TOP)/mk/cabal-flags.mk
3 include $(TOP)/mk/bindist.mk
4
5 SRC_HC_OPTS      += -Wall
6
7 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
8 INSTALL_FLAGS =
9 else
10 ifeq "$(ENABLE_SHELL_WRAPPERS)" "YES"
11 INSTALL_FLAGS = --enable-shell-wrappers
12 else
13 INSTALL_FLAGS =
14 endif
15 endif
16
17 # Tell stage2 to make a dynamically-linked binary, but no wrapper.  We assume
18 # that in an installation the shared libs will be installed somewhere that
19 # the system can find them.
20 ifeq "$(BuildSharedLibs)" "YES"
21 DYN_FLAGS = --ghc-option=-dynamic --ghc-option=-dynload --ghc-option=deploy
22 endif
23
24 .PHONY: default all with-bootstrapping-compiler with-stage-2 clean distclean
25
26 default all: with-bootstrapping-compiler
27
28 with-bootstrapping-compiler:
29         $(CABAL) configure --distpref dist-inplace          \
30                            $(INPLACE_DIRS_CONFIGURE_FLAGS)  \
31                            $(USE_BOOT_CONFIGURE_FLAGS)      \
32                            $(COMMON_CONFIGURE_FLAGS)        \
33                            $(EXTRA_INPLACE_CONFIGURE_FLAGS)
34         $(CABAL) build     --distpref dist-inplace $(BUILD_FLAGS)
35         $(CABAL) install   --distpref dist-inplace $(INSTALL_FLAGS)
36
37 with-stage-2:
38         $(CABAL) configure --distpref dist-install         \
39                            $(INSTALL_DIRS_CONFIGURE_FLAGS) \
40                            $(USE_STAGE2_CONFIGURE_FLAGS)   \
41                            $(COMMON_CONFIGURE_FLAGS)       \
42                            $(EXTRA_STAGE2_CONFIGURE_FLAGS)
43         $(CABAL) build     --distpref dist-install $(DYN_FLAGS) $(BUILD_FLAGS)
44
45 install:
46         $(INSTALL_PACKAGE) install                                        \
47                            '$(GHC_PKG_INSTALL_PROG)'                      \
48                            '$(DESTDIR)$(datadir)/package.conf'            \
49                            '$(DESTDIR)' '$(prefix)'                       \
50                            '$(prefix)' '$(bindir)' '$(libdir)'            \
51                            '$(libexecdir)' '$(dynlibdir)' '$(datadir)'    \
52                            '$(docdir)' '$(htmldir)' '$(haddockdir)'       \
53                            --distpref dist-install                        \
54                            $(INSTALL_FLAGS)
55
56 clean:
57         -$(CABAL) clean --distpref dist-inplace
58         -$(CABAL) clean --distpref dist-install
59 ifneq "$(EXTRA_CLEAN)" ""
60         $(RM) -f $(EXTRA_CLEAN)
61 endif
62
63 distclean: clean
64 ifneq "$(EXTRA_DISTCLEAN)" ""
65         $(RM) -f $(EXTRA_DISTCLEAN)
66 endif
67