2 include $(TOP)/mk/boilerplate.mk
4 # hack for ghci-inplace script, see below
7 # -----------------------------------------------------------------------------
10 SRC_HC_OPTS += -cpp -Wall -fno-warn-name-shadowing -fno-warn-unused-matches
12 # This causes libghccompat.a to be used:
13 include $(GHC_COMPAT_DIR)/compat.mk
15 SRC_HC_OPTS += $(PACKAGE_CABAL)
17 # This is required because libghccompat.a must be built with
18 # $(GhcHcOpts) because it is linked to the compiler, and hence
19 # we must also build with $(GhcHcOpts) here:
20 SRC_HC_OPTS += $(GhcHcOpts) $(GhcStage1HcOpts)
22 # On Windows, ghc-pkg is a standalone program
23 # ($bindir/ghc-pkg.exe), whereas on Unix it needs a wrapper script
24 # to pass the appropriate flag to the real binary
25 # ($libexecdir/ghc-pkg.bin) so that it can find package.conf.
26 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
28 INSTALL_PROGS += $(HS_PROG)
31 INSTALL_LIBEXECS += $(HS_PROG)
34 # -----------------------------------------------------------------------------
35 # Create the Version.hs file
37 VERSION_HS = Version.hs
38 EXTRA_SRCS += $(VERSION_HS)
42 Version.hs : Makefile $(TOP)/mk/config.mk
43 @$(RM) -f $(VERSION_HS)
44 @echo "Creating $(VERSION_HS) ... "
45 @echo "module Version where" >>$(VERSION_HS)
46 @echo "version, targetOS, targetARCH :: String" >>$(VERSION_HS)
47 @echo "version = \"$(ProjectVersion)\"" >> $(VERSION_HS)
48 @echo "targetOS = \"$(TargetOS_CPP)\"" >> $(VERSION_HS)
49 @echo "targetARCH = \"$(TargetArch_CPP)\"" >> $(VERSION_HS)
51 DIST_CLEAN_FILES += $(VERSION_HS)
53 # -----------------------------------------------------------------------------
56 ifeq "$(INSTALLING)" "1"
57 ifeq "$(BIN_DIST)" "1"
58 GHCPKGBIN=$$\"\"libexecdir/$(HS_PROG)
59 PKGCONF=$$\"\"libdir/package.conf
61 GHCPKGBIN=$(libexecdir)/$(HS_PROG)
62 PKGCONF=$(libdir)/package.conf
65 GHCPKGBIN=$(FPTOOLS_TOP_ABS)/utils/ghc-pkg/$(HS_PROG)
66 PKGCONF=$(FPTOOLS_TOP_ABS_PLATFORM)/driver/package.conf.inplace
69 ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
70 INSTALLED_SCRIPT_PROG = ghc-pkg-$(ProjectVersion)
72 INPLACE_SCRIPT_PROG = ghc-pkg-inplace
74 SCRIPT_OBJS = ghc-pkg.sh
76 SCRIPT_SUBST_VARS = GHCPKGBIN PKGCONFOPT
77 ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
78 INSTALL_SCRIPTS += $(SCRIPT_PROG)
80 PKGCONFOPT = --global-conf $(PKGCONF)
82 ifeq "$(INSTALLING)" "1"
83 SCRIPT_PROG = $(INSTALLED_SCRIPT_PROG)
84 ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
88 SCRIPT_PROG = $(INPLACE_SCRIPT_PROG)
91 # -----------------------------------------------------------------------------
92 # don't recurse on 'make install'
94 ifeq "$(INSTALLING)" "1"
96 $(MAKE) INSTALLING=0 BIN_DIST=0 $(MFLAGS) $@
97 clean distclean maintainer-clean ::
98 $(MAKE) INSTALLING=0 BIN_DIST=0 $(MFLAGS) $@
101 ifeq "$(INSTALLING)$(HOSTPLATFORM)" "0i386-unknown-mingw32"
102 all :: $(INPLACE_SCRIPT_PROG).bat
104 # See "MSys Note 3" in compiler/Makefile
105 $(INPLACE_SCRIPT_PROG).bat :
106 echo '@call $(subst /,\,$(FPTOOLS_TOP_ABS_PLATFORM)/utils/ghc-pkg/$(HS_PROG)) --global-conf $(PKGCONF) %*' >> $@
109 CLEAN_FILES += $(INPLACE_SCRIPT_PROG).bat
112 # ghc-pkg is needed to boot in rts/ and library dirs
113 # Do a recursive 'make all' after generating dependencies, because this
114 # will work with 'make -j'.
115 ifneq "$(BootingFromHc)" "YES"
120 include $(TOP)/mk/target.mk