From 48e9ffea8f1a6936ce7efe530d54f32ea45bea27 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Tue, 14 Nov 2023 03:48:48 -0800 Subject: [PATCH] Improve 1996/august/try.sh Get CC defaulting to cc. --- 1996/august/try.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/1996/august/try.sh b/1996/august/try.sh index 16a76c35b..ca8898933 100755 --- a/1996/august/try.sh +++ b/1996/august/try.sh @@ -1,6 +1,20 @@ #!/usr/bin/env bash +# +# try.sh - show IOCCC winner 1996/august +# + +# 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 + +make CC="$CC" all >/dev/null || exit 1 + +# clear screen after compilation so that only the entry is shown +clear -make clobber all set -x cat august.c test.oc | ./august > test.oo ./august < test.oo @@ -14,7 +28,12 @@ cat parse.oo fac.oc | ./august | ./august rm august.oc make august.oc + +# this next step is vital for some compilers! Not having it will make the +# compiler create code that enters an infinite loop. This is known to happen in +# macOS as one example. sed -i'' '/^#/d' august.oc + cat august.c august.oc | ./august > august.oo cat august.oo test.oo | ./august cat august.oo august.oo fac.oo | ./august