Update the build system to handle building and using haddock2
[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 UNUSED UNUSED '$(DESTDIR)' '$(prefix)' \
47                            '$(prefix)' '$(bindir)' '$(libdir)'            \
48                        '$(libexecdir)' '$(dynlibdir)' '$(datadir)'    \
49                        '$(docdir)' '$(htmldir)' '$(haddockdir)'       \
50                            --distpref dist-install                        \
51                            $(INSTALL_FLAGS)
52
53 clean:
54         -$(CABAL) clean --distpref dist-inplace
55         -$(CABAL) clean --distpref dist-install
56 ifneq "$(EXTRA_CLEAN)" ""
57         $(RM) -f $(EXTRA_CLEAN)
58 endif
59
60 distclean: clean
61 ifneq "$(EXTRA_DISTCLEAN)" ""
62         $(RM) -f $(EXTRA_DISTCLEAN)
63 endif
64