Commit 80e9070c authored by Ian Lynagh's avatar Ian Lynagh

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.
parent 04284171
......@@ -44,7 +44,7 @@ compiler/stage3/package-data.mk : compiler/stage3/build/Config.hs
endif
compiler/stage%/build/Config.hs : mk/config.mk mk/project.mk | $$(dir $$@)/.
"$(RM)" $(RM_OPTS) $@
$(call removeFiles,$@)
@echo 'Creating $@ ... '
@echo '{-# LANGUAGE CPP #-}' >> $@
@echo 'module Config where' >> $@
......@@ -157,7 +157,7 @@ $(eval $(call clean-target,compiler,config_hs,compiler/main/Config.hs))
PLATFORM_H = ghc_boot_platform.h
compiler/stage1/$(PLATFORM_H) : mk/config.mk mk/project.mk | $$(dir $$@)/.
"$(RM)" $(RM_OPTS) $@
$(call removeFiles,$@)
@echo "Creating $@..."
@echo "#ifndef __PLATFORM_H__" >> $@
@echo "#define __PLATFORM_H__" >> $@
......@@ -203,7 +203,7 @@ endif
# the HOST platform is the TARGET of stage1. The TARGET remains the same
# (stage1 is the cross-compiler, not stage2).
compiler/stage2/$(PLATFORM_H) : mk/config.mk mk/project.mk | $$(dir $$@)/.
"$(RM)" $(RM_OPTS) $@
$(call removeFiles,$@)
@echo "Creating $@..."
@echo "#ifndef __PLATFORM_H__" >> $@
@echo "#define __PLATFORM_H__" >> $@
......
......@@ -30,7 +30,7 @@ docs/man/flags.xsl: docs/man/gen_flags.xsl.sh
# Re-use the flags documentation from the user's guide by injecting some
# entities after the XML declaration to make it a stand-alone document.
docs/man/flags.xml: docs/users_guide/flags.xml
"$(RM)" $(RM_OPTS) $@
$(call removeFiles,$@)
head -n 1 $< >> $@
echo "<!DOCTYPE sect1 [<!ENTITY ndash \"-\"> \
<!ENTITY ldquo \"\`\"> \
......
......@@ -18,12 +18,12 @@ install: install_driver_ghci
install_driver_ghci: WRAPPER=$(DESTDIR)$(bindir)/ghci-$(ProjectVersion)
install_driver_ghci:
$(call INSTALL_DIR,"$(DESTDIR)$(bindir)")
"$(RM)" $(RM_OPTS) "$(WRAPPER)"
$(call removeFiles, "$(WRAPPER)")
$(CREATE_SCRIPT) "$(WRAPPER)"
echo '#!$(SHELL)' >> "$(WRAPPER)"
echo 'exec "$(bindir)/ghc-$(ProjectVersion)" --interactive $${1+"$$@"}' >> "$(WRAPPER)"
$(EXECUTABLE_FILE) "$(WRAPPER)"
"$(RM)" $(RM_OPTS) "$(DESTDIR)$(bindir)/ghci"
$(call removeFiles,"$(DESTDIR)$(bindir)/ghci")
$(LN_S) ghci-$(ProjectVersion) "$(DESTDIR)$(bindir)/ghci"
else # Windows...
......@@ -53,7 +53,7 @@ install_driver_ghcii: GHCII_SCRIPT=$(DESTDIR)$(bindir)/ghcii.sh
install_driver_ghcii: GHCII_SCRIPT_VERSIONED = $(DESTDIR)$(bindir)/ghcii-$(ProjectVersion).sh
install_driver_ghcii:
$(call INSTALL_DIR,$(DESTDIR)$(bindir))
"$(RM)" $(RM_OPTS) $(GHCII_SCRIPT)
$(call removeFiles,$(GHCII_SCRIPT))
echo "#!$(SHELL)" >> $(GHCII_SCRIPT)
echo 'exec "$$0"/../ghc --interactive $${1+"$$@"}' >> $(GHCII_SCRIPT)
$(EXECUTABLE_FILE) $(GHCII_SCRIPT)
......
......@@ -672,8 +672,11 @@ ifeq "$(phase)" "final"
$(eval $(call all-target,library_doc_index,libraries/index.html))
endif
INSTALL_LIBRARY_DOCS += libraries/*.html libraries/*.gif libraries/*.css libraries/*.js
CLEAN_FILES += libraries/doc-index* libraries/haddock*.css \
libraries/haddock*.js libraries/index*.html libraries/*.gif
CLEAN_FILES += $(wildcard libraries/doc-index* \
libraries/haddock*.css \
libraries/haddock*.js \
libraries/index*.html \
libraries/*.gif)
endif
# -----------------------------------------------------------------------------
......@@ -882,7 +885,7 @@ INSTALL_DISTDIR_compiler = stage2
install_packages: install_libexecs
install_packages: rts/package.conf.install
$(call INSTALL_DIR,"$(DESTDIR)$(topdir)")
"$(RM)" $(RM_OPTS_REC) "$(INSTALLED_PACKAGE_CONF)"
$(call removeTrees,"$(INSTALLED_PACKAGE_CONF)")
$(call INSTALL_DIR,"$(INSTALLED_PACKAGE_CONF)")
"$(INSTALLED_GHC_PKG_REAL)" --force --global-conf "$(INSTALLED_PACKAGE_CONF)" update rts/package.conf.install
$(foreach p, $(INSTALLED_PKG_DIRS), \
......@@ -962,7 +965,7 @@ endif
BIN_DIST_MK = $(BIN_DIST_PREP_DIR)/bindist.mk
unix-binary-dist-prep:
"$(RM)" $(RM_OPTS_REC) bindistprep/
$(call removeTrees,bindistprep/)
"$(MKDIRHIER)" $(BIN_DIST_PREP_DIR)
set -e; for i in packages LICENSE compiler ghc rts libraries utils docs libffi includes driver mk rules Makefile aclocal.m4 config.sub config.guess install-sh settings.in ghc.mk inplace distrib/configure.ac distrib/README distrib/INSTALL; do ln -s ../../$$i $(BIN_DIST_PREP_DIR)/; done
echo "HADDOCK_DOCS = $(HADDOCK_DOCS)" >> $(BIN_DIST_MK)
......@@ -973,13 +976,13 @@ unix-binary-dist-prep:
echo "BUILD_MAN = $(BUILD_MAN)" >> $(BIN_DIST_MK)
echo "GHC_CABAL_INPLACE = utils/ghc-cabal/dist-install/build/tmp/ghc-cabal" >> $(BIN_DIST_MK)
cd $(BIN_DIST_PREP_DIR) && autoreconf
"$(RM)" $(RM_OPTS) $(BIN_DIST_PREP_TAR)
$(call removeFiles,$(BIN_DIST_PREP_TAR))
# h means "follow symlinks", e.g. if aclocal.m4 is a symlink to a source
# tree then we want to include the real file, not a symlink to it
cd bindistprep && "$(TAR_CMD)" hcf - -T ../$(BIN_DIST_LIST) | bzip2 -c > ../$(BIN_DIST_PREP_TAR_BZ2)
windows-binary-dist-prep:
"$(RM)" $(RM_OPTS_REC) bindistprep/
$(call removeTrees,bindistprep/)
$(MAKE) prefix=$(TOP)/$(BIN_DIST_PREP_DIR) install
cd bindistprep && "$(TAR_CMD)" cf - $(BIN_DIST_NAME) | bzip2 -c > ../$(BIN_DIST_PREP_TAR_BZ2)
......@@ -1074,8 +1077,8 @@ endef
.PHONY: sdist-prep
sdist-prep :
"$(RM)" $(RM_OPTS_REC) $(SRC_DIST_DIR)
"$(RM)" $(RM_OPTS) $(SRC_DIST_TARBALL)
$(call removeTrees,$(SRC_DIST_DIR))
$(call removeFiles,$(SRC_DIST_TARBALL))
mkdir $(SRC_DIST_DIR)
cd $(SRC_DIST_DIR) && for i in $(SRC_DIST_DIRS); do mkdir $$i; ( cd $$i && lndir $(TOP)/$$i ); done
cd $(SRC_DIST_DIR) && for i in $(SRC_DIST_FILES); do $(LN_S) $(TOP)/$$i .; done
......@@ -1092,7 +1095,7 @@ sdist-prep :
$(call sdist_file,utils/genprimopcode,dist,,,Parser,y)
$(call sdist_file,utils/haddock,dist,src,Haddock,Lex,x)
$(call sdist_file,utils/haddock,dist,src,Haddock,Parse,y)
cd $(SRC_DIST_DIR) && "$(RM)" $(RM_OPTS_REC) compiler/stage[123] mk/build.mk
cd $(SRC_DIST_DIR) && $(call removeTrees,compiler/stage[123] mk/build.mk)
cd $(SRC_DIST_DIR) && "$(FIND)" $(SRC_DIST_DIRS) \( -name _darcs -o -name SRC -o -name "autom4te*" -o -name "*~" -o -name ".cvsignore" -o -name "\#*" -o -name ".\#*" -o -name "log" -o -name "*-SAVE" -o -name "*.orig" -o -name "*.rej" -o -name "*-darcs-backup*" \) -print | "$(XARGS)" $(XARGS_OPTS) "$(RM)" $(RM_OPTS_REC)
.PHONY: sdist
......@@ -1142,15 +1145,15 @@ clean : clean_files clean_libraries
.PHONY: clean_files
clean_files :
"$(RM)" $(RM_OPTS) $(CLEAN_FILES)
$(call removeFiles,$(CLEAN_FILES))
.PHONY: clean_libraries
clean_libraries: $(patsubst %,clean_libraries/%_dist-install,$(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
clean_libraries: $(patsubst %,clean_libraries/%_dist-boot,$(PACKAGES_STAGE0))
clean_libraries:
"$(RM)" $(RM_OPTS_REC) $(patsubst %, libraries/%/dist, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
"$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/*.buildinfo, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
$(call removeTrees,$(patsubst %, libraries/%/dist, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2)))
$(call removeFiles,$(patsubst %, $(wildcard libraries/%/*.buildinfo), $(PACKAGES_STAGE1) $(PACKAGES_STAGE2)))
# We have to define a clean target for each library manually, because the
# libraries/*/ghc.mk files are not included when we're cleaning.
......@@ -1164,42 +1167,42 @@ endif
clean : clean_bindistprep
.PHONY: clean_bindistprep
clean_bindistprep:
"$(RM)" $(RM_OPTS_REC) bindistprep/
$(call removeTrees,bindistprep/)
distclean : clean
"$(RM)" $(RM_OPTS) config.cache config.status config.log mk/config.h mk/stamp-h
"$(RM)" $(RM_OPTS) mk/config.mk mk/are-validating.mk mk/project.mk
"$(RM)" $(RM_OPTS) mk/config.mk.old mk/project.mk.old
"$(RM)" $(RM_OPTS) settings docs/users_guide/ug-book.xml
"$(RM)" $(RM_OPTS) compiler/ghc.cabal compiler/ghc.cabal.old
"$(RM)" $(RM_OPTS) ghc/ghc-bin.cabal
"$(RM)" $(RM_OPTS) libraries/base/include/HsBaseConfig.h
"$(RM)" $(RM_OPTS) libraries/directory/include/HsDirectoryConfig.h
"$(RM)" $(RM_OPTS) libraries/process/include/HsProcessConfig.h
"$(RM)" $(RM_OPTS) libraries/unix/include/HsUnixConfig.h
"$(RM)" $(RM_OPTS) libraries/old-time/include/HsTimeConfig.h
"$(RM)" $(RM_OPTS_REC) utils/ghc-pwd/dist
"$(RM)" $(RM_OPTS_REC) inplace
"$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/config.log, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
"$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/config.status, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
"$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/include/Hs*Config.h, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
"$(RM)" $(RM_OPTS_REC) $(patsubst %, libraries/%/autom4te.cache, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
$(call removeFiles,config.cache config.status config.log mk/config.h mk/stamp-h)
$(call removeFiles,mk/config.mk mk/are-validating.mk mk/project.mk)
$(call removeFiles,mk/config.mk.old mk/project.mk.old)
$(call removeFiles,settings docs/users_guide/ug-book.xml)
$(call removeFiles,compiler/ghc.cabal compiler/ghc.cabal.old)
$(call removeFiles,ghc/ghc-bin.cabal)
$(call removeFiles,libraries/base/include/HsBaseConfig.h)
$(call removeFiles,libraries/directory/include/HsDirectoryConfig.h)
$(call removeFiles,libraries/process/include/HsProcessConfig.h)
$(call removeFiles,libraries/unix/include/HsUnixConfig.h)
$(call removeFiles,libraries/old-time/include/HsTimeConfig.h)
$(call removeTrees,utils/ghc-pwd/dist)
$(call removeTrees,inplace)
$(call removeFiles,$(patsubst %, libraries/%/config.log, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2)))
$(call removeFiles,$(patsubst %, libraries/%/config.status, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2)))
$(call removeFiles,$(patsubst %, $(wildcard,libraries/%/include/Hs*Config.h), $(PACKAGES_STAGE1) $(PACKAGES_STAGE2)))
$(call removeTrees,$(patsubst %, libraries/%/autom4te.cache, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2)))
maintainer-clean : distclean
"$(RM)" $(RM_OPTS) configure mk/config.h.in
"$(RM)" $(RM_OPTS_REC) autom4te.cache libraries/*/autom4te.cache
"$(RM)" $(RM_OPTS) ghc.spec
"$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/GNUmakefile, \
$(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
"$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/ghc.mk, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
"$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/configure, \
$(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
"$(RM)" $(RM_OPTS) libraries/base/include/HsBaseConfig.h.in
"$(RM)" $(RM_OPTS) libraries/directory/include/HsDirectoryConfig.h.in
"$(RM)" $(RM_OPTS) libraries/process/include/HsProcessConfig.h.in
"$(RM)" $(RM_OPTS) libraries/unix/include/HsUnixConfig.h.in
"$(RM)" $(RM_OPTS) libraries/old-time/include/HsTimeConfig.h.in
$(call removeFiles,configure mk/config.h.in)
$(call removeTrees,autom4te.cache $(wildcard libraries/*/autom4te.cache))
$(call removeFiles,ghc.spec)
$(call removeFiles,$(patsubst %, libraries/%/GNUmakefile, \
$(PACKAGES_STAGE1) $(PACKAGES_STAGE2)))
$(call removeFiles,$(patsubst %, libraries/%/ghc.mk, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2)))
$(call removeFiles,$(patsubst %, libraries/%/configure, \
$(PACKAGES_STAGE1) $(PACKAGES_STAGE2)))
$(call removeFiles,libraries/base/include/HsBaseConfig.h.in)
$(call removeFiles,libraries/directory/include/HsDirectoryConfig.h.in)
$(call removeFiles,libraries/process/include/HsProcessConfig.h.in)
$(call removeFiles,libraries/unix/include/HsUnixConfig.h.in)
$(call removeFiles,libraries/old-time/include/HsTimeConfig.h.in)
.PHONY: all_libraries
......
......@@ -143,7 +143,7 @@ ifeq "$(Windows)" "NO"
install: install_ghc_link
.PNONY: install_ghc_link
install_ghc_link:
"$(RM)" $(RM_OPTS) "$(DESTDIR)$(bindir)/ghc"
$(call removeFiles,"$(DESTDIR)$(bindir)/ghc")
$(LN_S) ghc-$(ProjectVersion) "$(DESTDIR)$(bindir)/ghc"
else
# On Windows we install the main binary as $(bindir)/ghc.exe
......@@ -151,7 +151,7 @@ else
install: install_ghc_post
.PHONY: install_ghc_post
install_ghc_post: install_bins
"$(RM)" $(RM_OPTS) $(DESTDIR)$(bindir)/ghc.exe
$(call removeFiles,$(DESTDIR)$(bindir)/ghc.exe)
"$(MV)" -f $(DESTDIR)$(bindir)/ghc-stage$(INSTALL_GHC_STAGE).exe $(DESTDIR)$(bindir)/ghc.exe
endif
......@@ -74,7 +74,7 @@ $(includes_H_CONFIG) : mk/config.h mk/config.mk includes/ghc.mk
endif
$(includes_H_PLATFORM) : includes/Makefile
"$(RM)" $(RM_OPTS) $@
$(call removeFiles,$@)
@echo "Creating $@..."
@echo "#ifndef __GHCPLATFORM_H__" >$@
@echo "#define __GHCPLATFORM_H__" >>$@
......
......@@ -40,13 +40,13 @@ endif
ifneq "$(BINDIST)" "YES"
$(libffi_STAMP_CONFIGURE):
"$(RM)" $(RM_OPTS) $(libffi_STAMP_STATIC_CONFIGURE)
"$(RM)" $(RM_OPTS) $(libffi_STAMP_STATIC_BUILD)
"$(RM)" $(RM_OPTS) $(libffi_STAMP_STATIC_INSTALL)
"$(RM)" $(RM_OPTS) $(libffi_STAMP_STATIC_SHARED_CONFIGURE)
"$(RM)" $(RM_OPTS) $(libffi_STAMP_STATIC_SHARED_BUILD)
"$(RM)" $(RM_OPTS) $(libffi_STAMP_STATIC_SHARED_INSTALL)
"$(RM)" $(RM_OPTS_REC) $(LIBFFI_DIR) libffi/build
$(call removeFiles,$(libffi_STAMP_STATIC_CONFIGURE))
$(call removeFiles,$(libffi_STAMP_STATIC_BUILD))
$(call removeFiles,$(libffi_STAMP_STATIC_INSTALL))
$(call removeFiles,$(libffi_STAMP_STATIC_SHARED_CONFIGURE))
$(call removeFiles,$(libffi_STAMP_STATIC_SHARED_BUILD))
$(call removeFiles,$(libffi_STAMP_STATIC_SHARED_INSTALL))
$(call removeTrees,$(LIBFFI_DIR) libffi/build)
cat ghc-tarballs/libffi/libffi*.tar.gz | $(GZIP_CMD) -d | { cd libffi && $(TAR_CMD) -xf - ; }
mv libffi/libffi-* libffi/build
......@@ -95,7 +95,7 @@ $(ffi_HEADER): $(libffi_STAMP_INSTALL) | $$(dir $$@)/.
cp libffi/build/inst/lib/libffi-*/include/ffi.h $@
$(eval $(call clean-target,libffi,, \
libffi/build libffi/stamp.ffi.* libffi/dist-install))
libffi/build $(wildcard libffi/stamp.ffi.*) libffi/dist-install))
endif
......@@ -74,3 +74,24 @@ RM_OPTS = -f
RM_OPTS_REC = -rf
endif
# If $1 is empty then we don't do anything (as "rm -rf" fails on
# Solaris; trac #4916).
# If $1 contains a * then we fail; globbing needs to be done at the call
# site using $(wildcard ...). This makes it a little safer, as it's
# harder to accidentally delete something you didn't mean to.
# Similarly, we fail if any argument contains ".." or starts with a "/".
removeFiles = $(call removeHelper,removeFiles,"$(RM)",$(RM_OPTS),$1)
removeTrees = $(call removeHelper,removeTrees,"$(RM)",$(RM_OPTS_REC),$1)
removeHelper = $(if $(strip $4),\
$(if $(findstring *,$4),\
$(error $1: Got a star: $4),\
$(if $(findstring ..,$4),\
$(error $1: Got dot-dot: $4),\
$(if $(filter /%,$4),\
$(error $1: Got leading slash: $4),\
$2 $3 $4\
)))\
)
......@@ -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 $$@
......
......@@ -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)
......
......@@ -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))
......
......@@ -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)";' >> $$@
......
......@@ -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
......@@ -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 \
......
......@@ -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
......@@ -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)"
......
......@@ -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
......@@ -14,7 +14,7 @@ $(MKDIRHIER) : utils/mkdirhier/mkdirhier.sh
-mkdir $(INPLACE)
-mkdir $(INPLACE_BIN)
-mkdir $(INPLACE_LIB)
"$(RM)" $(RM_OPTS) $@
$(call removeFiles,$@)
echo '#!$(SHELL)' >> $@
cat utils/mkdirhier/mkdirhier.sh >> $@
$(EXECUTABLE_FILE) $@
......
......@@ -33,7 +33,7 @@ install_runhaskell: install_bins
"$(CP)" $(DESTDIR)$(bindir)/runghc$(exeext) $(DESTDIR)$(bindir)/runhaskell$(exeext)
else
install_runhaskell:
"$(RM)" $(RM_OPTS) "$(DESTDIR)$(bindir)/runhaskell"
$(call removeFiles,"$(DESTDIR)$(bindir)/runhaskell")
$(LN_S) runghc "$(DESTDIR)$(bindir)/runhaskell"
endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment