Improve 1989/jar.2/try.sh

Allow CC to be set and used for compilation.
This commit is contained in:
Cody Boone Ferguson committed 2023-11-14 02:26:35 -08:00
1 parent d2e5aebd73
commit dd3c3b7f61
2 files changed
+9 -2

No files matched your search

-1
View File
@@ -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
+9 -1
View File
@@ -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