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
16 # And similarly for when booting from .hc files:
17 HC_BOOT_LD_OPTS += -L$(GHC_LIB_COMPAT_DIR)
18 HC_BOOT_LIBS += -lghccompat
20 # This is required because libghccompat.a must be built with
21 # $(GhcHcOpts) because it is linked to the compiler, and hence
22 # we must also build with $(GhcHcOpts) here:
23 SRC_HC_OPTS += $(GhcHcOpts)
25 ifeq "$(Windows)" "YES"
26 # not very nice, but required for -lghccompat on Windows
27 SRC_LD_OPTS += -lshell32
28 HC_BOOT_LIBS += -lshell32
31 ifeq "$(ghc_ge_504)" "NO"
32 SRC_HC_OPTS += -package lang -package util -package text
35 ifeq "$(ghc_ge_603)" "YES"
36 SRC_HC_OPTS += -package Cabal
39 # On Windows, ghc-pkg is a standalone program
40 # ($bindir/ghc-pkg.exe), whereas on Unix it needs a wrapper script
41 # to pass the appropriate flag to the real binary
42 # ($libexecdir/ghc-pkg.bin) so that it can find package.conf.
43 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
45 INSTALL_PROGS += $(HS_PROG)
48 INSTALL_LIBEXECS += $(HS_PROG)
51 # This is horrible. We ought to be able to omit the entire directory
53 SRC_MKDEPENDHS_OPTS += \
54 -optdep--exclude-module=Compat.RawSystem \
55 -optdep--exclude-module=Compat.Directory \
56 -optdep--exclude-module=Distribution.Compat.ReadP \
57 -optdep--exclude-module=Distribution.Extension \
58 -optdep--exclude-module=Distribution.GetOpt \
59 -optdep--exclude-module=Distribution.InstalledPackageInfo \
60 -optdep--exclude-module=Distribution.License \
61 -optdep--exclude-module=Distribution.Package \
62 -optdep--exclude-module=Distribution.ParseUtils \
63 -optdep--exclude-module=Distribution.Setup \
64 -optdep--exclude-module=Distribution.Version \
65 -optdep--exclude-module=System.Directory.Internals
67 # -----------------------------------------------------------------------------=
68 # Create the Version.hs file
70 VERSION_HS = Version.hs
71 EXTRA_SRCS += $(VERSION_HS)
75 Version.hs : Makefile $(TOP)/mk/version.mk
76 @$(RM) -f $(VERSION_HS)
77 @echo "Creating $(VERSION_HS) ... "
78 @echo "module Version where" >>$(VERSION_HS)
79 @echo "version = \"$(ProjectVersion)\"" >> $(VERSION_HS)
80 @echo "targetOS = \"$(TargetOS_CPP)\"" >> $(VERSION_HS)
81 @echo "targetARCH = \"$(TargetArch_CPP)\"" >> $(VERSION_HS)
83 # -----------------------------------------------------------------------------
86 ifeq "$(INSTALLING)" "1"
87 ifeq "$(BIN_DIST)" "1"
88 GHCPKGBIN=$$\"\"libexecdir/$(HS_PROG)
89 PKGCONF=$$\"\"libdir/package.conf
91 GHCPKGBIN=$(libexecdir)/$(HS_PROG)
92 PKGCONF=$(libdir)/package.conf
95 GHCPKGBIN=$(FPTOOLS_TOP_ABS)/ghc/utils/ghc-pkg/$(HS_PROG)
96 PKGCONF=$(FPTOOLS_TOP_ABS_PLATFORM)/ghc/driver/package.conf.inplace
99 ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
100 INSTALLED_SCRIPT_PROG = ghc-pkg-$(ProjectVersion)
102 INPLACE_SCRIPT_PROG = ghc-pkg-inplace
104 SCRIPT_OBJS = ghc-pkg.sh
106 SCRIPT_SUBST_VARS = GHCPKGBIN PKGCONFOPT
107 ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
108 INSTALL_SCRIPTS += $(SCRIPT_PROG)
110 PKGCONFOPT = --global-conf $(PKGCONF)
112 ifeq "$(INSTALLING)" "1"
113 SCRIPT_PROG = $(INSTALLED_SCRIPT_PROG)
114 ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
118 SCRIPT_PROG = $(INPLACE_SCRIPT_PROG)
121 # -----------------------------------------------------------------------------
122 # don't recurse on 'make install'
124 ifeq "$(INSTALLING)" "1"
126 $(MAKE) INSTALLING=0 BIN_DIST=0 $(MFLAGS) $@
127 clean distclean maintainer-clean ::
128 $(MAKE) INSTALLING=0 BIN_DIST=0 $(MFLAGS) $@
131 # ghc-pkg is needed to boot in ghc/rts and library dirs
132 # Do a recursive 'make all' after generating dependencies, because this
133 # will work with 'make -j'.
134 ifneq "$(BootingFromHc)" "YES"
139 include $(TOP)/mk/target.mk