From fc0751ea945b89b01be37da16e889ca35578d50e Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Tue, 14 Nov 2023 04:12:18 -0800 Subject: [PATCH] Fix and improve 2001/anonymous/try.sh It previously would abort if anonymous couldn't be built but this was an error because it will at least run the supplementary program even if the entry or supplementary program cannot be compiled in 32-bit. Get CC, defaulting to cc. --- 2001/anonymous/try.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/2001/anonymous/try.sh b/2001/anonymous/try.sh index fc509fca7..71330cfc5 100755 --- a/2001/anonymous/try.sh +++ b/2001/anonymous/try.sh @@ -1,7 +1,21 @@ #!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 2001/anonymous +# -make clobber alt all >/dev/null 2>&1 +# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it +# this way allows us to have the user specify a different compiler in an easy +# way. +if [[ -z "$CC" ]]; then + CC="cc" +fi +# in this case we won't fail if we can't compile the code because we can still +# run the supplementary program. +make CC="$CC" everything >/dev/null + +# clear screen after compilation so that only the entry is shown +clear TARGET="anonymous.ten" if [[ -f "$TARGET" ]]; then @@ -28,6 +42,7 @@ if [[ -f "$TARGET" ]]; then else echo "cannot compile anonymous.ten.c as 32-bit, sorry." echo "will run 64-bit version directly." + make anonymous.ten.64 sleep 3 echo "$ ./$TARGET.64" ./"$TARGET".64