From ea9e4ce5702ddb7417defb9c79163c0f381e6dae Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Thu, 23 Mar 2023 22:30:13 -0700 Subject: [PATCH] fix .gitignore, Makefile and README.md for 2012/endoh2 --- 2012/Makefile | 323 ++++++++++++++++++++++++++--------- 2012/endoh2/.gitignore | 40 +++++ 2012/endoh2/Makefile | 376 ++++++++++++++++++++++++++++------------- 2012/endoh2/README.md | 90 +++++----- 4 files changed, 588 insertions(+), 241 deletions(-) diff --git a/2012/Makefile b/2012/Makefile index 279365de3..8f5482336 100644 --- a/2012/Makefile +++ b/2012/Makefile @@ -1,43 +1,52 @@ #!/usr/bin/env make # -# 2012 makefile +# 2012 Makefile + +################################################################################ # -# This work by Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis -# is licensed under: +# Regarding individual entries: +# +# IOCCC winning entry code may not work on your system. Even with standards, +# conditions and build environments change, especially when it comes to more +# extreme code such you might find in an IOCCC winner. Moreover, what was +# allowed and liked in one IOCCC contest may no longer be liked/allowed in +# later IOCCC years. +# +# Corrections on winning author and fixing typos in remarks are VERY WELCOME. +# +# GitHub pull requests are welcome: +# +# If you have a patch that might make running an entry work in modern Unix-like +# environments, please create a GitHub pull request for the IOCCC judges to +# consider. +# +# Suggestions and corrections regarding Makefiles, winning author information, +# fixing typos in remarks, and code patches are welcome via opening a GitHub +# issue or better yet, by creating a GitHub pull request for the IOCCC judges +# to consider. To form a GitHub issue or GitHub pull, please visit: +# +# https://github.com/ioccc-src/winner +# +################################################################################ + +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: # # Creative Commons Attribution-ShareAlike 3.0 Unported License. # # See: http://creativecommons.org/licenses/by-sa/3.0/ -################ -# tool locations -################ +############################# +# shell used by this Makefile +############################# # -SHELL= /bin/bash -CP= cp -CPP= cpp -GUNZIP= gunzip -LD= ld -MAKE= make -RM= rm -SED= sed -TAR= tar -TRUE= true +SHELL= bash -# Set X11_LIBDIR to the directory where the X11 library resides +####################### +# common tool locations +####################### # -X11_LIBDIR= /usr/X11R6/lib - -# Set X11_INCLUDEDIR to the directory where the X11 include files reside -# -X11_INCDIR= /usr/X11R6/include - -# ANSI compiler -# -# Set CC to the name of your ANSI compiler. -# -CC= cc +include ../var.mk ############### @@ -47,55 +56,122 @@ CC= cc WINNERS= blakely deckmyn dlowe endoh1 endoh2 grothe hamano \ hou kang konno omoikane tromp vik zeitak +YEAR= 2012 ################### # build all entries ################### # all: + @echo '=-=-= ${YEAR} begin make $@ =-=-=' + @echo @for i in ${WINNERS} ; do \ - echo "(cd $$i && $(MAKE) ENTRY=$$i X11_LIBDIR=${X11_LIBDIR} X11_INCDIR=${X11_INCDIR} $@)"; \ - (cd $$i && $(MAKE) "ENTRY=$$i" "X11_LIBDIR=${X11_LIBDIR}" "X11_INCDIR=${X11_INCDIR}" $@); \ + echo "=-= start ${YEAR}/$$i =-="; \ + echo "(cd $$i && $(MAKE) $@)"; \ + (cd $$i && $(MAKE) $@); \ + echo "=-= end ${YEAR}/$$i =-="; \ + echo; \ done + @echo '=-=-= ${YEAR} complete make $@ =-=-=' + +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto # alternative executable # alt: + @echo '=-=-= ${YEAR} begin make $@ =-=-=' + @echo @for i in ${WINNERS} ; do \ - echo "(cd $$i && $(MAKE) ENTRY=$$i X11_LIBDIR=${X11_LIBDIR} X11_INCDIR=${X11_INCDIR} $@)"; \ - (cd $$i && $(MAKE) "ENTRY=$$i" "X11_LIBDIR=${X11_LIBDIR}" "X11_INCDIR=${X11_INCDIR}" $@); \ + echo "=-= start ${YEAR}/$$i =-="; \ + echo "(cd $$i && $(MAKE) $@)"; \ + (cd $$i && $(MAKE) $@); \ + echo "=-= end ${YEAR}/$$i =-="; \ + echo; \ done + @echo '=-=-= ${YEAR} complete make $@ =-=-=' + +# data files +# +data: + @echo '=-=-= ${YEAR} begin make $@ =-=-=' + @echo + @for i in ${WINNERS} ; do \ + echo "=-= start ${YEAR}/$$i =-="; \ + echo "(cd $$i && $(MAKE) $@)"; \ + (cd $$i && $(MAKE) $@); \ + echo "=-= end ${YEAR}/$$i =-="; \ + echo; \ + done + @echo '=-=-= ${YEAR} complete make $@ =-=-=' + +# both all and alt +# +everything: + @echo '=-=-= ${YEAR} begin make $@ =-=-=' + @echo + @for i in ${WINNERS} ; do \ + echo "=-= start ${YEAR}/$$i =-="; \ + echo "(cd $$i && $(MAKE) $@)"; \ + (cd $$i && $(MAKE) $@); \ + echo "=-= end ${YEAR}/$$i =-="; \ + echo; \ + done + @echo '=-=-= ${YEAR} complete make $@ =-=-=' ############### # utility rules ############### # -everything: all alt - clean: + @echo '=-=-= ${YEAR} begin make $@ =-=-=' + @echo @for i in ${WINNERS} ; do \ - echo "(cd $$i && $(MAKE) ENTRY=$$i $@)"; \ - (cd $$i && $(MAKE) "ENTRY=$$i" $@); \ + echo "=-= start ${YEAR}/$$i =-="; \ + echo "(cd $$i && $(MAKE) $@)"; \ + (cd $$i && $(MAKE) $@); \ + echo "=-= end ${YEAR}/$$i =-="; \ + echo; \ done + @echo '=-=-= ${YEAR} complete make $@ =-=-=' -clobber: clean +clobber: + @echo '=-=-= ${YEAR} begin make $@ =-=-=' + @echo @for i in ${WINNERS} ; do \ - echo "(cd $$i && $(MAKE) ENTRY=$$i $@)"; \ - (cd $$i && $(MAKE) "ENTRY=$$i" $@); \ - done - -nuke: clobber - @for i in ${WINNERS} ; do \ - echo "(cd $$i && $(MAKE) ENTRY=$$i $@)"; \ - (cd $$i && $(MAKE) "ENTRY=$$i" $@); \ + echo "=-= start ${YEAR}/$$i =-="; \ + echo "(cd $$i && $(MAKE) $@)"; \ + (cd $$i && $(MAKE) $@); \ + echo "=-= end ${YEAR}/$$i =-="; \ + echo; \ done + @echo '=-=-= ${YEAR} complete make $@ =-=-=' install: + @echo '=-=-= ${YEAR} begin make $@ =-=-=' + @echo @for i in ${WINNERS} ; do \ - echo "(cd $$i && $(MAKE) ENTRY=$$i $@)"; \ - (cd $$i && $(MAKE) "ENTRY=$$i" $@); \ + echo "=-= start ${YEAR}/$$i =-="; \ + echo "(cd $$i && $(MAKE) $@)"; \ + (cd $$i && $(MAKE) $@); \ + echo "=-= end ${YEAR}/$$i =-="; \ + echo; \ done + @echo '=-=-= ${YEAR} complete make $@ =-=-=' + +indent.c: + @echo '=-=-= ${YEAR} begin make $@ =-=-=' + @echo + @for i in ${WINNERS} ; do \ + echo "=-= start ${YEAR}/$$i =-="; \ + echo "(cd $$i && $(MAKE) $@)"; \ + (cd $$i && $(MAKE) $@); \ + echo "=-= end ${YEAR}/$$i =-="; \ + echo; \ + done + @echo '=-=-= ${YEAR} complete make $@ =-=-=' ################## @@ -103,45 +179,136 @@ install: ################## # love: - @echo 'not war?' + @echo '=-=-= ${YEAR} begin make $@ =-=-=' + @echo + @for i in ${WINNERS} ; do \ + echo "=-= start ${YEAR}/$$i =-="; \ + echo "(cd $$i && $(MAKE) $@)"; \ + (cd $$i && $(MAKE) $@); \ + echo "=-= end ${YEAR}/$$i =-="; \ + echo; \ + done + @echo '=-=-= ${YEAR} complete make $@ =-=-=' haste: - $(MAKE) waste + @echo '=-=-= ${YEAR} begin make $@ =-=-=' + @echo + @for i in ${WINNERS} ; do \ + echo "=-= start ${YEAR}/$$i =-="; \ + echo "(cd $$i && $(MAKE) $@)"; \ + (cd $$i && $(MAKE) $@); \ + echo "=-= end ${YEAR}/$$i =-="; \ + echo; \ + done + @echo '=-=-= ${YEAR} complete make $@ =-=-=' waste: - @echo 'waste' + @echo '=-=-= ${YEAR} begin make $@ =-=-=' + @echo + @for i in ${WINNERS} ; do \ + echo "=-= start ${YEAR}/$$i =-="; \ + echo "(cd $$i && $(MAKE) $@)"; \ + (cd $$i && $(MAKE) $@); \ + echo "=-= end ${YEAR}/$$i =-="; \ + echo; \ + done + @echo '=-=-= ${YEAR} complete make $@ =-=-=' + +maker: + @echo '=-=-= ${YEAR} begin make $@ =-=-=' + @echo + @for i in ${WINNERS} ; do \ + echo "=-= start ${YEAR}/$$i =-="; \ + echo "(cd $$i && $(MAKE) $@)"; \ + (cd $$i && $(MAKE) $@); \ + echo "=-= end ${YEAR}/$$i =-="; \ + echo; \ + done + @echo '=-=-= ${YEAR} complete make $@ =-=-=' easter_egg: - @echo you expected to mis-understand this $${RANDOM} magic - @echo chongo '' "/\\oo/\\" - @echo Readers shall be disallowed from not being unable to partly misunderstand this partocular final echo. - @${TRUE} + @echo '=-=-= ${YEAR} begin make $@ =-=-=' + @echo + @for i in ${WINNERS} ; do \ + echo "=-= start ${YEAR}/$$i =-="; \ + echo "(cd $$i && $(MAKE) $@)"; \ + (cd $$i && $(MAKE) $@); \ + echo "=-= end ${YEAR}/$$i =-="; \ + echo; \ + done + @echo '=-=-= ${YEAR} complete make $@ =-=-=' -# These rules are written in the sytle of "I Am the Walrus" -# and in particular John Lennon's take on deep analysis of art. :-) +sandwich: + @echo '=-=-= ${YEAR} begin make $@ =-=-=' + @echo + @for i in ${WINNERS} ; do \ + echo "=-= start ${YEAR}/$$i =-="; \ + echo "(cd $$i && $(MAKE) $@)"; \ + (cd $$i && $(MAKE) $@); \ + echo "=-= end ${YEAR}/$$i =-="; \ + echo; \ + done + @echo '=-=-= ${YEAR} complete make $@ =-=-=' + + +# The IOCCC resident astronomer states # -# See also the sub-directory Makefiles for non-propaganda. -# -supernova: nuke - @-if [ -r .code_anal ]; then \ - ${RM} -f .code_anal_v3; \ - else \ - echo "You are not expected to understand this"; \ - fi - @${TRUE} +supernova: + @echo '=-=-= ${YEAR} begin make $@ =-=-=' + @echo + @for i in ${WINNERS} ; do \ + echo "=-= start ${YEAR}/$$i =-="; \ + echo "(cd $$i && $(MAKE) $@)"; \ + (cd $$i && $(MAKE) $@); \ + echo "=-= end ${YEAR}/$$i =-="; \ + echo; \ + done + @echo '=-=-= ${YEAR} complete make $@ =-=-=' deep_magic: - @-if [ -r .code_anal ]; then \ - ccode_analysis --deep_magic 1c2c85c7a02c55d1add91967eca491d53c101dc1 --FNV1a_hash 256-bit -R ."; \ - else \ - echo "Understand different"; \ - fi - @${TRUE} + @echo '=-=-= ${YEAR} begin make $@ =-=-=' + @echo + @for i in ${WINNERS} ; do \ + echo "=-= start ${YEAR}/$$i =-="; \ + echo "(cd $$i && $(MAKE) $@)"; \ + (cd $$i && $(MAKE) $@); \ + echo "=-= end ${YEAR}/$$i =-="; \ + echo; \ + done + @echo '=-=-= ${YEAR} complete make $@ =-=-=' -magic: deep_magic - @-if [ -r .code_anal ]; then \ - ccode_analysis --mode 391581 --level 216193 --FNV1a_hash 256-bit -R ."; \ - else \ - echo "These aren't the droids you're looking for Mr. Spock!"; \ - fi - @${TRUE} +magic: + @echo '=-=-= ${YEAR} begin make $@ =-=-=' + @echo + @for i in ${WINNERS} ; do \ + echo "=-= start ${YEAR}/$$i =-="; \ + echo "(cd $$i && $(MAKE) $@)"; \ + (cd $$i && $(MAKE) $@); \ + echo "=-= end ${YEAR}/$$i =-="; \ + echo; \ + done + @echo '=-=-= ${YEAR} complete make $@ =-=-=' + +charon: + @echo '=-=-= ${YEAR} begin make $@ =-=-=' + @echo + @for i in ${WINNERS} ; do \ + echo "=-= start ${YEAR}/$$i =-="; \ + echo "(cd $$i && $(MAKE) $@)"; \ + (cd $$i && $(MAKE) $@); \ + echo "=-= end ${YEAR}/$$i =-="; \ + echo; \ + done + @echo '=-=-= ${YEAR} complete make $@ =-=-=' + +pluto: + @echo '=-=-= ${YEAR} begin make $@ =-=-=' + @echo + @for i in ${WINNERS} ; do \ + echo "=-= start ${YEAR}/$$i =-="; \ + echo "(cd $$i && $(MAKE) $@)"; \ + (cd $$i && $(MAKE) $@); \ + echo "=-= end ${YEAR}/$$i =-="; \ + echo; \ + done + @echo '=-=-= ${YEAR} complete make $@ =-=-=' diff --git a/2012/endoh2/.gitignore b/2012/endoh2/.gitignore index 85f027cf4..f1ba1ed50 100644 --- a/2012/endoh2/.gitignore +++ b/2012/endoh2/.gitignore @@ -1 +1,41 @@ +271 +271.c +2718 +2718.c +27182 +27182.c +271828 +271828.c +2718281 +2718281.c +27182818 +27182818.c +271828182 +271828182.c +2718281828 +2718281828.c +27182818284 +27182818284.c +314 +314.c +3141 +3141.c +31415 +31415.c +314159 +314159.c +3141592 +3141592.c +31415926 +31415926.c +314159265 +314159265.c +3141592653 +3141592653.c +31415926535 +31415926535.c +e +e.c endoh2 +pi +pi.c diff --git a/2012/endoh2/Makefile b/2012/endoh2/Makefile index 18af5f651..dc7ad3cee 100644 --- a/2012/endoh2/Makefile +++ b/2012/endoh2/Makefile @@ -1,96 +1,159 @@ #!/usr/bin/env make # -# 2012 makefile +# IOCCC 2012 winning entry - endoh2 + +################################################################################ # -# This work by Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis -# is licensed under: +# Regarding individual entries: +# +# IOCCC winning entry code may not work on your system. Even with standards, +# conditions and build environments change, especially when it comes to more +# extreme code such you might find in an IOCCC winner. Moreover, what was +# allowed and liked in one IOCCC contest may no longer be liked/allowed in +# later IOCCC years. +# +# Corrections on winning author and fixing typos in remarks are VERY WELCOME. +# +# GitHub pull requests are welcome: +# +# If you have a patch that might make running an entry work in modern Unix-like +# environments, please create a GitHub pull request for the IOCCC judges to +# consider. +# +# Suggestions and corrections regarding Makefiles, winning author information, +# fixing typos in remarks, and code patches are welcome via opening a GitHub +# issue or better yet, by creating a GitHub pull request for the IOCCC judges +# to consider. To form a GitHub issue or GitHub pull, please visit: +# +# https://github.com/ioccc-src/winner +# +################################################################################ + +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: # # Creative Commons Attribution-ShareAlike 3.0 Unported License. # # See: http://creativecommons.org/licenses/by-sa/3.0/ -################ -# tool locations -################ +############################# +# shell used by this Makefile +############################# # SHELL= bash -CP= cp -CPP= cpp -GUNZIP= gunzip -LD= ld -MAKE= make -RM= rm -SED= sed -TAR= tar -TRUE= true + +####################### +# common tool locations +####################### +# +include ../../var.mk # Set X11_LIBDIR to the directory where the X11 library resides # -X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib # Set X11_INCLUDEDIR to the directory where the X11 include files reside # -X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include -# Compiler warnings +# Common C compiler warnings to silence # -#CWARN= -#CWARN= -Wall -W -CWARN= -Wall -W -pedantic +#CSILENCE= +CSILENCE= -Wno-parentheses -Wno-empty-body -# compiler standard +# Common C compiler warning flags +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +# Compiler standard # #CSTD= #CSTD= -ansi -CSTD= -std=c99 +CSTD= -std=gnu11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 # -# Some entries require 64-bitess: +# Some entries require 64-bitness: # ARCH= -m64 # # By default we assume nothing: # ARCH= -# optimization +# Defines that are needed to compile +# +CDEFINE= +#CDEFINE= -DIOCCC + +# Include files that are needed to compile +# +CINCLUDE= +#CINCLUDE= -include stdlib.h +#CINCLUDE= -include stdio.h +#CINCLUDE= -include stdlib.h -include stdio.h +#CINCLUDE= -I ${X11_INCDIR} -I ${X11_INCDIR}/X11 +#CINCLUDE= `${SDL2_CONFIG} --cflags` + +# Optimization # # Most compiles will safely use -O2. Some can use only -O1 or -O. # A few compilers have broken optimizers or this entry make break # under those buggy optimizers and thus you may not want anything. +# Reasonable compilers will allow for -O3. # #OPT= #OPT= -O #OPT= -O1 -OPT= -O2 -#OPT= -O3 +#OPT= -O2 +OPT= -O3 + +# Default flags for ANSI C compilation +# +CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT} # Libraries needed to build # LIBS= +#LIBS= -lm +#LIBS= -L ${X11_LIBDIR} -lX11 +#LIBS= `${SDL2_CONFIG} --libs` -# default flags for ANSI C compilation -# -CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${OPT} ${LIBS} - -# ANSI compiler -# -# Set CC to the name of your ANSI compiler. -# -# Some entries seem to need gcc. If you have gcc, set -# both CC and MAY_NEED_GCC to gcc. -# -# If you do not have gcc, set CC to the name of your ANSI compiler, and -# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just : -# to disable such programs. +# C compiler to use # CC= cc #CC=clang -MAY_NEED_GCC= gcc +#CC=gcc + +# Compiler add-ons or replacements for clang only +# +ifeq ($(CC),clang) +# +CSILENCE+= -Wno-comma -Wno-format-nonliteral -Wno-missing-variable-declarations \ + -Wno-poison-system-directories +# +CWARN+= -Weverything +# +endif + +# Specific add-ons or replacements for gcc only +# +ifeq ($(CC),gcc) +# +#CSILENCE+= +# +#CWARN+= +# +endif ############################## @@ -98,172 +161,193 @@ MAY_NEED_GCC= gcc ############################## # ENTRY= endoh2 -DATA= +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= find-font-table.rb +TARGET= ${PROG} +# +ALT_OBJ= pi.o 314.o 3141.o 31415.o 314159.o 3141592.o \ + 31415926.o 314159265.o 3141592653.o 31415926535.o \ + e.o 271.o 2718.o 27182.o 271828.o 2718281.o \ + 27182818.o 271828182.o 2718281828.o 27182818284.o +ALT_TARGET= pi 314 3141 31415 314159 \ + 3141592 31415926 314159265 3141592653 31415926535 \ + e 271 2718 27182 271828 \ + 2718281 27182818 271828182 2718281828 27182818284 ALT_C= pi.c 314.c 3141.c 31415.c 314159.c 3141592.c \ 31415926.c 314159265.c 3141592653.c 31415926535.c \ e.c 271.c 2718.c 27182.c 271828.c 2718281.c \ 27182818.c 271828182.c 2718281828.c 27182818284.c -ALT_ENTRY= pi 314 3141 31415 314159 \ - 3141592 31415926 314159265 3141592653 31415926535 \ - e 271 2718 27182 271828 \ - 2718281 27182818 271828182 2718281828 27182818284 - -ALT_OBJ= pi.o 314.o 3141.o 31415.o 314159.o 3141592.o \ - 31415926.o 314159265.o 3141592653.o 31415926535.o \ - e.o 271.o 2718.o 27182.o 271828.o 2718281.o \ - 27182818.o 271828182.o 2718281828.o 27182818284.o - -ALT_ENTRY= pi 314 3141 31415 314159 3141592 \ - 31415926 314159265 3141592653 31415926535 \ - e 271 2718 27182 271828 2718281 \ - 27182818 271828182 2718281828 27182818284 - ################# # build the entry ################# # -all: ${ENTRY} ${DATA} +all: data ${TARGET} @${TRUE} -${ENTRY}: ${ENTRY}.c - ${CC} ${CFLAGS} $< -o $@ +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto -pi.c: ${ENTRY} +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +pi.c: ${PROG} + ${RM} -f $@ ./$< > $@ pi: pi.c - ${CC} ${CFLAGS} $< -o $@ + ${CC} ${CFLAGS} $< -o $@ ${LIBS} 314.c: pi + ${RM} -f $@ ./$< > $@ 314: 314.c - ${CC} ${CFLAGS} $< -o $@ + ${CC} ${CFLAGS} $< -o $@ ${LIBS} 3141.c: 314 + ${RM} -f $@ ./$< > $@ 3141: 3141.c - ${CC} ${CFLAGS} $< -o $@ + ${CC} ${CFLAGS} $< -o $@ ${LIBS} 31415.c: 3141 + ${RM} -f $@ ./$< > $@ 31415: 31415.c - ${CC} ${CFLAGS} $< -o $@ + ${CC} ${CFLAGS} $< -o $@ ${LIBS} 314159.c: 31415 + ${RM} -f $@ ./$< > $@ 314159: 314159.c - ${CC} ${CFLAGS} $< -o $@ + ${CC} ${CFLAGS} $< -o $@ ${LIBS} 3141592.c: 314159 + ${RM} -f $@ ./$< > $@ 3141592: 3141592.c - ${CC} ${CFLAGS} $< -o $@ + ${CC} ${CFLAGS} $< -o $@ ${LIBS} 31415926.c: 3141592 + ${RM} -f $@ ./$< > $@ 31415926: 31415926.c - ${CC} ${CFLAGS} $< -o $@ + ${CC} ${CFLAGS} $< -o $@ ${LIBS} 314159265.c: 31415926 + ${RM} -f $@ ./$< > $@ 314159265: 314159265.c - ${CC} ${CFLAGS} $< -o $@ + ${CC} ${CFLAGS} $< -o $@ ${LIBS} 3141592653.c: 314159265 + ${RM} -f $@ ./$< > $@ 3141592653: 3141592653.c - ${CC} ${CFLAGS} $< -o $@ + ${CC} ${CFLAGS} $< -o $@ ${LIBS} 31415926535.c: 3141592653 + ${RM} -f $@ ./$< > $@ 31415926535: 31415926535.c - ${CC} ${CFLAGS} $< -o $@ + ${CC} ${CFLAGS} $< -o $@ ${LIBS} # you get the transcendental idea ... :-) -e.c: ${ENTRY} +e.c: ${PROG} + ${RM} -f $@ ./$< e > $@ e: e.c - ${CC} ${CFLAGS} $< -o $@ + ${CC} ${CFLAGS} $< -o $@ ${LIBS} 271.c: e + ${RM} -f $@ ./$< > $@ 271: 271.c - ${CC} ${CFLAGS} $< -o $@ + ${CC} ${CFLAGS} $< -o $@ ${LIBS} 2718.c: 271 + ${RM} -f $@ ./$< > $@ 2718: 2718.c - ${CC} ${CFLAGS} $< -o $@ + ${CC} ${CFLAGS} $< -o $@ ${LIBS} 27182.c: 2718 + ${RM} -f $@ ./$< > $@ 27182: 27182.c - ${CC} ${CFLAGS} $< -o $@ + ${CC} ${CFLAGS} $< -o $@ ${LIBS} 271828.c: 27182 + ${RM} -f $@ ./$< > $@ 271828: 271828.c - ${CC} ${CFLAGS} $< -o $@ + ${CC} ${CFLAGS} $< -o $@ ${LIBS} 2718281.c: 271828 + ${RM} -f $@ ./$< > $@ 2718281: 2718281.c - ${CC} ${CFLAGS} $< -o $@ + ${CC} ${CFLAGS} $< -o $@ ${LIBS} 27182818.c: 2718281 + ${RM} -f $@ ./$< > $@ 27182818: 27182818.c - ${CC} ${CFLAGS} $< -o $@ + ${CC} ${CFLAGS} $< -o $@ ${LIBS} 271828182.c: 27182818 + ${RM} -f $@ ./$< > $@ 271828182: 271828182.c - ${CC} ${CFLAGS} $< -o $@ + ${CC} ${CFLAGS} $< -o $@ ${LIBS} 2718281828.c: 271828182 + ${RM} -f $@ ./$< > $@ 2718281828: 2718281828.c - ${CC} ${CFLAGS} $< -o $@ + ${CC} ${CFLAGS} $< -o $@ ${LIBS} 27182818284.c: 2718281828 + ${RM} -f $@ ./$< > $@ 27182818284: 27182818284.c - ${CC} ${CFLAGS} $< -o $@ + ${CC} ${CFLAGS} $< -o $@ ${LIBS} 271828182845.c: 27182818284 + ${RM} -f $@ ./$< > $@ 271828182845: 271828182845.c - ${CC} ${CFLAGS} $< -o $@ - -# etc. ... :-) + ${CC} ${CFLAGS} $< -o $@ ${LIBS} # alternative executable # -alt: ${ALT_ENTRY} +alt: data ${ALT_TARGET} @${TRUE} # data files @@ -271,33 +355,52 @@ alt: ${ALT_ENTRY} data: ${DATA} @${TRUE} +# both all and alt +# +everything: all alt + ############### # utility rules ############### # -everything: all alt - clean: - ${RM} -f ${ENTRY}.o ${ALT_OBJ} + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi clobber: clean - ${RM} -f ${ENTRY} ${ALT_ENTRY} ${ALT_C} - -nuke: clobber - @${TRUE} - -dist_clean: nuke - @${TRUE} + ${RM} -f ${TARGET} ${ALT_TARGET} + ${RM} -f ${ALT_C} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi install: - @echo "Surely you're joking Mr. Feynman!" + @echo "Dr. Spock says that is not logical!" @${TRUE} -# backwards compatibility +# you may be able to misunderstand the source by reading indent.c # -build: all - @${TRUE} +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi ################## @@ -313,39 +416,72 @@ haste: @${TRUE} waste: - @echo 'waste' + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' @${TRUE} easter_egg: - @echo you expected to mis-understand this $${RANDOM} magic - @echo chongo '' "/\\oo/\\" - @echo Readers shall be disallowed from not being unable to partly misunderstand this partocular final echo. + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" -# Understand the history of "I Am the Walrus" and -# and in particular John Lennon's remarks on that -# song and you might be confused about these next -# rules in a different way. :-) -# -supernova: nuke - @-if [ -r .code_anal ]; then \ - ${RM} -f .code_anal_v3; \ +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ else \ - echo "You are not expected to understand this"; \ + echo 'What? Make it yourself.'; \ + exit 1; \ fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" @${TRUE} -deep_magic: +deep_magic: supernova @-if [ -r .code_anal ]; then \ - ccode_analysis --deep_magic 1c2c85c7a02c55d1add91967eca491d53c101dc1 --FNV1a_hash 256-bit "${ENTRY}"; \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ else \ - echo "Understand different"; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ fi @${TRUE} magic: deep_magic @-if [ -r .code_anal ]; then \ - ccode_analysis --mode 21701 --level 23209 --FNV1a_hash 256-bit "${ENTRY}"; \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ else \ - echo "These aren't the droids you're looking for Mr. Spock!"; \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ fi @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/2012/endoh2/README.md b/2012/endoh2/README.md index 4a626a8d3..4cc09b2c0 100644 --- a/2012/endoh2/README.md +++ b/2012/endoh2/README.md @@ -1,48 +1,53 @@ # PiE in the sky award -Yusuke Endoh - - + Yusuke Endoh + + +# To build: -## Judges' comments: -### To build: - - make endoh2 +```sh +make +``` ### To run: - ./endoh2 > pi.c - gcc -o pi pi.c - ./pi > 314.c - ... +```sh +./endoh2 > pi.c +gcc -o pi pi.c +./pi > 314.c +``` - ./endoh2 e > e.c - gcc -o e e.c - ./e > 271.c - ... +and: + +```sh +./endoh2 e > e.c +gcc -o e e.c +./e > 271.c +``` ### Try: - make pi - make e - make everything +```sh +make pi +make e +make everything +``` -### Selected Judges Remarks: +## Judges' comments: A pi/e printing quasi-quine in ASCII art with a compressed font in it; what else to wish for in this program? Virtual machine emulation? ## Author's comments: + Yeah, "Again". Sorry. But I don't feel guilty or uncomfortable. This entry is based on 'over-used themes' such as self reproducing program and pi or e computation. I know you're tired of them. - But have you ever seen **all-in-one**? - ### What it is This program generates a new program in the shape of the Greek letter @@ -92,7 +97,6 @@ of ASCII-art with comment padded. These design requirements made my program well-obfuscated willy-nilly. - ### Portability I expect it to work in any major environment and C compiler. @@ -107,41 +111,41 @@ function. In fact, recent compilers with "-std=c99 -Wall -W I've tested with gcc-4.6.3 and clang-3.0 on Linux (Ubuntu 12.04) and gcc-4.5.3 and clang-3.1 on Cygwin. - ### Synopsis - gcc endoh2.c -o endoh2 +```sh +cc endoh2.c -o endoh2 - ./endoh2 > pi.c - cat pi.c +./endoh2 > pi.c +cat pi.c - gcc pi.c -o pi ; ./pi > 314.c ; cat 314.c - gcc 314.c -o 314 ; ./314 > 3141.c ; cat 3141.c - gcc 3141.c -o 3141 ; ./3141 > 31415.c ; cat 31415.c - gcc 31415.c -o 31415 ; ./31415 > 314159.c ; cat 314159.c - gcc 314159.c -o 314159 ; ./314159 > 3141592.c ; cat 3141592.c - etc... +cc pi.c -o pi ; ./pi > 314.c ; cat 314.c +cc 314.c -o 314 ; ./314 > 3141.c ; cat 3141.c +cc 3141.c -o 3141 ; ./3141 > 31415.c ; cat 31415.c +cc 31415.c -o 31415 ; ./31415 > 314159.c ; cat 314159.c +cc 314159.c -o 314159 ; ./314159 > 3141592.c ; cat 3141592.c +etc... - ./endoh2 e > e.c - cat e.c +./endoh2 e > e.c +cat e.c - gcc e.c -o e ; ./e > 271.c ; cat 271.c - gcc 271.c -o 271 ; ./271 > 2718.c ; cat 2718.c - gcc 2718.c -o 2718 ; ./2718 > 27182.c ; cat 27182.c - gcc 27182.c -o 27182 ; ./27182 > 271828.c ; cat 271828.c - gcc 271828.c -o 271828 ; ./271828 > 2718281.c ; cat 2718281.c - etc... +cc e.c -o e ; ./e > 271.c ; cat 271.c +cc 271.c -o 271 ; ./271 > 2718.c ; cat 2718.c +cc 2718.c -o 2718 ; ./2718 > 27182.c ; cat 27182.c +cc 27182.c -o 27182 ; ./27182 > 271828.c ; cat 271828.c +cc 271828.c -o 271828 ; ./271828 > 2718281.c ; cat 2718281.c +etc... +``` You can do `make everything` for the process (with no `cat`). Note: The executable may return a failure (non-zero) exit status unless -std=c99 option is given. --------------------------------------------------------------------------------- -