summaryrefslogtreecommitdiff
path: root/utils/ghc-pkg
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2011-11-19 01:29:05 +0000
committerIan Lynagh <igloo@earth.li>2011-11-19 01:52:32 +0000
commit80e9070c77718b7ff0e913182e54842754726ce8 (patch)
tree12804916372a3675a7d1beb00bd41e70083c5edf /utils/ghc-pkg
parent042841713eb6468696eeb437de994c52eb7a858e (diff)
downloadhaskell-80e9070c77718b7ff0e913182e54842754726ce8.tar.gz
Improve the way we call "rm" in the build system; fixes trac #4916
We avoid calling "rm -rf" with no file arguments; this fixes cleaning on Solaris, where that fails. We also check for suspicious arguments: anything containing "..", starting "/", or containing a "*" (you need to call $(wildcard ...) yourself now if you really want globbing). This should make things a little safer.
Diffstat (limited to 'utils/ghc-pkg')
-rw-r--r--utils/ghc-pkg/ghc.mk10
1 files changed, 5 insertions, 5 deletions
diff --git a/utils/ghc-pkg/ghc.mk b/utils/ghc-pkg/ghc.mk
index f4205479ea..b6e762530a 100644
--- a/utils/ghc-pkg/ghc.mk
+++ b/utils/ghc-pkg/ghc.mk
@@ -21,7 +21,7 @@ inplace/bin/ghc-pkg : utils/ghc-pkg/dist-install/build/tmp/$(utils/ghc-pkg_dist_
ifeq "$(Windows)" "YES"
cp $< $@
else
- "$(RM)" $(RM_OPTS) $@
+ $(call removeFiles,$@)
echo "#!/bin/sh" >>$@
echo "PKGCONF=$(TOP)/$(INPLACE_PACKAGE_CONF)" >>$@
echo '$(TOP)/$< --global-conf $$PKGCONF $${1+"$$@"}' >> $@
@@ -31,11 +31,11 @@ endif
else
$(GHC_PKG_INPLACE) : utils/ghc-pkg/dist/build/$(utils/ghc-pkg_dist_PROG)$(exeext) | $$(dir $$@)/. $(INPLACE_PACKAGE_CONF)/.
- "$(RM)" $(RM_OPTS) $(INPLACE_PACKAGE_CONF)/*
+ $(call removeFiles,$(wildcard $(INPLACE_PACKAGE_CONF)/*))
ifeq "$(Windows)" "YES"
cp $< $@
else
- "$(RM)" $(RM_OPTS) $@
+ $(call removeFiles,$@)
echo "#!/bin/sh" >>$@
echo "PKGCONF=$(TOP)/$(INPLACE_PACKAGE_CONF)" >>$@
echo '$(TOP)/$< --global-conf $$PKGCONF $${1+"$$@"}' >> $@
@@ -70,7 +70,7 @@ utils/ghc-pkg/dist/build/$(utils/ghc-pkg_dist_PROG)$(exeext): utils/ghc-pkg/Main
utils/ghc-pkg/Version.hs: mk/project.mk
- "$(RM)" $(RM_OPTS) $@
+ $(call removeFiles,$@)
echo "module Version where" >> $@
echo "version, targetOS, targetARCH :: String" >> $@
echo "version = \"$(ProjectVersion)\"" >> $@
@@ -105,7 +105,7 @@ install: install_utils/ghc-pkg_link
.PNONY: install_utils/ghc-pkg_link
install_utils/ghc-pkg_link:
$(call INSTALL_DIR,"$(DESTDIR)$(bindir)")
- "$(RM)" $(RM_OPTS) "$(DESTDIR)$(bindir)/ghc-pkg"
+ $(call removeFiles,"$(DESTDIR)$(bindir)/ghc-pkg")
$(LN_S) ghc-pkg-$(ProjectVersion) "$(DESTDIR)$(bindir)/ghc-pkg"
endif