More build system changes; ghc-pkg is now built with Cabal
[ghc-hetmet.git] / utils / ghc-pkg / Makefile
1
2 TOP=../..
3 include $(TOP)/mk/boilerplate.mk
4 include $(TOP)/mk/cabal-flags.mk
5
6 SRC_HC_OPTS += -Wall
7
8 # XXX From old Makefile:
9 # SRC_HC_OPTS += -cpp -Wall -fno-warn-name-shadowing -fno-warn-unused-matches
10
11 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
12 INSTALL_FLAGS =
13 else
14 INSTALL_FLAGS = --enable-shell-wrappers
15 endif
16
17 default all: with-bootstrapping-compiler
18
19 with-bootstrapping-compiler: Version.hs
20         $(CABAL) configure --distpref dist-inplace         \
21                            $(INPLACE_DIRS_CONFIGURE_FLAGS) \
22                            $(USE_BOOT_CONFIGURE_FLAGS)     \
23                            $(COMMON_CONFIGURE_FLAGS)
24         $(CABAL) build     --distpref dist-inplace $(BUILD_FLAGS)
25         $(CABAL) install   --distpref dist-inplace $(INSTALL_FLAGS)
26
27 with-stage-1: Version.hs
28         $(CABAL) configure --distpref dist-install         \
29                            $(INSTALL_DIRS_CONFIGURE_FLAGS) \
30                            $(USE_STAGE1_CONFIGURE_FLAGS)   \
31                            $(COMMON_CONFIGURE_FLAGS)
32         $(CABAL) build     --distpref dist-install $(BUILD_FLAGS)
33
34 install:
35         $(INSTALL_PACKAGE) install UNUSED UNUSED '$(DESTDIR)' '$(prefix)' \
36                            '$(prefix)' '$(bindir)' '$(libdir)'            \
37                        '$(libexecdir)' '$(dynlibdir)' '$(datadir)'    \
38                        '$(docdir)' '$(htmldir)' '$(haddockdir)'
39                            --distpref dist-install                        \
40                            $(INSTALL_FLAGS)
41
42 clean: distclean
43
44 distclean:
45         -$(CABAL) clean --distpref dist-inplace
46         -$(CABAL) clean --distpref dist-install
47         $(RM) -f Version.hs
48
49 # XXX fix binary-dist
50
51 ##### Here down is unique to ghc-pkg
52
53 Version.hs: Makefile $(TOP)/mk/config.mk
54         $(RM) -f Version.hs
55         echo "module Version where"                    >> Version.hs
56         echo "version, targetOS, targetARCH :: String" >> Version.hs
57         echo "version    = \"$(ProjectVersion)\""      >> Version.hs
58         echo "targetOS   = \"$(TargetOS_CPP)\""        >> Version.hs
59         echo "targetARCH = \"$(TargetArch_CPP)\""      >> Version.hs
60