summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile5
-rw-r--r--driver/ghc/Makefile2
-rw-r--r--driver/ghci/Makefile2
-rw-r--r--libraries/Makefile2
-rw-r--r--libraries/installPackage.hs28
-rw-r--r--mk/install.mk121
-rw-r--r--mk/package.mk2
-rw-r--r--utils/ghc-pkg/Makefile2
-rw-r--r--utils/hsc2hs/Makefile2
-rw-r--r--utils/prof/Makefile2
10 files changed, 90 insertions, 78 deletions
diff --git a/Makefile b/Makefile
index c935520db7..445b008d87 100644
--- a/Makefile
+++ b/Makefile
@@ -163,7 +163,6 @@ endif
# Same as default rule, but we pass $(INSTALL_STAGE) to $(MAKE) too
install :: check-packages
- $(INSTALL_DIR) $(bindir)
@case '${MFLAGS}' in *-[ik]*) x_on_err=0;; *-r*[ik]*) x_on_err=0;; *) x_on_err=1;; esac; \
for i in $(SUBDIRS); do \
echo "------------------------------------------------------------------------"; \
@@ -207,8 +206,8 @@ endif
# Install gcc-extra-opts
install ::
- @$(INSTALL_DIR) $(libdir)
- $(INSTALL_DATA) $(INSTALL_OPTS) extra-gcc-opts $(libdir)
+ $(INSTALL_DIR) $(DESTDIR)$(libdir)
+ $(INSTALL_DATA) $(INSTALL_OPTS) extra-gcc-opts $(DESTDIR)$(libdir)
install-docs ::
@case '${MFLAGS}' in *-[ik]*) x_on_err=0;; *-r*[ik]*) x_on_err=0;; *) x_on_err=1;; esac; \
diff --git a/driver/ghc/Makefile b/driver/ghc/Makefile
index 3b481ec44a..66a8d2ba10 100644
--- a/driver/ghc/Makefile
+++ b/driver/ghc/Makefile
@@ -11,7 +11,7 @@ include $(TOP)/mk/boilerplate.mk
ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
LINK = ghc
LINK_TARGET = $(LINK)-$(ProjectVersion)
-INSTALLED_SCRIPT=$(bindir)/$(LINK_TARGET)
+INSTALLED_SCRIPT=$(DESTDIR)$(bindir)/$(LINK_TARGET)
install::
$(RM) -f $(INSTALLED_SCRIPT)
echo "#!$(SHELL)" >> $(INSTALLED_SCRIPT)
diff --git a/driver/ghci/Makefile b/driver/ghci/Makefile
index ac6d3834fc..c3fad1541b 100644
--- a/driver/ghci/Makefile
+++ b/driver/ghci/Makefile
@@ -25,7 +25,7 @@ install::
else
LINK = ghci
LINK_TARGET = $(LINK)-$(ProjectVersion)
-INSTALLED_SCRIPT=$(bindir)/$(LINK_TARGET)
+INSTALLED_SCRIPT=$(DESTDIR)$(bindir)/$(LINK_TARGET)
install::
$(RM) -f $(INSTALLED_SCRIPT)
echo "#!$(SHELL)" >> $(INSTALLED_SCRIPT)
diff --git a/libraries/Makefile b/libraries/Makefile
index 0f237bc10e..3928a6b8ee 100644
--- a/libraries/Makefile
+++ b/libraries/Makefile
@@ -323,7 +323,7 @@ $(foreach SUBDIR,$(SUBDIRS),install.library.$(SUBDIR)): \
install.library.%: installPackage/installPackage ifBuildable/ifBuildable
if ifBuildable/ifBuildable $*; then \
cd $* && \
- ../installPackage/installPackage $(prefix) $(bindir)/ghc-pkg; \
+ ../installPackage/installPackage $(DESTDIR)$(prefix) $(FPTOOLS_TOP_ABS)/$(GHC_PKG_DIR_REL)/ghc-pkg-inplace $(DESTDIR)$(libdir)/package.conf; \
fi
.PHONY: binary-dist binary-dist.library.%
diff --git a/libraries/installPackage.hs b/libraries/installPackage.hs
index d8f4fbc873..c091b0b7d1 100644
--- a/libraries/installPackage.hs
+++ b/libraries/installPackage.hs
@@ -1,5 +1,6 @@
import Distribution.PackageDescription
+import Distribution.Program
import Distribution.Setup
import Distribution.Simple
import Distribution.Simple.Configure
@@ -10,7 +11,7 @@ import System.Environment
main :: IO ()
main = do args <- getArgs
case args of
- pref : ghcpkg : args' ->
+ pref : ghcpkg : ghcpkgconf : args' ->
let verbosity = case args' of
[] -> normal
['-':'v':v] ->
@@ -19,12 +20,12 @@ main = do args <- getArgs
_ -> Just v
in flagToVerbosity m
_ -> error ("Bad arguments: " ++ show args)
- in doit pref ghcpkg verbosity
+ in doit pref ghcpkg ghcpkgconf verbosity
_ ->
error "Missing arguments"
-doit :: FilePath -> FilePath -> Verbosity -> IO ()
-doit pref ghcpkg verbosity =
+doit :: FilePath -> FilePath -> FilePath -> Verbosity -> IO ()
+doit pref ghcpkg ghcpkgconf verbosity =
do let userHooks = simpleUserHooks
copyFlags = (emptyCopyFlags NoCopyDest) {
copyVerbose = verbosity
@@ -33,11 +34,11 @@ doit pref ghcpkg verbosity =
regUser = MaybeUserGlobal,
regVerbose = verbosity,
regGenScript = False,
- regInPlace = False,
- regWithHcPkg = Just ghcpkg
+ regInPlace = False
}
lbi <- getPersistBuildConfig
let pd = localPkgDescr lbi
+ i = installDirTemplates lbi
-- XXX This is an almighty hack, shadowing the base
-- Setup.hs hack
mkLib filt = case library pd of
@@ -54,12 +55,23 @@ doit pref ghcpkg verbosity =
pd_reg = pd { library = Just (mkLib (const True)) }
-- When coying, we need to actually give a concrete
-- directory to copy to rather than "$topdir"
- lbi_copy = lbi { installDirTemplates = (installDirTemplates lbi) { prefixDirTemplate = toPathTemplate pref } }
+ i_copy = i { prefixDirTemplate = toPathTemplate pref }
+ lbi_copy = lbi { installDirTemplates = i_copy }
-- When we run GHC we give it a $topdir that includes the
-- $compiler/lib/ part of libsubdir, so we only want the
-- $pkgid part in the package.conf file. This is a bit of
-- a hack, really.
- lbi_reg = lbi { installDirTemplates = (installDirTemplates lbi) { libSubdirTemplate = toPathTemplate "$pkgid" } }
+ progs = withPrograms lbi
+ prog = ConfiguredProgram {
+ programId = programName ghcPkgProgram,
+ programVersion = Nothing,
+ programArgs = ["--global-conf", ghcpkgconf],
+ programLocation = UserSpecified ghcpkg
+ }
+ progs' = updateProgram prog progs
+ i_reg = i { libSubdirTemplate = toPathTemplate "$pkgid" }
+ lbi_reg = lbi { installDirTemplates = i_reg,
+ withPrograms = progs' }
(copyHook simpleUserHooks) pd_copy lbi_copy userHooks copyFlags
(regHook simpleUserHooks) pd_reg lbi_reg userHooks registerFlags
return ()
diff --git a/mk/install.mk b/mk/install.mk
index 75d0569e3c..84c60b3c6e 100644
--- a/mk/install.mk
+++ b/mk/install.mk
@@ -73,14 +73,14 @@ endif
# install links to script drivers.
#
install ::
- @$(INSTALL_DIR) $(bindir)
- @if ( $(PERL) -e '$$fn="$(bindir)/$(LINK)"; exit ((! -f $$fn || -l $$fn) ? 0 : 1);' ); then \
- echo "Creating a symbolic link from $(LINK_TARGET) to $(LINK) in $(bindir)"; \
- $(RM) $(bindir)/$(LINK); \
- $(LN_S) $(LINK_TARGET) $(bindir)/$(LINK); \
+ $(INSTALL_DIR) $(DESTDIR)$(bindir)
+ if ( $(PERL) -e '$$fn="$(DESTDIR)$(bindir)/$(LINK)"; exit ((! -f $$fn || -l $$fn) ? 0 : 1);' ); then \
+ echo "Creating a symbolic link from $(LINK_TARGET) to $(LINK) in $(DESTDIR)$(bindir)"; \
+ $(RM) $(DESTDIR)$(bindir)/$(LINK); \
+ $(LN_S) $(LINK_TARGET) $(DESTDIR)$(bindir)/$(LINK); \
else \
- echo "Creating a symbolic link from $(LINK_TARGET) to $(LINK) in $(bindir) failed: \`$(bindir)/$(LINK)' already exists"; \
- echo "Perhaps remove \`$(bindir)/$(LINK)' manually?"; \
+ echo "Creating a symbolic link from $(LINK_TARGET) to $(LINK) in $(DESTDIR)$(bindir) failed: \`$(DESTDIR)$(bindir)/$(LINK)' already exists"; \
+ echo "Perhaps remove \`$(DESTDIR)$(bindir)/$(LINK)' manually?"; \
exit 1; \
fi;
@@ -114,25 +114,27 @@ endif # LINK
.PHONY: install install-docs installdirs install-strip install-dirs install-docs show-install
show-install :
+ @echo "DESTDIR = $(DESTDIR)"
@echo "bindir = $(bindir)"
@echo "libdir = $(libdir)"
@echo "libexecdir = $(libexecdir) # by default, same as libdir"
@echo "datadir = $(datadir) # unused for ghc project"
+ @echo "ifacedir = $(ifacedir)"
+ @echo "headerdir = $(headerdir)"
+ @echo "includedir = $(includedir)"
#
# Sometimes useful to separate out the creation of install directories
# from the installation itself.
#
install-dirs ::
- @$(INSTALL_DIR) $(bindir)
- @$(INSTALL_DIR) $(libdir)
- @$(INSTALL_DIR) $(libexecdir)
- @$(INSTALL_DIR) $(datadir)
+ $(INSTALL_DIR) $(DESTDIR)$(bindir)
+ $(INSTALL_DIR) $(DESTDIR)$(libdir)
+ $(INSTALL_DIR) $(DESTDIR)$(libexecdir)
+ $(INSTALL_DIR) $(DESTDIR)$(datadir)
# Better do this first...
-# but we won't for the moment, do it on-demand from
-# within the various install targets instead.
-#install:: install-dirs
+install:: install-dirs
#
# Setting user/group ownership for the installed entities
@@ -159,12 +161,11 @@ ifneq "$(strip $(INSTALL_PROGS))" ""
INSTALL_PROGS := $(foreach p, $(INSTALL_PROGS), $(addsuffix $(if $(suffix $(p)),,$(exeext)), $(basename $(p))))
install:: $(INSTALL_PROGS)
- @$(INSTALL_DIR) $(bindir)
- @for i in $(INSTALL_PROGS); do \
- echo $(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i $(bindir); \
- $(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i $(bindir) ; \
+ $(INSTALL_DIR) $(DESTDIR)$(bindir)
+ for i in $(INSTALL_PROGS); do \
+ $(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i $(DESTDIR)$(bindir) ; \
if test "$(darwin_TARGET_OS)" = "1"; then \
- sh $(FPTOOLS_TOP)/mk/fix_install_names.sh $(libdir) $(bindir)/$$i ; \
+ sh $(FPTOOLS_TOP)/mk/fix_install_names.sh $(libdir) $(DESTDIR)$(bindir)/$$i ; \
fi ; \
done
endif
@@ -175,45 +176,45 @@ endif
#
ifneq "$(strip $(INSTALL_SCRIPTS))" ""
install:: $(INSTALL_SCRIPTS)
- @$(INSTALL_DIR) $(bindir)
+ $(INSTALL_DIR) $(DESTDIR)$(bindir)
for i in $(INSTALL_SCRIPTS); do \
- $(INSTALL_SCRIPT) $(INSTALL_OPTS) $$i $(bindir); \
+ $(INSTALL_SCRIPT) $(INSTALL_OPTS) $$i $(DESTDIR)$(bindir); \
done
endif
ifneq "$(strip $(INSTALL_LIB_SCRIPTS))" ""
install:: $(INSTALL_LIB_SCRIPTS)
- @$(INSTALL_DIR) $(libdir)
+ $(INSTALL_DIR) $(DESTDIR)$(libdir)
for i in $(INSTALL_LIB_SCRIPTS); do \
- $(INSTALL_SCRIPT) $(INSTALL_OPTS) $$i $(libdir); \
+ $(INSTALL_SCRIPT) $(INSTALL_OPTS) $$i $(DESTDIR)$(libdir); \
done
endif
ifneq "$(strip $(INSTALL_LIBEXEC_SCRIPTS))" ""
install:: $(INSTALL_LIBEXEC_SCRIPTS)
- @$(INSTALL_DIR) $(libexecdir)
+ $(INSTALL_DIR) $(DESTDIR)$(libexecdir)
for i in $(INSTALL_LIBEXEC_SCRIPTS); do \
- $(INSTALL_SCRIPT) $(INSTALL_OPTS) $$i $(libexecdir); \
+ $(INSTALL_SCRIPT) $(INSTALL_OPTS) $$i $(DESTDIR)$(libexecdir); \
done
endif
ifneq "$(strip $(INSTALL_LIBS))" ""
install:: $(INSTALL_LIBS)
- @$(INSTALL_DIR) $(libdir)
+ $(INSTALL_DIR) $(DESTDIR)$(libdir)
for i in $(INSTALL_LIBS); do \
case $$i in \
*.a) \
- $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(libdir); \
- $(RANLIB) $(libdir)/`basename $$i` ;; \
+ $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(DESTDIR)$(libdir); \
+ $(RANLIB) $(DESTDIR)$(libdir)/`basename $$i` ;; \
*.dll) \
- $(INSTALL_DATA) -s $(INSTALL_OPTS) $$i $(libdir) ;; \
+ $(INSTALL_DATA) -s $(INSTALL_OPTS) $$i $(DESTDIR)$(libdir) ;; \
*.so) \
- $(INSTALL_SHLIB) $(INSTALL_OPTS) $$i $(libdir) ;; \
+ $(INSTALL_SHLIB) $(INSTALL_OPTS) $$i $(DESTDIR)$(libdir) ;; \
*.dylib) \
- $(INSTALL_SHLIB) $(INSTALL_OPTS) $$i $(libdir); \
- install_name_tool -id $(libdir)/`basename $$i` $(libdir)/`basename $$i` ;; \
+ $(INSTALL_SHLIB) $(INSTALL_OPTS) $$i $(DESTDIR)$(libdir); \
+ install_name_tool -id $(DESTDIR)$(libdir)/`basename $$i` $(DESTDIR)$(libdir)/`basename $$i` ;; \
*) \
- $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(libdir); \
+ $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(DESTDIR)$(libdir); \
esac; \
done
endif
@@ -226,61 +227,61 @@ ifneq "$(strip $(INSTALL_LIBEXECS))" ""
INSTALL_LIBEXECS := $(foreach p, $(INSTALL_LIBEXECS), $(addsuffix $(subst _,,$(subst __,$(exeext),_$(suffix $(p))_)), $(basename $(p))))
install:: $(INSTALL_LIBEXECS)
- @$(INSTALL_DIR) $(libexecdir)
+ $(INSTALL_DIR) $(DESTDIR)$(libexecdir)
-for i in $(INSTALL_LIBEXECS); do \
- $(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i $(libexecdir); \
+ $(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i $(DESTDIR)$(libexecdir); \
if test "$(darwin_TARGET_OS)" = "1"; then \
- sh $(FPTOOLS_TOP)/mk/fix_install_names.sh $(libdir) $(libexecdir)/`basename $$i` ; \
+ sh $(FPTOOLS_TOP)/mk/fix_install_names.sh $(libdir) $(DESTDIR)$(libexecdir)/`basename $$i` ; \
fi ; \
done
endif
ifneq "$(strip $(INSTALL_DATAS))" ""
install:: $(INSTALL_DATAS)
- @$(INSTALL_DIR) $(datadir)
+ $(INSTALL_DIR) $(DESTDIR)$(datadir)
for i in $(INSTALL_DATAS); do \
- $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(datadir); \
+ $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(DESTDIR)$(datadir); \
done
endif
ifneq "$(strip $(INSTALL_HEADERS))" ""
install:: $(INSTALL_HEADERS)
- @$(INSTALL_DIR) $(headerdir)
+ $(INSTALL_DIR) $(DESTDIR)$(headerdir)
for i in $(INSTALL_HEADERS); do \
- $(INSTALL_HEADER) $(INSTALL_OPTS) $$i $(headerdir); \
+ $(INSTALL_HEADER) $(INSTALL_OPTS) $$i $(DESTDIR)$(headerdir); \
done
endif
ifneq "$(strip $(INSTALL_IFACES))" ""
install:: $(INSTALL_IFACES)
- @$(INSTALL_DIR) $(ifacedir)
+ $(INSTALL_DIR) $(DESTDIR)$(ifacedir)
for i in $(INSTALL_IFACES); do \
- $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(ifacedir); \
+ $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(DESTDIR)$(ifacedir); \
done
endif
ifneq "$(strip $(INSTALL_IFACES_WITH_DIRS))" ""
install:: $(INSTALL_IFACES_WITH_DIRS)
- @$(INSTALL_DIR) $(ifacedir)
+ $(INSTALL_DIR) $(DESTDIR)$(ifacedir)
for i in $(INSTALL_IFACES_WITH_DIRS); do \
- $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(ifacedir)/`dirname $$i`; \
+ $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(DESTDIR)$(ifacedir)/`dirname $$i`; \
done
endif
ifneq "$(strip $(INSTALL_INCLUDES))" ""
install:: $(INSTALL_INCLUDES)
- @$(INSTALL_DIR) $(includedir)
+ $(INSTALL_DIR) $(DESTDIR)$(includedir)
for i in $(INSTALL_INCLUDES); do \
- $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(includedir); \
+ $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(DESTDIR)$(includedir); \
done
endif
ifneq "$(strip $(INSTALL_DOCS))" ""
ifneq "$(XMLDocWays)" ""
install-docs:: $(INSTALL_DOCS)
- @$(INSTALL_DIR) $(datadir)
+ $(INSTALL_DIR) $(DESTDIR)$(datadir)
for i in $(INSTALL_DOCS); do \
- $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(datadir); \
+ $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(DESTDIR)$(datadir); \
done
endif
endif
@@ -289,21 +290,21 @@ endif
ifneq "$(strip $(INSTALL_XML_DOC))" ""
ifneq "$(XMLDocWays)" ""
install-docs:: $(foreach i,$(XMLDocWays),$(INSTALL_XML_DOC)$(patsubst %.html-no-chunks,%.html,$(patsubst %.html,%/index.html,.$(i))))
- @$(INSTALL_DIR) $(datadir)
- @for i in $(XMLDocWays); do \
+ $(INSTALL_DIR) $(DESTDIR)$(datadir)
+ for i in $(XMLDocWays); do \
if [ $$i = "html" ]; then \
- $(INSTALL_DIR) $(datadir)/html; \
- $(INSTALL_DIR) $(datadir)/html/$(INSTALL_XML_DOC); \
- echo "( cd $(INSTALL_XML_DOC) && $(CP) * $(datadir)/html/$(INSTALL_XML_DOC) )" ; \
- ( cd $(INSTALL_XML_DOC) && $(CP) * $(datadir)/html/$(INSTALL_XML_DOC) ) ; \
+ $(INSTALL_DIR) $(DESTDIR)$(datadir)/html; \
+ $(INSTALL_DIR) $(DESTDIR)$(datadir)/html/$(INSTALL_XML_DOC); \
+ echo "( cd $(INSTALL_XML_DOC) && $(CP) * $(DESTDIR)$(datadir)/html/$(INSTALL_XML_DOC) )" ; \
+ ( cd $(INSTALL_XML_DOC) && $(CP) * $(DESTDIR)$(datadir)/html/$(INSTALL_XML_DOC) ) ; \
else \
- $(INSTALL_DIR) $(datadir)/doc; \
- echo $(INSTALL_DATA) $(INSTALL_OPTS) $(INSTALL_XML_DOC)`echo .$$i | sed s/\.html-no-chunks/.html/` $(datadir)/doc; \
- $(INSTALL_DATA) $(INSTALL_OPTS) $(INSTALL_XML_DOC)`echo .$$i | sed s/\.html-no-chunks/.html/` $(datadir)/doc; \
+ $(INSTALL_DIR) $(DESTDIR)$(datadir)/doc; \
+ echo $(INSTALL_DATA) $(INSTALL_OPTS) $(INSTALL_XML_DOC)`echo .$$i | sed s/\.html-no-chunks/.html/` $(DESTDIR)$(datadir)/doc; \
+ $(INSTALL_DATA) $(INSTALL_OPTS) $(INSTALL_XML_DOC)`echo .$$i | sed s/\.html-no-chunks/.html/` $(DESTDIR)$(datadir)/doc; \
fi; \
if [ $$i = "html-no-chunks" ]; then \
- echo $(CP) $(FPTOOLS_CSS_ABS) $(datadir)/doc; \
- $(CP) $(FPTOOLS_CSS_ABS) $(datadir)/doc; \
+ echo $(CP) $(FPTOOLS_CSS_ABS) $(DESTDIR)$(datadir)/doc; \
+ $(CP) $(FPTOOLS_CSS_ABS) $(DESTDIR)$(datadir)/doc; \
fi \
done
endif
@@ -314,6 +315,6 @@ endif
#
ifneq "$(way)" ""
install-strip::
- @$(MAKE) EXTRA_INSTALL_OPTS='-s' install
+ $(MAKE) EXTRA_INSTALL_OPTS='-s' install
endif
diff --git a/mk/package.mk b/mk/package.mk
index 16325dce82..afe44b5034 100644
--- a/mk/package.mk
+++ b/mk/package.mk
@@ -84,7 +84,7 @@ install::
-x c $(PACKAGE_CPP_OPTS) package.conf.in \
| grep -v '^#pragma GCC' \
| sed -e 's/""//g' -e 's/:[ ]*,/: /g' \
- | $(bindir)/ghc-pkg update - --force
+ | $(FPTOOLS_TOP_ABS)/$(GHC_PKG_DIR_REL)/ghc-pkg-inplace --global-conf $(DESTDIR)$(libdir)/package.conf update - --force
# we could be more accurate here and add a dependency on
# driver/package.conf, but that doesn't work too well because of
diff --git a/utils/ghc-pkg/Makefile b/utils/ghc-pkg/Makefile
index 0238334bfe..67ed7ceb0c 100644
--- a/utils/ghc-pkg/Makefile
+++ b/utils/ghc-pkg/Makefile
@@ -83,7 +83,7 @@ CLEAN_FILES += $(INPLACE_HS) $(INPLACE_PROG)
ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
LINK = ghc-pkg
LINK_TARGET = $(LINK)-$(ProjectVersion)
-INSTALLED_SCRIPT=$(bindir)/$(LINK_TARGET)
+INSTALLED_SCRIPT=$(DESTDIR)$(bindir)/$(LINK_TARGET)
install::
$(RM) -f $(INSTALLED_SCRIPT)
echo "#!$(SHELL)" >> $(INSTALLED_SCRIPT)
diff --git a/utils/hsc2hs/Makefile b/utils/hsc2hs/Makefile
index e06855088f..29995d0480 100644
--- a/utils/hsc2hs/Makefile
+++ b/utils/hsc2hs/Makefile
@@ -60,7 +60,7 @@ else
INSTALL_LIBEXECS += $(HS_PROG)
LINK = hsc2hs
LINK_TARGET = $(LINK)-$(ProjectVersion)
-INSTALLED_SCRIPT=$(bindir)/$(LINK_TARGET)
+INSTALLED_SCRIPT=$(DESTDIR)$(bindir)/$(LINK_TARGET)
install::
$(RM) -f $(INSTALLED_SCRIPT)
echo "#!$(SHELL)" >> $(INSTALLED_SCRIPT)
diff --git a/utils/prof/Makefile b/utils/prof/Makefile
index 4401c630a3..0db52a2a67 100644
--- a/utils/prof/Makefile
+++ b/utils/prof/Makefile
@@ -15,7 +15,7 @@ all::
cat ghcprof.prl >> $(INPLACE_SCRIPT)
$(EXECUTABLE_FILE) $(INPLACE_SCRIPT)
-INSTALLED_SCRIPT=$(bindir)/ghcprof
+INSTALLED_SCRIPT=$(DESTDIR)$(bindir)/ghcprof
install::
$(RM) -f $(INSTALLED_SCRIPT)
echo '#!$(PERL)' >> $(INSTALLED_SCRIPT)