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 ifeq "$(ghc_ge_504)" "NO"
23 SRC_HC_OPTS += -package lang -package util -package text
26 # On Windows, ghc-pkg is a standalone program
27 # ($bindir/ghc-pkg.exe), whereas on Unix it needs a wrapper script
28 # to pass the appropriate flag to the real binary
29 # ($libexecdir/ghc-pkg.bin) so that it can find package.conf.
30 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
32 INSTALL_PROGS += $(HS_PROG)
35 INSTALL_LIBEXECS += $(HS_PROG)
38 # -----------------------------------------------------------------------------
39 # Create the Version.hs file
41 VERSION_HS = Version.hs
42 EXTRA_SRCS += $(VERSION_HS)
46 Version.hs : Makefile $(TOP)/mk/config.mk
47 @$(RM) -f $(VERSION_HS)
48 @echo "Creating $(VERSION_HS) ... "
49 @echo "module Version where" >>$(VERSION_HS)
50 @echo "version, targetOS, targetARCH :: String" >>$(VERSION_HS)
51 @echo "version = \"$(ProjectVersion)\"" >> $(VERSION_HS)
52 @echo "targetOS = \"$(TargetOS_CPP)\"" >> $(VERSION_HS)
53 @echo "targetARCH = \"$(TargetArch_CPP)\"" >> $(VERSION_HS)
55 DIST_CLEAN_FILES += $(VERSION_HS)
57 # -----------------------------------------------------------------------------
60 ifeq "$(INSTALLING)" "1"
61 ifeq "$(BIN_DIST)" "1"
62 GHCPKGBIN=$$\"\"libexecdir/$(HS_PROG)
63 PKGCONF=$$\"\"libdir/package.conf
65 GHCPKGBIN=$(libexecdir)/$(HS_PROG)
66 PKGCONF=$(libdir)/package.conf
69 GHCPKGBIN=$(FPTOOLS_TOP_ABS)/utils/ghc-pkg/$(HS_PROG)
70 PKGCONF=$(FPTOOLS_TOP_ABS_PLATFORM)/driver/package.conf.inplace
73 ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
74 INSTALLED_SCRIPT_PROG = ghc-pkg-$(ProjectVersion)
76 INPLACE_SCRIPT_PROG = ghc-pkg-inplace
78 SCRIPT_OBJS = ghc-pkg.sh
80 SCRIPT_SUBST_VARS = GHCPKGBIN PKGCONFOPT
81 ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
82 INSTALL_SCRIPTS += $(SCRIPT_PROG)
84 PKGCONFOPT = --global-conf $(PKGCONF)
86 ifeq "$(INSTALLING)" "1"
87 SCRIPT_PROG = $(INSTALLED_SCRIPT_PROG)
88 ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
92 SCRIPT_PROG = $(INPLACE_SCRIPT_PROG)
95 # -----------------------------------------------------------------------------
96 # don't recurse on 'make install'
98 ifeq "$(INSTALLING)" "1"
100 $(MAKE) INSTALLING=0 BIN_DIST=0 $(MFLAGS) $@
101 clean distclean maintainer-clean ::
102 $(MAKE) INSTALLING=0 BIN_DIST=0 $(MFLAGS) $@
105 ifeq "$(INSTALLING)$(HOSTPLATFORM)" "0i386-unknown-mingw32"
106 all :: $(INPLACE_SCRIPT_PROG).bat
108 # See "MSys Note 3" in compiler/Makefile
109 $(INPLACE_SCRIPT_PROG).bat :
110 echo '@call $(subst /,\,$(FPTOOLS_TOP_ABS_PLATFORM)/utils/ghc-pkg/$(HS_PROG)) --global-conf $(PKGCONF) %*' >> $@
113 CLEAN_FILES += $(INPLACE_SCRIPT_PROG).bat
116 # ghc-pkg is needed to boot in rts/ and library dirs
117 # Do a recursive 'make all' after generating dependencies, because this
118 # will work with 'make -j'.
119 ifneq "$(BootingFromHc)" "YES"
124 include $(TOP)/mk/target.mk