summaryrefslogtreecommitdiff
path: root/rules
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 /rules
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 'rules')
-rw-r--r--rules/build-dependencies.mk6
-rw-r--r--rules/build-package-way.mk4
-rw-r--r--rules/build-package.mk4
-rw-r--r--rules/build-perl.mk2
-rw-r--r--rules/clean-target.mk2
-rw-r--r--rules/docbook.mk2
-rw-r--r--rules/manual-package-config.mk2
-rw-r--r--rules/shell-wrapper.mk4
8 files changed, 13 insertions, 13 deletions
diff --git a/rules/build-dependencies.mk b/rules/build-dependencies.mk
index e6d493ccf7..c9c62cdcdc 100644
--- a/rules/build-dependencies.mk
+++ b/rules/build-dependencies.mk
@@ -32,7 +32,7 @@ ifneq "$$(NO_GENERATED_MAKEFILE_RULES)" "YES"
$$($1_$2_depfile_haskell) : $$(includes_H_CONFIG) $$(includes_H_PLATFORM)
$$($1_$2_depfile_haskell) : $$($1_$2_HS_SRCS) $$($1_$2_HS_BOOT_SRCS) $$($1_$2_HC_MK_DEPEND_DEP) | $$$$(dir $$$$@)/.
- "$$(RM)" $$(RM_OPTS) $$@.tmp
+ $$(call removeFiles,$$@.tmp)
touch $$@.tmp
ifneq "$$($1_$2_HS_SRCS)" ""
"$$($1_$2_HC_MK_DEPEND)" -M $$($1_$2_MKDEPENDHS_FLAGS) \
@@ -55,7 +55,7 @@ endif
$$($1_$2_depfile_c_asm) : $$(includes_H_CONFIG) $$(includes_H_PLATFORM)
$$($1_$2_depfile_c_asm) : $$($1_$2_C_FILES_DEPS) $$($1_$2_S_FILES) | $$$$(dir $$$$@)/.
- "$$(RM)" $$(RM_OPTS) $$@.tmp
+ $$(call removeFiles,$$@.tmp)
touch $$@.tmp
ifneq "$$(strip $$($1_$2_C_FILES_DEPS)$$($1_$2_S_FILES))" ""
# We ought to actually do this for each way in $$($1_$2_WAYS), but then
@@ -64,7 +64,7 @@ ifneq "$$(strip $$($1_$2_C_FILES_DEPS)$$($1_$2_S_FILES))" ""
# copy the deps for each way on the assumption that they are the same
$$(foreach f,$$($1_$2_C_FILES_DEPS) $$($1_$2_S_FILES), \
$$(call addCFileDeps,$1,$2,$$($1_$2_depfile_c_asm),$$f,$$($1_$2_WAYS)))
- "$$(RM)" $$(RM_OPTS) $$@.bit
+ $$(call removeFiles,$$@.bit)
endif
echo "$1_$2_depfile_c_asm_EXISTS = YES" >> $$@.tmp
mv $$@.tmp $$@
diff --git a/rules/build-package-way.mk b/rules/build-package-way.mk
index 2497e298c2..00ce06572d 100644
--- a/rules/build-package-way.mk
+++ b/rules/build-package-way.mk
@@ -80,7 +80,7 @@ endif
else
# Build the ordinary .a library
$$($1_$2_$3_LIB) : $$($1_$2_$3_ALL_OBJS)
- "$$(RM)" $$(RM_OPTS) $$@ $$@.contents
+ $$(call removeFiles,$$@ $$@.contents)
ifeq "$$($1_$2_SplitObjs)" "YES"
$$(FIND) $$(patsubst %.$$($3_osuf),%_$$($3_osuf)_split,$$($1_$2_$3_HS_OBJS)) -name '*.$$($3_osuf)' -print >> $$@.contents
echo $$($1_$2_$3_NON_HS_OBJS) >> $$@.contents
@@ -92,7 +92,7 @@ ifeq "$$($1_$2_ArSupportsAtFile)" "YES"
else
"$$(XARGS)" $$(XARGS_OPTS) "$$($1_$2_AR)" $$($1_$2_AR_OPTS) $$($1_$2_EXTRA_AR_ARGS) $$@ < $$@.contents
endif
- "$$(RM)" $$(RM_OPTS) $$@.contents
+ $$(call removeFiles,$$@.contents)
endif
$(call all-target,$1_$2,all_$1_$2_$3)
diff --git a/rules/build-package.mk b/rules/build-package.mk
index 32556579cb..d83a79d89d 100644
--- a/rules/build-package.mk
+++ b/rules/build-package.mk
@@ -47,8 +47,8 @@ maintainer-clean : distclean
.PHONY: clean_$1_$2_config
clean_$1_$2_config:
- "$$(RM)" $$(RM_OPTS) $1/config.log $1/config.status $1/include/Hs*Config.h
- "$$(RM)" $$(RM_OPTS_REC) $1/autom4te.cache
+ $$(call removeFiles,$1/config.log $1/config.status $(wildcard $1/include/Hs*Config.h))
+ $$(call removeTrees,$1/autom4te.cache)
ifneq "$$($1_$2_NOT_NEEDED)" "YES"
$$(eval $$(call build-package-helper,$1,$2,$3))
diff --git a/rules/build-perl.mk b/rules/build-perl.mk
index 301d84860c..b39134f05f 100644
--- a/rules/build-perl.mk
+++ b/rules/build-perl.mk
@@ -44,7 +44,7 @@ $1/$2/$$($1_$2_PROG).prl: $1/$$($1_PERL_SRC) $$(UNLIT) | $$$$(dir $$$$@)/.
endif
$1/$2/$$($1_$2_PROG): $1/$2/$$($1_$2_PROG).prl
- "$$(RM)" $$(RM_OPTS) $$@
+ $$(call removeFiles,$$@)
echo '#!$$(PERL)' >> $$@
echo '$$$$TARGETPLATFORM = "$$(TARGETPLATFORM)";' >> $$@
echo '$$$$TABLES_NEXT_TO_CODE = "$(GhcEnableTablesNextToCode)";' >> $$@
diff --git a/rules/clean-target.mk b/rules/clean-target.mk
index 5da31fa881..e54d9fb025 100644
--- a/rules/clean-target.mk
+++ b/rules/clean-target.mk
@@ -17,5 +17,5 @@ clean : clean_$1
clean_$1 : clean_$1_$2
.PHONY: clean_$1_$2
clean_$1_$2:
- "$$(RM)" $$(RM_OPTS_REC) $3
+ $$(call removeTrees,$3)
endef
diff --git a/rules/docbook.mk b/rules/docbook.mk
index 5a7bfdfd83..864fb3583e 100644
--- a/rules/docbook.mk
+++ b/rules/docbook.mk
@@ -37,7 +37,7 @@ html_$1 : $1/$2/index.html
ifneq "$$(BINDIST)" "YES"
$1/$2/index.html: $$($1_DOCBOOK_SOURCES)
- "$$(RM)" $$(RM_OPTS_REC) $$(dir $$@)
+ $$(call removeTrees,$$(dir $$@))
"$$(XSLTPROC)" --stringparam base.dir $$(dir $$@) \
--stringparam use.id.as.filename 1 \
--stringparam html.stylesheet fptools.css \
diff --git a/rules/manual-package-config.mk b/rules/manual-package-config.mk
index c37f204d95..6f350dcac0 100644
--- a/rules/manual-package-config.mk
+++ b/rules/manual-package-config.mk
@@ -41,7 +41,7 @@ $1/package.conf.install:
distclean : clean_$1_package.conf
.PHONY: clean_$1_package.conf
clean_$1_package.conf :
- "$$(RM)" $$(RM_OPTS) $1/package.conf.install $1/package.conf.inplace
+ $$(call removeFiles,$1/package.conf.install $1/package.conf.inplace)
$(call profEnd, manual-package-config($1))
endef
diff --git a/rules/shell-wrapper.mk b/rules/shell-wrapper.mk
index 5cc10dc347..2376db137f 100644
--- a/rules/shell-wrapper.mk
+++ b/rules/shell-wrapper.mk
@@ -36,7 +36,7 @@ all_$1_$2 : $$(INPLACE_BIN)/$$($1_$2_PROG)
$$(INPLACE_BIN)/$$($1_$2_PROG): WRAPPER=$$@
$$(INPLACE_BIN)/$$($1_$2_PROG): $$($1_$2_INPLACE) $$($1_$2_SHELL_WRAPPER_NAME)
- "$$(RM)" $$(RM_OPTS) $$@
+ $$(call removeFiles, $$@)
echo '#!$$(SHELL)' >> $$@
echo 'executablename="$$(TOP)/$$<"' >> $$@
echo 'datadir="$$(TOP)/$$(INPLACE_LIB)"' >> $$@
@@ -65,7 +65,7 @@ install: install_$1_$2_wrapper
install_$1_$2_wrapper: WRAPPER=$$(DESTDIR)$$(bindir)/$$($1_$2_INSTALL_SHELL_WRAPPER_NAME)
install_$1_$2_wrapper:
$$(call INSTALL_DIR,"$$(DESTDIR)$$(bindir)")
- "$$(RM)" $$(RM_OPTS) "$$(WRAPPER)"
+ $$(call removeFiles, "$$(WRAPPER)")
$$(CREATE_SCRIPT) "$$(WRAPPER)"
echo '#!$$(SHELL)' >> "$$(WRAPPER)"
echo 'exedir="$$(ghclibexecdir)"' >> "$$(WRAPPER)"