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)
14 SRC_HC_OPTS += -cpp -Wall -fno-warn-name-shadowing -fno-warn-unused-matches
16 SRC_HC_OPTS += -i$(GHC_LIB_COMPAT_DIR)
17 SRC_LD_OPTS += -L$(GHC_LIB_COMPAT_DIR) -lghccompat
19 ifeq "$(Windows)" "YES"
20 # not very nice, but required for -lghccompat on Windows
21 SRC_LD_OPTS += -lshell32
24 ifeq "$(ghc_ge_504)" "NO"
25 SRC_HC_OPTS += -package lang -package util -package text
28 # On Windows, ghc-pkg is a standalone program
29 # ($bindir/ghc-pkg.exe), whereas on Unix it needs a wrapper script
30 # to pass the appropriate flag to the real binary
31 # ($libexecdir/ghc-pkg.bin) so that it can find package.conf.
32 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
34 INSTALL_PROGS += $(HS_PROG)
37 INSTALL_LIBEXECS += $(HS_PROG)
40 # This is horrible. We ought to be able to omit the entire directory
42 SRC_MKDEPENDHS_OPTS += \
43 -optdep--exclude-module=Compat.Directory \
44 -optdep--exclude-module=Distribution.Compat.ReadP \
45 -optdep--exclude-module=Distribution.Package \
46 -optdep--exclude-module=Distribution.InstalledPackageInfo \
47 -optdep--exclude-module=Distribution.Package \
48 -optdep--exclude-module=Distribution.License \
49 -optdep--exclude-module=Distribution.Version
51 # -----------------------------------------------------------------------------=
52 # Create the Version.hs file
54 VERSION_HS = Version.hs
55 EXTRA_SRCS += $(VERSION_HS)
59 Version.hs : Makefile $(TOP)/mk/version.mk
60 @$(RM) -f $(VERSION_HS)
61 @echo "Creating $(VERSION_HS) ... "
62 @echo "module Version where" >>$(VERSION_HS)
63 @echo "version = \"$(ProjectVersion)\"" >> $(VERSION_HS)
64 @echo "targetOS = \"$(TargetOS_CPP)\"" >> $(VERSION_HS)
65 @echo "targetARCH = \"$(TargetArch_CPP)\"" >> $(VERSION_HS)
67 # -----------------------------------------------------------------------------
70 ifeq "$(INSTALLING)" "1"
71 ifeq "$(BIN_DIST)" "1"
72 GHCPKGBIN=$$\"\"libexecdir/$(HS_PROG)
73 PKGCONF=$$\"\"libdir/package.conf
75 GHCPKGBIN=$(libexecdir)/$(HS_PROG)
76 PKGCONF=$(libdir)/package.conf
79 GHCPKGBIN=$(FPTOOLS_TOP_ABS)/ghc/utils/ghc-pkg/$(HS_PROG)
80 PKGCONF=$(FPTOOLS_TOP_ABS_PLATFORM)/ghc/driver/package.conf.inplace
83 ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
84 INSTALLED_SCRIPT_PROG = ghc-pkg-$(ProjectVersion)
86 INPLACE_SCRIPT_PROG = ghc-pkg-inplace
88 SCRIPT_OBJS = ghc-pkg.sh
90 SCRIPT_SUBST_VARS = GHCPKGBIN PKGCONFOPT
91 ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
92 INSTALL_SCRIPTS += $(SCRIPT_PROG)
94 PKGCONFOPT = --global-conf $(PKGCONF)
96 ifeq "$(INSTALLING)" "1"
97 SCRIPT_PROG = $(INSTALLED_SCRIPT_PROG)
98 ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
102 SCRIPT_PROG = $(INPLACE_SCRIPT_PROG)
105 # -----------------------------------------------------------------------------
106 # don't recurse on 'make install'
108 ifeq "$(INSTALLING)" "1"
110 $(MAKE) INSTALLING=0 BIN_DIST=0 $(MFLAGS) $@
111 clean distclean maintainer-clean ::
112 $(MAKE) INSTALLING=0 BIN_DIST=0 $(MFLAGS) $@
115 # ghc-pkg is needed to boot in ghc/rts and library dirs
116 # Do a recursive 'make all' after generating dependencies, because this
117 # will work with 'make -j'.
118 ifneq "$(BootingFromHc)" "YES"
123 include $(TOP)/mk/target.mk