From 4360a1f6955de64f5a15658b6822a7eedca78f92 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Sun, 17 Dec 2023 13:47:45 -0800 Subject: [PATCH] add instructions for how to compile 1988/spinellis Because of the nature of 1988/spinellis, we cannot compile the entry directory. While there may be workarounds to automatically compile code that tries to read source from standard input, such workarounds are likely not portable or at best uglify the process. NOTE: This entry should NOT use a `try.sh` nor `try.alt.sh` approach. Instead the user needs to be directed to perform the actions. We do this by echoing instructions from the Makefile. We remove the entry line from `input.txt` and `input2.txt` to make the echoed instructions in improve the clarity of the echoed instructions. We turn off all warnings, due to the fact that whatever the user might enter might have minor issues. As such, and to be similar, we turn off all warnings to the compiled commands just in case compiler writers or ANSI C does something silly in the future. ;-) We clean up `make clean`, `make clobber` as well as updating and sorting `.gitignore`. --- 1988/spinellis/.gitignore | 1 + 1988/spinellis/Makefile | 67 ++++++++++++++++++++++++++-------- 1988/spinellis/input.txt | 1 - 1988/spinellis/input2.txt | 1 - 1988/spinellis/spinellis.alt.c | 2 +- 5 files changed, 53 insertions(+), 19 deletions(-) diff --git a/1988/spinellis/.gitignore b/1988/spinellis/.gitignore index 6a6607176..0e2971a8e 100644 --- a/1988/spinellis/.gitignore +++ b/1988/spinellis/.gitignore @@ -6,6 +6,7 @@ indent.c indent.o prog.c prog.orig +runme spinellis spinellis.alt spinellis.orig diff --git a/1988/spinellis/Makefile b/1988/spinellis/Makefile index 36fe6c3f0..365720d09 100644 --- a/1988/spinellis/Makefile +++ b/1988/spinellis/Makefile @@ -38,11 +38,11 @@ include ../../var.mk # Common C compiler warnings to silence # -CSILENCE= -Wno-empty-translation-unit +CSILENCE= -Wno-everything # Common C compiler warning flags # -CWARN= -Wall -Wextra -pedantic ${CSILENCE} +CWARN= ${CSILENCE} # Compiler standard # @@ -83,9 +83,9 @@ CC= cc # ifeq "$(findstring $(CLANG),${CC})" "$(CLANG)" # -CSILENCE+= -Wno-empty-translation-unit -Wno-poison-system-directories +CSILENCE+= # -CWARN+= -Weverything +CWARN+= # endif @@ -93,9 +93,9 @@ endif # ifeq "$(findstring $(GCC),${CC})" "$(GCC)" # -#CSILENCE+= +CSILENCE+= -w # -#CWARN+= +CWARN+= # endif @@ -128,11 +128,31 @@ all: data ${TARGET} sandwich supernova deep_magic magic charon pluto ${PROG}: ${PROG}.c input.txt - @echo "NOTE: this entry will not compile with some compilers like clang." - @echo "NOTE: use make alt for clang." - @echo Now run the following command: - ${RM} -f $@ - @echo ${CC} ${CFLAGS} $< -o $@ ${LDFLAGS} '<' input.txt '&&' ./${PROG} + @${RM} -f $@ + @echo + @echo "Hello, world! To compile this IOCCC winner, we need you to take change." + @echo + @echo "IMPORTANT NOTE:" + @echo + @echo " This entry is likely to NOT compile with some compilers like clang, NOR will it likely" + @echo " to compile under macOS. For those situations, try this instead:" + @echo + @echo " make clobber alt" + @echo + @echo "For non-macOS hosts with a true gcc compiler, manually run the following command:" + @echo + @echo ${GCC} ${CFLAGS} ${PROG}.c -o $@ ${LDFLAGS} + @echo + @echo "Next copy and paste (on a non-macOS host) the folowwing as input to the above command:" + @echo + @${CAT} input.txt + @echo + @echo "After pasing the above, end input by providing an EOF (usually control-D)." + @echo + @echo "Finally run the program you have just compiled:" + @echo + @echo "./$@" + @echo # alternative executable # @@ -140,9 +160,25 @@ alt: data ${ALT_TARGET} @${TRUE} ${PROG}.alt: ${PROG}.alt.c input.txt - ${CC} ${CFLAGS} -Wno-implicit-function-declaration $< -o $@ ${LDFLAGS} - @echo Now run the following command: - @echo ./${PROG}.alt '<' input.txt '&&' ./${PROG}.alt + @${RM} -f $@ runme + ${CC} ${CFLAGS} ${PROG}.alt.c -o $@ ${LDFLAGS} + @echo + @echo "Hello, world! To compile this IOCCC winner, we need you to take change." + @echo + @echo "Run the following command:" + @echo + @echo "./$@" + @echo + @echo "Next copy and paste the folowwing as input to the above command:" + @echo + @${CAT} input.txt + @echo + @echo "After pasing the above, end input by providing an EOF (usually control-D)." + @echo + @echo "Finally run the this progrqm:" + @echo + @echo "./runme" + @echo # data files # @@ -202,7 +238,6 @@ diff_alt_orig: # clean: ${RM} -f ${OBJ} ${ALT_OBJ} - ${RM} -f prog.c prog.o @-if [ -f indent.c ]; then \ echo ${RM} -f indent.c; \ ${RM} -f indent.c; \ @@ -215,7 +250,7 @@ clobber: clean ${RM} -f sandwich; \ echo 'ate sandwich'; \ fi - ${RM} -f prog + ${RM} -f runme install: @echo "Dr. Spock says that is not logical!" diff --git a/1988/spinellis/input.txt b/1988/spinellis/input.txt index 650dc9b5f..f7f67b4b0 100644 --- a/1988/spinellis/input.txt +++ b/1988/spinellis/input.txt @@ -1,5 +1,4 @@ #include - int main(void) { diff --git a/1988/spinellis/input2.txt b/1988/spinellis/input2.txt index 8691ddffb..f196a06a8 100644 --- a/1988/spinellis/input2.txt +++ b/1988/spinellis/input2.txt @@ -1,5 +1,4 @@ #include - int main(void) { diff --git a/1988/spinellis/spinellis.alt.c b/1988/spinellis/spinellis.alt.c index 79f6e7633..6103c36bc 100644 --- a/1988/spinellis/spinellis.alt.c +++ b/1988/spinellis/spinellis.alt.c @@ -1 +1 @@ -int main(void){system("rm -f spinellis.alt; cc -x c - -o spinellis.alt");return 0;} +int main(void){system("cc -x c -Wno-everything - -o runme");return 0;}