From 1b5636afedd0bf8c0b3fb16fa1be1d8fae75d425 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Sat, 6 Mar 2021 22:21:36 -0800 Subject: [PATCH] Use ${ECHON} for when /bin/echo -n is needed --- CHANGES | 3 ++- Makefile.ship | 14 ++++++++++---- cscript/Makefile | 7 ++++++- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index a24ab5c..73c255f 100644 --- a/CHANGES +++ b/CHANGES @@ -25,7 +25,8 @@ The following are the changes from calc version 2.12.8.1 to date: Fixed Makefile dependenies for the args.h rule. Fixed Makefile cases where echo with -n is used. On some systems, - /bin/sh does not use -n, so we must call /bin/echo -n instead. + /bin/sh does not use -n, so we must call /bin/echo -n instead + via the ${ECHON} Makefile variable. Add missing standard tools to sub-Makefiles to make them easier to invoke directly. diff --git a/Makefile.ship b/Makefile.ship index d76233e..06a6d13 100644 --- a/Makefile.ship +++ b/Makefile.ship @@ -1100,6 +1100,11 @@ TRUE= true UNAME= uname XARGS= xargs +# NOTE: On some shells, echo is a builtin that does +# not understand -n, so we call /bin/echo -n +# directly to get around such shells. +ECHON= /bin/echo -n + # assume the X11 makedepend tool for the depend rule MAKEDEPEND= makedepend STRIP= strip @@ -3511,7 +3516,8 @@ have_strdup.h: have_strdup.c ${MAKE_FILE} ${TRUE}; \ fi -args.h: have_stdvs.c have_varvs.c have_string.h have_unistd.h have_string.h have_stdlib.h +args.h: have_stdvs.c have_varvs.c have_string.h have_unistd.h have_string.h \ + have_stdlib.h ${Q} ${RM} -f args.h ${Q} echo 'forming args.h' ${Q} echo '/*' > args.h @@ -4301,7 +4307,7 @@ debug: calcinfo env @${MAKE} -f Makefile Q= V=@ ver_calc${EXT} -@./ver_calc${EXT} @echo '=-=-=-= Back to the main Makefile for $@ rule =-=-=-=' - @/bin/echo -n '=-=-=-= Print #defile values if custom functions ' + @${ECHON} '=-=-=-= Print #defile values if custom functions ' @echo 'are allowed =-=-=-=' -@${CALC_ENV} ./calc${EXT} -e -q -C 'print custom("sysinfo", 2);' @echo '=-=-=-= Back to the main Makefile for $@ rule =-=-=-=' @@ -4903,7 +4909,7 @@ uninstall: custom/Makefile -${Q} if [ -f "${T}${LIBDIR}/libcalc${LIB_EXT_VERSION}" ]; then \ ${RM} -f "${T}${LIBDIR}/libcalc${LIB_EXT_VERSION}"; \ if [ -f "${T}${LIBDIR}/libcalc${LIB_EXT_VERSION}" ]; then \ - /bin/echo -n "cannot uninstall " \ + ${ECHON} "cannot uninstall " \ echo "${T}${LIBDIR}/libcalc${LIB_EXT_VERSION}"; \ else \ echo "uninstalled ${T}${LIBDIR}/libcalc${LIB_EXT_VERSION}"; \ @@ -5025,7 +5031,7 @@ calc-symlink: if [ ! -L "${CATDIR}/calc.${CATEXT}" -a \ "${T}${CATDIR}/calc.${CATEXT}" -ef \ "${CATDIR}/calc.${CATEXT}" ]; then \ - /bin/echo -n "ERROR: ${T}${CATDIR}/calc.${CATEXT}" 2>&1; \ + ${ECHON} "ERROR: ${T}${CATDIR}/calc.${CATEXT}" 2>&1; \ echo "is the same as ${CATDIR}/calc.${CATEXT}" 1>&2; \ else \ if [ -e "${CATDIR}/calc.${CATEXT}" ]; then \ diff --git a/cscript/Makefile b/cscript/Makefile index d4a99df..be80769 100644 --- a/cscript/Makefile +++ b/cscript/Makefile @@ -180,6 +180,11 @@ SORT= sort TOUCH= touch TRUE= true +# NOTE: On some shells, echo is a builtin that does +# not understand -n, so we call /bin/echo -n +# directly to get around such shells. +ECHON= /bin/echo -n + # The ${SCRIPT} list is the list of calc shell script files (without the .calc # extension) which will be installed. # @@ -313,7 +318,7 @@ depend: if [ X"$$i" != X"/dev/null" ]; then \ echo "$$i: $$i.calc"; \ echo ' @$${RM} -f $$@'; \ - /bin/echo -n ' @$${SED} -e "1s:^#!/usr/local/src/bin/'; \ + ${ECHON} ' @$${SED} -e "1s:^#!/usr/local/src/bin/'; \ echo 'calc/calc:#!$${BINDIR}/calc:" $$?>$$@'; \ echo ' @$${CHMOD} +x $$@'; \ fi; \