1 # -----------------------------------------------------------------------------
4 include $(TOP)/mk/boilerplate.mk
6 # hack for ghci-inplace script, see below
9 # -----------------------------------------------------------------------------
12 ghc_ge_504 = $(shell if (test $(GhcCanonVersion) -ge 504); then echo YES; else echo NO; fi)
13 ghc_ge_603 = $(shell if (test $(GhcCanonVersion) -ge 603); then echo YES; else echo NO; fi)
15 SRC_HC_OPTS += -cpp -Wall -fno-warn-name-shadowing -fno-warn-unused-matches
17 SRC_HC_OPTS += -i$(GHC_LIB_COMPAT_DIR)
18 SRC_LD_OPTS += -L$(GHC_LIB_COMPAT_DIR) -lghccompat
20 ifeq "$(Windows)" "YES"
21 # not very nice, but required for -lghccompat on Windows
22 SRC_LD_OPTS += -lshell32
25 ifeq "$(ghc_ge_504)" "NO"
26 SRC_HC_OPTS += -package lang -package util -package text
29 ifeq "$(ghc_ge_603)" "YES"
30 SRC_HC_OPTS += -package Cabal
33 # On Windows, ghc-pkg is a standalone program
34 # ($bindir/ghc-pkg.exe), whereas on Unix it needs a wrapper script
35 # to pass the appropriate flag to the real binary
36 # ($libexecdir/ghc-pkg.bin) so that it can find package.conf.
37 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
39 INSTALL_PROGS += $(HS_PROG)
42 INSTALL_LIBEXECS += $(HS_PROG)
45 # This is horrible. We ought to be able to omit the entire directory
47 SRC_MKDEPENDHS_OPTS += \
48 -optdep--exclude-module=Compat.RawSystem \
49 -optdep--exclude-module=Compat.Directory \
50 -optdep--exclude-module=Distribution.Compat.ReadP \
51 -optdep--exclude-module=Distribution.Extension \
52 -optdep--exclude-module=Distribution.GetOpt \
53 -optdep--exclude-module=Distribution.InstalledPackageInfo \
54 -optdep--exclude-module=Distribution.License \
55 -optdep--exclude-module=Distribution.Package \
56 -optdep--exclude-module=Distribution.ParseUtils \
57 -optdep--exclude-module=Distribution.Setup \
58 -optdep--exclude-module=Distribution.Version \
59 -optdep--exclude-module=System.Directory.Internals
61 # -----------------------------------------------------------------------------=
62 # Create the Version.hs file
64 VERSION_HS = Version.hs
65 EXTRA_SRCS += $(VERSION_HS)
69 Version.hs : Makefile $(TOP)/mk/version.mk
70 @$(RM) -f $(VERSION_HS)
71 @echo "Creating $(VERSION_HS) ... "
72 @echo "module Version where" >>$(VERSION_HS)
73 @echo "version = \"$(ProjectVersion)\"" >> $(VERSION_HS)
74 @echo "targetOS = \"$(TargetOS_CPP)\"" >> $(VERSION_HS)
75 @echo "targetARCH = \"$(TargetArch_CPP)\"" >> $(VERSION_HS)
77 # -----------------------------------------------------------------------------
80 ifeq "$(INSTALLING)" "1"
81 ifeq "$(BIN_DIST)" "1"
82 GHCPKGBIN=$$\"\"libexecdir/$(HS_PROG)
83 PKGCONF=$$\"\"libdir/package.conf
85 GHCPKGBIN=$(libexecdir)/$(HS_PROG)
86 PKGCONF=$(libdir)/package.conf
89 GHCPKGBIN=$(FPTOOLS_TOP_ABS)/ghc/utils/ghc-pkg/$(HS_PROG)
90 PKGCONF=$(FPTOOLS_TOP_ABS_PLATFORM)/ghc/driver/package.conf.inplace
93 ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
94 INSTALLED_SCRIPT_PROG = ghc-pkg-$(ProjectVersion)
96 INPLACE_SCRIPT_PROG = ghc-pkg-inplace
98 SCRIPT_OBJS = ghc-pkg.sh
100 SCRIPT_SUBST_VARS = GHCPKGBIN PKGCONFOPT
101 ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
102 INSTALL_SCRIPTS += $(SCRIPT_PROG)
104 PKGCONFOPT = --global-conf $(PKGCONF)
106 ifeq "$(INSTALLING)" "1"
107 SCRIPT_PROG = $(INSTALLED_SCRIPT_PROG)
108 ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
112 SCRIPT_PROG = $(INPLACE_SCRIPT_PROG)
115 # -----------------------------------------------------------------------------
116 # don't recurse on 'make install'
118 ifeq "$(INSTALLING)" "1"
120 $(MAKE) INSTALLING=0 BIN_DIST=0 $(MFLAGS) $@
121 clean distclean maintainer-clean ::
122 $(MAKE) INSTALLING=0 BIN_DIST=0 $(MFLAGS) $@
125 # ghc-pkg is needed to boot in ghc/rts and library dirs
126 # Do a recursive 'make all' after generating dependencies, because this
127 # will work with 'make -j'.
128 ifneq "$(BootingFromHc)" "YES"
133 include $(TOP)/mk/target.mk