From dd3c3b7f618817c43c62de8d8493fe2797040f17 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Tue, 14 Nov 2023 02:26:35 -0800 Subject: [PATCH] Improve 1989/jar.2/try.sh Allow CC to be set and used for compilation. --- 1989/jar.2/Makefile | 1 - 1989/jar.2/try.sh | 10 +++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/1989/jar.2/Makefile b/1989/jar.2/Makefile index fcc3c1df2..9605610b6 100644 --- a/1989/jar.2/Makefile +++ b/1989/jar.2/Makefile @@ -132,7 +132,6 @@ all: data ${TARGET} ${PROG}: ${PROG}.c ${CC} ${CFLAGS} $< -o $@ ${LDFLAGS} - @echo @echo NOTE: invalid input will cause this entry to dump core. See README.md for details. # alternative executable diff --git a/1989/jar.2/try.sh b/1989/jar.2/try.sh index 8116615d6..5fd376fc3 100755 --- a/1989/jar.2/try.sh +++ b/1989/jar.2/try.sh @@ -1,8 +1,15 @@ #!/usr/bin/env bash # # demo for 1989/jar.2 - run entry with one or more files +# -make all || exit 1 +# if CC is not specified set to default 'cc'. CC can be a path or no path which +# makes the shell figure it out. +if [[ -z "$CC" ]]; then + CC="cc" +fi + +make CC="$CC" all || exit 1 if [[ "$#" -lt 1 ]]; then FILES="try.txt fib.lisp chocolate_cake.lisp" @@ -12,6 +19,7 @@ fi for f in $FILES; do if [[ -e "$f" && -r "$f" ]]; then + echo "$ ./jar.2 < $f" 1>&2 ./jar.2 < "$f" fi done