Use ${ECHON} for when /bin/echo -n is needed

This commit is contained in:
Landon Curt Noll
2021-03-06 22:21:36 -08:00
parent 7eba99ac29
commit 1b5636afed
3 changed files with 18 additions and 6 deletions

View File

@@ -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.

View File

@@ -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 \

View File

@@ -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; \