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 # This is required because libghccompat.a must be built with
16 # $(GhcHcOpts) because it is linked to the compiler, and hence
17 # we must also build with $(GhcHcOpts) here:
18 SRC_HC_OPTS += $(GhcHcOpts) $(GhcStage1HcOpts)
20 ifeq "$(ghc_ge_504)" "NO"
21 SRC_HC_OPTS += -package lang -package util -package text
24 # On Windows, ghc-pkg is a standalone program
25 # ($bindir/ghc-pkg.exe), whereas on Unix it needs a wrapper script
26 # to pass the appropriate flag to the real binary
27 # ($libexecdir/ghc-pkg.bin) so that it can find package.conf.
28 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
30 INSTALL_PROGS += $(HS_PROG)
33 INSTALL_LIBEXECS += $(HS_PROG)
36 # -----------------------------------------------------------------------------
37 # Create the Version.hs file
39 VERSION_HS = Version.hs
40 EXTRA_SRCS += $(VERSION_HS)
44 Version.hs : Makefile $(TOP)/mk/config.mk
45 @$(RM) -f $(VERSION_HS)
46 @echo "Creating $(VERSION_HS) ... "
47 @echo "module Version where" >>$(VERSION_HS)
48 @echo "version, targetOS, targetARCH :: String" >>$(VERSION_HS)
49 @echo "version = \"$(ProjectVersion)\"" >> $(VERSION_HS)
50 @echo "targetOS = \"$(TargetOS_CPP)\"" >> $(VERSION_HS)
51 @echo "targetARCH = \"$(TargetArch_CPP)\"" >> $(VERSION_HS)
53 DIST_CLEAN_FILES += $(VERSION_HS)
55 # -----------------------------------------------------------------------------
58 ifeq "$(INSTALLING)" "1"
59 ifeq "$(BIN_DIST)" "1"
60 GHCPKGBIN=$$\"\"libexecdir/$(HS_PROG)
61 PKGCONF=$$\"\"libdir/package.conf
63 GHCPKGBIN=$(libexecdir)/$(HS_PROG)
64 PKGCONF=$(libdir)/package.conf
67 GHCPKGBIN=$(FPTOOLS_TOP_ABS)/utils/ghc-pkg/$(HS_PROG)
68 PKGCONF=$(FPTOOLS_TOP_ABS_PLATFORM)/driver/package.conf.inplace
71 ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
72 INSTALLED_SCRIPT_PROG = ghc-pkg-$(ProjectVersion)
74 INPLACE_SCRIPT_PROG = ghc-pkg-inplace
76 SCRIPT_OBJS = ghc-pkg.sh
78 SCRIPT_SUBST_VARS = GHCPKGBIN PKGCONFOPT
79 ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
80 INSTALL_SCRIPTS += $(SCRIPT_PROG)
82 PKGCONFOPT = --global-conf $(PKGCONF)
84 ifeq "$(INSTALLING)" "1"
85 SCRIPT_PROG = $(INSTALLED_SCRIPT_PROG)
86 ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
90 SCRIPT_PROG = $(INPLACE_SCRIPT_PROG)
93 # -----------------------------------------------------------------------------
94 # don't recurse on 'make install'
96 ifeq "$(INSTALLING)" "1"
98 $(MAKE) INSTALLING=0 BIN_DIST=0 $(MFLAGS) $@
99 clean distclean maintainer-clean ::
100 $(MAKE) INSTALLING=0 BIN_DIST=0 $(MFLAGS) $@
103 # ghc-pkg is needed to boot in rts/ and library dirs
104 # Do a recursive 'make all' after generating dependencies, because this
105 # will work with 'make -j'.
106 ifneq "$(BootingFromHc)" "YES"
111 include $(TOP)/mk/target.mk