1 # -----------------------------------------------------------------------------
4 include $(TOP)/mk/boilerplate.mk
6 # hack for ghci-inplace script, see below
9 # -----------------------------------------------------------------------------
12 SRC_HC_OPTS += -cpp -Wall -fno-warn-name-shadowing -fno-warn-unused-matches
14 SRC_HC_OPTS += -i$(GHC_LIB_COMPAT_DIR)
15 SRC_LD_OPTS += -L$(GHC_LIB_COMPAT_DIR) -lghccompat
17 ifeq "$(Windows)" "YES"
18 # not very nice, but required for -lghccompat on Windows
19 SRC_LD_OPTS += -lshell32
22 ifeq "$(ghc_ge_504)" "NO"
23 SRC_HC_OPTS += -package lang -package util -package text
26 ifeq "$(ghc_ge_603)" "YES"
27 SRC_HC_OPTS += -package Cabal
30 # On Windows, ghc-pkg is a standalone program
31 # ($bindir/ghc-pkg.exe), whereas on Unix it needs a wrapper script
32 # to pass the appropriate flag to the real binary
33 # ($libexecdir/ghc-pkg.bin) so that it can find package.conf.
34 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
36 INSTALL_PROGS += $(HS_PROG)
39 INSTALL_LIBEXECS += $(HS_PROG)
42 # This is horrible. We ought to be able to omit the entire directory
44 SRC_MKDEPENDHS_OPTS += \
45 -optdep--exclude-module=Compat.RawSystem \
46 -optdep--exclude-module=Compat.Directory \
47 -optdep--exclude-module=Distribution.Compat.ReadP \
48 -optdep--exclude-module=Distribution.Extension \
49 -optdep--exclude-module=Distribution.GetOpt \
50 -optdep--exclude-module=Distribution.InstalledPackageInfo \
51 -optdep--exclude-module=Distribution.License \
52 -optdep--exclude-module=Distribution.Package \
53 -optdep--exclude-module=Distribution.ParseUtils \
54 -optdep--exclude-module=Distribution.Setup \
55 -optdep--exclude-module=Distribution.Version \
56 -optdep--exclude-module=System.Directory.Internals
58 # -----------------------------------------------------------------------------=
59 # Create the Version.hs file
61 VERSION_HS = Version.hs
62 EXTRA_SRCS += $(VERSION_HS)
66 Version.hs : Makefile $(TOP)/mk/version.mk
67 @$(RM) -f $(VERSION_HS)
68 @echo "Creating $(VERSION_HS) ... "
69 @echo "module Version where" >>$(VERSION_HS)
70 @echo "version = \"$(ProjectVersion)\"" >> $(VERSION_HS)
71 @echo "targetOS = \"$(TargetOS_CPP)\"" >> $(VERSION_HS)
72 @echo "targetARCH = \"$(TargetArch_CPP)\"" >> $(VERSION_HS)
74 # -----------------------------------------------------------------------------
77 ifeq "$(INSTALLING)" "1"
78 ifeq "$(BIN_DIST)" "1"
79 GHCPKGBIN=$$\"\"libexecdir/$(HS_PROG)
80 PKGCONF=$$\"\"libdir/package.conf
82 GHCPKGBIN=$(libexecdir)/$(HS_PROG)
83 PKGCONF=$(libdir)/package.conf
86 GHCPKGBIN=$(FPTOOLS_TOP_ABS)/ghc/utils/ghc-pkg/$(HS_PROG)
87 PKGCONF=$(FPTOOLS_TOP_ABS_PLATFORM)/ghc/driver/package.conf.inplace
90 ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
91 INSTALLED_SCRIPT_PROG = ghc-pkg-$(ProjectVersion)
93 INPLACE_SCRIPT_PROG = ghc-pkg-inplace
95 SCRIPT_OBJS = ghc-pkg.sh
97 SCRIPT_SUBST_VARS = GHCPKGBIN PKGCONFOPT
98 ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
99 INSTALL_SCRIPTS += $(SCRIPT_PROG)
101 PKGCONFOPT = --global-conf $(PKGCONF)
103 ifeq "$(INSTALLING)" "1"
104 SCRIPT_PROG = $(INSTALLED_SCRIPT_PROG)
105 ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
109 SCRIPT_PROG = $(INPLACE_SCRIPT_PROG)
112 # -----------------------------------------------------------------------------
113 # don't recurse on 'make install'
115 ifeq "$(INSTALLING)" "1"
117 $(MAKE) INSTALLING=0 BIN_DIST=0 $(MFLAGS) $@
118 clean distclean maintainer-clean ::
119 $(MAKE) INSTALLING=0 BIN_DIST=0 $(MFLAGS) $@
122 # ghc-pkg is needed to boot in ghc/rts and library dirs
123 # Do a recursive 'make all' after generating dependencies, because this
124 # will work with 'make -j'.
125 ifneq "$(BootingFromHc)" "YES"
130 include $(TOP)/mk/target.mk