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.Directory \
49 -optdep--exclude-module=Distribution.Compat.ReadP \
50 -optdep--exclude-module=Distribution.Package \
51 -optdep--exclude-module=Distribution.InstalledPackageInfo \
52 -optdep--exclude-module=Distribution.Package \
53 -optdep--exclude-module=Distribution.License \
54 -optdep--exclude-module=Distribution.Version
56 # -----------------------------------------------------------------------------=
57 # Create the Version.hs file
59 VERSION_HS = Version.hs
60 EXTRA_SRCS += $(VERSION_HS)
64 Version.hs : Makefile $(TOP)/mk/version.mk
65 @$(RM) -f $(VERSION_HS)
66 @echo "Creating $(VERSION_HS) ... "
67 @echo "module Version where" >>$(VERSION_HS)
68 @echo "version = \"$(ProjectVersion)\"" >> $(VERSION_HS)
69 @echo "targetOS = \"$(TargetOS_CPP)\"" >> $(VERSION_HS)
70 @echo "targetARCH = \"$(TargetArch_CPP)\"" >> $(VERSION_HS)
72 # -----------------------------------------------------------------------------
75 ifeq "$(INSTALLING)" "1"
76 ifeq "$(BIN_DIST)" "1"
77 GHCPKGBIN=$$\"\"libexecdir/$(HS_PROG)
78 PKGCONF=$$\"\"libdir/package.conf
80 GHCPKGBIN=$(libexecdir)/$(HS_PROG)
81 PKGCONF=$(libdir)/package.conf
84 GHCPKGBIN=$(FPTOOLS_TOP_ABS)/ghc/utils/ghc-pkg/$(HS_PROG)
85 PKGCONF=$(FPTOOLS_TOP_ABS_PLATFORM)/ghc/driver/package.conf.inplace
88 ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
89 INSTALLED_SCRIPT_PROG = ghc-pkg-$(ProjectVersion)
91 INPLACE_SCRIPT_PROG = ghc-pkg-inplace
93 SCRIPT_OBJS = ghc-pkg.sh
95 SCRIPT_SUBST_VARS = GHCPKGBIN PKGCONFOPT
96 ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
97 INSTALL_SCRIPTS += $(SCRIPT_PROG)
99 PKGCONFOPT = --global-conf $(PKGCONF)
101 ifeq "$(INSTALLING)" "1"
102 SCRIPT_PROG = $(INSTALLED_SCRIPT_PROG)
103 ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
107 SCRIPT_PROG = $(INPLACE_SCRIPT_PROG)
110 # -----------------------------------------------------------------------------
111 # don't recurse on 'make install'
113 ifeq "$(INSTALLING)" "1"
115 $(MAKE) INSTALLING=0 BIN_DIST=0 $(MFLAGS) $@
116 clean distclean maintainer-clean ::
117 $(MAKE) INSTALLING=0 BIN_DIST=0 $(MFLAGS) $@
120 # ghc-pkg is needed to boot in ghc/rts and library dirs
121 # Do a recursive 'make all' after generating dependencies, because this
122 # will work with 'make -j'.
123 ifneq "$(BootingFromHc)" "YES"
128 include $(TOP)/mk/target.mk