Update 1988/westley/try.sh
Allow one to specify CC=foo to compile with a different compiler. If CC is empty it will be set to 'cc'. One can specify a path in which case it'll be that path; otherwise the shell will work it out. Of course if it's not a compiler that's another matter entirely. Also remove check for 'westley' existing already because 'make' will do that via the Makefile. And although not strictly necessary the ints used in the program were changed to floats as they are floats. Updated CSILENCE in Makefile.
This commit is contained in:
1 parent
dd3c3b7f61
commit
e71f9d61f7
4 files changed
+21
-11
No files matched your search
@@ -39,7 +39,7 @@ include ../../var.mk
|
||||
# Common C compiler warnings to silence
|
||||
#
|
||||
CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-return-type \
|
||||
-Wno-strict-prototypes
|
||||
-Wno-strict-prototypes -Wno-implicit-int
|
||||
|
||||
# Common C compiler warning flags
|
||||
#
|
||||
@@ -62,7 +62,7 @@ CDEFINE=
|
||||
|
||||
# Include files that are needed to compile
|
||||
#
|
||||
CINCLUDE=
|
||||
CINCLUDE= -include stdio.h
|
||||
|
||||
# Optimization
|
||||
#
|
||||
|
||||
+15
-8
@@ -1,15 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# try.sh - demonstrate IOCCC winner 1988/westley
|
||||
#
|
||||
|
||||
clear
|
||||
|
||||
if [[ ! -x "westley" ]]; then
|
||||
echo "$ cc westley.c -o westley"
|
||||
cc -std=gnu89 -Wno-error -Wno-implicit-function-declaration -Wno-return-type -O3 westley.c -o westley || exit 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
|
||||
|
||||
echo "$ cat westley.c"
|
||||
make CC="$CC" all >/dev/null || exit 1
|
||||
|
||||
# clear screen after compilation so that only the entry is shown
|
||||
clear
|
||||
|
||||
echo "$ cat westley.c" 1>&2
|
||||
cat westley.c
|
||||
sleep 1
|
||||
|
||||
echo "$ ./westley"
|
||||
echo "$ ./westley" 1>&2
|
||||
./westley
|
||||
@@ -1,5 +1,5 @@
|
||||
#define _ F-->00||-F-OO--;
|
||||
int F=00,OO=00;main(){F_OO();printf("%1.3f\n",4.*-F/OO/OO);}F_OO()
|
||||
float F=00,OO=00;main(){F_OO();printf("%1.3f\n",4.*-F/OO/OO);}F_OO()
|
||||
{
|
||||
_-_-_-_
|
||||
_-_-_-_-_-_-_-_-_
|
||||
|
||||
Reference in new issue
Block a user