From: Chris Hanson Date: Thu, 3 May 2007 03:40:27 +0000 (+0000) Subject: Change "Clean.sh" files to use common shell function to manage file removal. X-Git-Tag: 20090517-FFI~597 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=edb4194f26eed08da05abda98fb8aa40fd246891;p=mit-scheme.git Change "Clean.sh" files to use common shell function to manage file removal. --- diff --git a/v7/src/Clean.sh b/v7/src/Clean.sh index a8aa6f4af..6ace9242b 100755 --- a/v7/src/Clean.sh +++ b/v7/src/Clean.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: Clean.sh,v 1.13 2007/05/02 03:58:38 cph Exp $ +# $Id: Clean.sh,v 1.14 2007/05/03 03:40:02 cph Exp $ # # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, # 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, @@ -67,24 +67,24 @@ maintainer-clean) ;; esac +. etc/functions.sh + +maybe_rm boot-compiler.com + if [ ${FULL} = yes ]; then - echo "rm -f lib/*.com" - rm -f lib/*.com + maybe_rm lib/*.com fi if [ ${C} = yes ]; then - echo "rm -f liarc.stamp" - rm -f liarc.stamp + maybe_rm liarc.stamp fi if [ ${DIST} = yes ]; then - echo "rm -f Makefile config.cache config.log config.status" - rm -f Makefile config.cache config.log config.status + maybe_rm Makefile config.cache config.log config.status fi if [ ${MAINTAINER} = yes ]; then - echo "rm -rf configure lib autom4te.cache" - rm -rf configure lib autom4te.cache + maybe_rm configure lib autom4te.cache fi for SUBDIR in ${SUBDIRS}; do diff --git a/v7/src/Makefile.in b/v7/src/Makefile.in index 374e9d67f..bbda9e11e 100644 --- a/v7/src/Makefile.in +++ b/v7/src/Makefile.in @@ -1,4 +1,4 @@ -# $Id: Makefile.in,v 1.32 2007/04/29 18:01:39 cph Exp $ +# $Id: Makefile.in,v 1.33 2007/05/03 03:40:07 cph Exp $ # # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, # 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, @@ -86,7 +86,6 @@ boot-compiler.com: $(srcdir)/etc/c-boot-compiler.sh mostlyclean clean distclean maintainer-clean c-clean: - -rm -f boot-compiler.com $(srcdir)/Clean.sh $@ $(SUBDIRS) tags TAGS: diff --git a/v7/src/compiler/Clean.sh b/v7/src/compiler/Clean.sh index 3edd6b903..4870c4594 100755 --- a/v7/src/compiler/Clean.sh +++ b/v7/src/compiler/Clean.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: Clean.sh,v 1.17 2007/05/02 03:58:48 cph Exp $ +# $Id: Clean.sh,v 1.18 2007/05/03 03:40:12 cph Exp $ # # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, # 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, @@ -38,6 +38,8 @@ export TOPDIR CLEANSH=${TOPDIR}/etc/Clean.sh "${CLEANSH}" "${1}" +. "${TOPDIR}/etc/functions.sh" + for SUBDIR in back base fggen fgopt machine rtlbase rtlgen rtlopt; do if [ -d "${SUBDIR}" ]; then echo "making ${1} in ${SUBDIR}" @@ -47,12 +49,15 @@ done case ${1} in distclean | maintainer-clean) - rm -f machine compiler.cbf compiler.pkg compiler.sf + echo "rm -f machine compiler.cbf compiler.pkg compiler.sf make.com make.so" + rm -f machine compiler.cbf compiler.pkg compiler.sf make.com make.so ;; esac case ${1} in maintainer-clean) - rm -f machines/vax/dinstr[123].scm + for N in 1 2 3; do + maybe_unlink machines/vax/dinstr${N}.scm instr${N}.scm + done ;; esac diff --git a/v7/src/edwin/Clean.sh b/v7/src/edwin/Clean.sh index d92e5ccf6..c8501c8a7 100755 --- a/v7/src/edwin/Clean.sh +++ b/v7/src/edwin/Clean.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: Clean.sh,v 1.14 2007/05/02 03:58:58 cph Exp $ +# $Id: Clean.sh,v 1.15 2007/05/03 03:40:17 cph Exp $ # # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, # 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, @@ -34,12 +34,9 @@ if [ ${#} -ne 1 ]; then fi ../etc/Clean.sh "${1}" +. ../etc/functions.sh -echo "rm -rf edwin.bld" -rm -f edwin.bld -echo "rm -f edwin-unx.crf edwin-w32.crf edwin-os2.crf" -rm -f edwin-unx.crf edwin-w32.crf edwin-os2.crf -echo "rm -f edwin-unx.pkd edwin-w32.pkd edwin-os2.pkd" -rm -f edwin-unx.pkd edwin-w32.pkd edwin-os2.pkd -echo "rm -f edwin-unx.fre edwin-w32.fre edwin-os2.fre" -rm -f edwin-unx.fre edwin-w32.fre edwin-os2.fre +maybe_rm edwin.bld +maybe_rm edwin-unx.crf edwin-w32.crf edwin-os2.crf +maybe_rm edwin-unx.pkd edwin-w32.pkd edwin-os2.pkd +maybe_rm edwin-unx.fre edwin-w32.fre edwin-os2.fre diff --git a/v7/src/etc/Clean.sh b/v7/src/etc/Clean.sh index f861b9a2a..00ffa680d 100755 --- a/v7/src/etc/Clean.sh +++ b/v7/src/etc/Clean.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: Clean.sh,v 1.19 2007/05/02 03:59:03 cph Exp $ +# $Id: Clean.sh,v 1.20 2007/05/03 03:40:22 cph Exp $ # # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, # 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, @@ -67,9 +67,8 @@ TOPDIR=${TOPDIR:-..} . "${TOPDIR}/etc/functions.sh" if [ ${DIST} = yes ]; then - if [ -f Makefile.in ] && [ -f Makefile ]; then - echo "rm Makefile" - rm Makefile + if [ -f Makefile.in ]; then + maybe_rm Makefile fi fi @@ -84,24 +83,18 @@ fi for KEYWORD in ${KEYWORDS}; do case ${KEYWORD} in rm-bin) - echo "rm -f *.bin *.ext" - rm -f *.bin *.ext + maybe_rm *.bin *.ext ;; rm-com) - echo "rm -f *.com *.bci *.o *.so *.sl *.dylib" - rm -f *.com *.bci *.o *.so *.sl *.dylib + maybe_rm *.com *.bci *.o *.so *.sl *.dylib ;; rm-pkg) - echo "rm -f *-unx.crf *-unx.fre *-unx.pkd" - rm -f *-unx.crf *-unx.fre *-unx.pkd - echo "rm -f *-w32.crf *-w32.fre *-w32.pkd" - rm -f *-w32.crf *-w32.fre *-w32.pkd - echo "rm -f *-os2.crf *-os2.fre *-os2.pkd" - rm -f *-os2.crf *-os2.fre *-os2.pkd + maybe_rm *-unx.crf *-unx.fre *-unx.pkd + maybe_rm *-w32.crf *-w32.fre *-w32.pkd + maybe_rm *-os2.crf *-os2.fre *-os2.pkd ;; rm-c) - echo "rm -f *.c" - rm -f *.c + maybe_rm *.c ;; esac done diff --git a/v7/src/etc/functions.sh b/v7/src/etc/functions.sh index ca6538fd0..a015256fa 100644 --- a/v7/src/etc/functions.sh +++ b/v7/src/etc/functions.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: functions.sh,v 1.6 2007/01/05 21:19:25 cph Exp $ +# $Id: functions.sh,v 1.7 2007/05/03 03:40:27 cph Exp $ # # Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, # 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, @@ -48,3 +48,26 @@ maybe_unlink () rm "${1}" fi } + +maybe_rm () +{ + FNS= + DIRS= + for FN in "${@}"; do + if [ ! -L "${FN}" ]; then + if [ -f "${FN}" ]; then + FNS="${FNS} ${FN}" + elif [ -d "${FN}" ]; then + DIRS="${DIRS} ${FN}" + fi + fi + done + if [ "${FNS}" ]; then + echo "rm -f ${FNS}" + rm -f ${FNS} + fi + if [ "${DIRS}" ]; then + echo "rm -rf ${DIRS}" + rm -rf ${DIRS} + fi +}