From 67fcabd64074ecfebac8706ae974bbecb7b96ff2 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Sun, 26 Feb 2023 18:30:30 -0800 Subject: [PATCH] fix 1994 Makefiles --- 1994/Makefile | 2 +- 1994/dodsond1/Makefile | 717 ++++++++++++++++++++++++++++++-------- 1994/dodsond1/README.md | 18 +- 1994/dodsond2/Makefile | 716 ++++++++++++++++++++++++++++++-------- 1994/dodsond2/README.md | 16 +- 1994/horton/Makefile | 725 +++++++++++++++++++++++++++++++-------- 1994/horton/README.md | 16 +- 1994/imc/Makefile | 716 ++++++++++++++++++++++++++++++-------- 1994/imc/README.md | 13 +- 1994/ldb/Makefile | 714 ++++++++++++++++++++++++++++++-------- 1994/ldb/README.md | 14 +- 1994/schnitzi/Makefile | 715 ++++++++++++++++++++++++++++++-------- 1994/schnitzi/README.md | 15 +- 1994/shapiro/.gitignore | 2 + 1994/shapiro/Makefile | 723 ++++++++++++++++++++++++++++++-------- 1994/shapiro/README.md | 14 +- 1994/smr/Makefile | 716 ++++++++++++++++++++++++++++++-------- 1994/smr/README.md | 14 +- 1994/tvr/.gitignore | 1 + 1994/tvr/Makefile | 722 ++++++++++++++++++++++++++++++-------- 1994/tvr/README.md | 15 +- 1994/tvr/tvr.alt.c | 3 +- 1994/tvr/tvr.c | 4 +- 1994/weisberg/.gitignore | 1 + 1994/weisberg/Makefile | 724 ++++++++++++++++++++++++++++++-------- 1994/weisberg/README.md | 14 +- 1994/westley/Makefile | 714 ++++++++++++++++++++++++++++++-------- 1994/westley/README.md | 14 +- 28 files changed, 6475 insertions(+), 1603 deletions(-) diff --git a/1994/Makefile b/1994/Makefile index 9b61f398f..8ec81b66b 100644 --- a/1994/Makefile +++ b/1994/Makefile @@ -50,7 +50,7 @@ # tool locations ################ # -SHELL= /bin/bash +SHELL= bash MAKE= make diff --git a/1994/dodsond1/Makefile b/1994/dodsond1/Makefile index 964287422..7e4b03f42 100644 --- a/1994/dodsond1/Makefile +++ b/1994/dodsond1/Makefile @@ -1,157 +1,596 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1994 makefile +# IOCCC 1994 winning entry - dodsond1 + +################################################################################ # -# Copyright (c) 1994, Landon Curt Noll & Larry Bassel. -# All Rights Reserved. Permission for personal, educational or non-profit -# use is granted provided this this copyright and notice are included in its -# entirety and remains unaltered. All other uses must receive prior permission -# from Landon Curt Noll and Larry Bassel. - - -SHELL=/bin/sh -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true - -# flags for ANSI compiles +# An Historical Makefile NOTE: # -# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode, -# others such as gcc may want -ansi, others may want nothing -# at all. Adjust the CFLAGS line as needed. +# The orig.Makefile, if it exits, is the original Makefile before this IOCCC +# year directory was reworked so that entries are in separate directories. +# This also applies to any orig.ansi.mk and orig.common.mk files. # -# NOTE: Some compilers cannot optimize, or optimize some entries -# entries incorrectly. You might want need to turn on -O -# to see if your compiler can handle them. +# Several Makefiles were modified / formed in 2022, and as such it may have +# elements that are not historically compatible with way entries were built. +# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile. # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= - -# ANSI compiler +# Regarding individual entries: # -# Set CC to the name of your ANSI compiler. -#CC=cc -CC=gcc - -# winners that compile under ANSI C +# 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. # -WINNERS= dodsond1 dodsond2 horton imc ldb schnitzi shapiro smr tvr weisberg \ - westley -ALT_NAMES= dodsond2.orig shapiro.alt horton.alt gtface weisberg.alt tvr.alt - -all: $(WINNERS) $(ALT_NAMES) - -westley: westley.c - ${CC} ${CFLAGS} westley.c -DO -o westley - -weisberg: weisberg.c - ${CC} ${CFLAGS} -Dc='n*n>x?p:((m=*(b+1)),N))' \ - -De='(2<<6*sizeof(int))' \ - -Do='(8<<5*sizeof(int))' \ - -DN='((b=t+1),x+=2,x>e?exit():o' \ - -Dp='(a-t shapiro_t2.c - -shapiro_t1: shapiro.c - ${CC} ${CFLAGS} shapiro.c -o shapiro_t1 - -shapiro.alt: shapiro.alt.c - ${CC} ${CFLAGS} shapiro.alt.c -o shapiro.alt - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -horton: horton.c - ${CC} ${CFLAGS} horton.c -o horton - -# Here are some programs related to the horton entry. See horton.hint -# for details. +# 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. # -horton.alt: horton.alt.c - ${CC} ${CFLAGS} horton.alt.c -o horton.alt -gtface: gtface.c - ${CC} ${CFLAGS} gtface.c -o gtface - -ldb: ldb.c - ${CC} ${CFLAGS} ldb.c -o ldb - -imc: imc.c - ${CC} ${CFLAGS} imc.c -o imc - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 - -# NOTE: this is the original (gziped) file that won +# 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: # -dodsond2.orig: dodsond2.gz - @${RM} -f dodsond2.orig.c - -${GUNZIP} < dodsond2.gz > dodsond2.orig.c - -@if [ -s dodsond2.orig.c ]; then \ - echo "${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig"; \ - ${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig; \ - else \ - ${RM} -f dodsond2.orig.c; \ - echo "sorry, we could not gunzip dodsond2.gz"; \ - fi +# https://github.com/ioccc-src/winner +# +################################################################################ -dodsond2.gz: dodsond2.gz.uu - @${RM} -f dodsond2.gz - ${UUDECODE} dodsond2.gz.uu +# 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/ -dodsond1: dodsond1.c - ${CC} ${CFLAGS} dodsond1.c -o dodsond1 -clean: - $(RM) -f *.o a.out core +############################# +# shell used by this Makefile +############################# +# +SHELL= bash -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - ${RM} -f dodsond2.orig.c dodsond2.gz shapiro_t2.c shapiro_t1 +####################### +# common tool locations +####################### +# +A2P= a2p +AR= ar +ASA= asa +AT= at +ATQ= atq +ATRM= atrm +AWK= awk +BANNER= banner +BASE64= base64 +BASENAME= basename +BATCH= batch +BC= bc +BINHEX= binhex +BISON= bison +BUNZIP2= bunzip2 +BZCAT= bzcat +BZCMP= bzcmp +BZDIFF= bzdiff +BZEGREP= bzegrep +BZFGREP= bzfgrep +BZGREP= bzgrep +BZIP2= bzip2 +BZLESS= bzless +BZMORE= bzmore +C2PH= c2ph +C89= c89 +C99= c99 +CAL= cal +CALC= calc +CAT= cat +CD= cd +CHFLAGS= chflags +CHGRP= chgrp +CHMOD= chmod +CKSUM= cksum +CLANG= clang +CLANG_PLUSPLUS= clang++ +CLEAR= clear +CMP= cmp +COL= col +COLLDEF= colldef +COLRM= colrm +COLUMN= column +COMPRESS= compress +CP= cp +CPIO= cpio +CPP= cpp +CRC32= crc32 +CSH= csh +CSPLIT= csplit +CURL= curl +CUT= cut +C_PLUSPLUS= c++ +C_PLUSPLUS_FILT= c++filt +DATE= date +DC= dc +DD= dd +DF= df +DIFF3= diff3 +DIFF= diff +DIG= dig +DIRNAME= dirname +ED= ed +EGREP= egrep +ENV= env +EQN= eqn +ETAGS= etags +EXPECT= expect +EXPR= expr +FALSE= false +FGREP= fgrep +FILE= file +FIND2PERL= find2perl +FIND= find +FLEX= flex +FLEX_PLUSPLUS= flex++ +FMT= fmt +FOLD= fold +FS_USAGE= fs_usage +FUNZIP= funzip +FUSER= fuser +GCC= gcc +GDIFFMK= gdiffmk +GENCAT= gencat +GENSTRINGS= genstrings +GETOPT= getopt +GETOPTS= getopts +GINDENT= gindent +GNUMAKE= gnumake +GREP= grep +GROFF= groff +GROFFER= groffer +GROG= grog +GROPS= grops +GROTTY= grotty +GUNZIP= gunzip +GVIM= gvim +GZCAT= gzcat +GZEXE= gzexe +GZIP_PROG= gzip +G_PLUSPLUS= g++ +H2PH= h2ph +H2XS= h2xs +HASH= hash +HEAD= head +HOSTNAME_PROG= hostname +ICONV= iconv +ID= id +INDENT= indent +INFO= info +JOT= jot +KILL= kill +KSH= ksh +LAST= last +LD= ld +LESSECHO= lessecho +LEX= len +LINK= link +LN= ln +LS= ls +M4= m4 +MAKE= make +MAN= man +MKDIR= mkdir +MKFIFO= mkfifo +MKTEMP= mktemp +MV= mv +NANO= nano +NASM= nasm +NEQN= neqn +NICE= nice +NL= nl +NM= nm +NOHUP= nohup +NROFF= nroff +NSLOOKUP= nslookup +OD= od +OPENSSL= openssl +PASTE= paste +PATCH= patch +PATHCHK= pathchk +PAX= pax +PERL= perl +PICO= pico +PR= pr +PRINTENV= printenv +PS= ps +PTAR= ptar +PTARDIFF= ptardiff +PTARGREP= ptargrep +PWD= pwd +PYDOC= pydoc +PYTHON= python +PYTHONW= pythonw +READLINK= readlink +RENICE= renice +RESET= reset +REV= rev +RI= ri +RM= rm +RMDIR= rmdir +RSYNC= rsync +RUBY= ruby +RVIM= rvim +SAY= say +SCP= scp +SCREEN= screen +SCRIPT= script +SDIFF= sdiff +SED= sed +SEQ= seq +SFTP= sftp +SH= sh +SHA1= sha1 +SHA= sha +SHAR= shar +SHASUM5_18= shasum5.18 +SHASUM= shasum +SIZE= size +SLEEP= sleep +SORT= sort +SSH= ssh +STAT= stat +STRIP= strip +STTY= stty +SUM= sum +SYNC= sync +TABS= tabs +TAIL= tail +TAR= tar +TEE= tee +TEST= test +TFTP= tftp +TIDY= tidy +TIME= time +TOP= top +TOUCH= touch +TPUT= tout +TPUT= tput +TR= tr +TROFF= troff +TRUE= true +TSET= tset +TSORT= tsort +UL= ul +UNAME= uname +UNCOMPRESS= uncompress +UNEXPAND= unexpand +UNIFDEF= unifdef +UNIFDEFALL= unifdefall +UNIQ= uniq +UNITS= units +UNLINK= unlink +UNZIP= unzip +UNZIPSFX= unzipsfx +UPTIME= uptime +UUDECODE= uudecode +UUENCODE= uuencode +UUIDGEN= uuidgen +VI= vi +VIEW= view +VIM= vim +VIMDIFF= vimdiff +W= w +WAIT4PATH= wait4path +WAIT= wait +WC= wc +WGET= wget +WHAT= what +WHATIS= whatis +WHICH= which +WHO= who +WHOAMI= whoami +WHOIS= whois +WRTIE= write +XAR= xar +XARGS= xargs +XATTR= xattr +XXD= xxd +YACC= yacc +YES= yes +ZCAT= zcat +ZCMP= zcmp +ZDIFF= zdiff +ZEGREP= zegrep +ZFGREP= zfgrep +ZFORCE= zforce +ZGREP= zgrep +ZIP= zip +ZIPCLOAK= zipcloak +ZIPGREP= zipgrep +ZIPINFO= zipinfo +ZIPNOTE= zipnote +ZIPSPLIT= zipsplit +ZLESS= zless +ZMORE= zmore +ZNEW= znew +ZPRINT= zprint +ZSH= zsh -nuke: clobber +# Set X11_LIBDIR to the directory where the X11 library resides +# +#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/X11/include +X11_INCDIR= /opt/X11/include + +# Common C compiler warnings to silence +# +#CSILENCE= +CSILENCE= -Wno-empty-body -Wno-error -Wno-implicit-function-declaration \ + -Wno-missing-braces -Wno-return-type + +# 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=gnu90 + +# Compiler bit architecture +# +# Some entries require 32-bitness: +# ARCH= -m32 +# +# Some entries require 64-bitness: +# ARCH= -m64 +# +# By default we assume nothing: +# +ARCH= + +# 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} +#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 + +# 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 + +# 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= -L ${HOMEBREW_PREFIX}/lib -lSDL + +# C compiler to use +# +CC= cc +#CC=clang +#CC=gcc + +# Compiler add-ons or replacements for clang only +# +ifeq ($(CC),clang) +# +CSILENCE+= -Wno-conditional-uninitialized -Wno-missing-prototypes \ + -Wno-missing-variable-declarations -Wno-poison-system-directories \ + -Wno-strict-prototypes +# +CWARN+= -Weverything +# +endif + +# Specific add-ons or replacements for gcc only +# +ifeq ($(CC),gcc) +# +#CSILENCE+= +# +#CWARN+= +# +endif + + +############################## +# Special flags for this entry +############################## +# +ENTRY= dodsond1 +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= + + +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +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 + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + 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: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + 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 --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + 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/1994/dodsond1/README.md b/1994/dodsond1/README.md index 3eccb306e..386e6b965 100644 --- a/1994/dodsond1/README.md +++ b/1994/dodsond1/README.md @@ -1,4 +1,4 @@ -Best Game: +# Best Game: Don Dodson AG Communication Systems @@ -6,21 +6,23 @@ Best Game: Phoenix, AZ 85023 USA +## To build: -Judges' comments: + make all - To use: - make dodsond1 - dodsond1 +### To run + + ./dodsond1 - At the prompt, try entering E3. + NOTE: At the prompt, try entering E3. + +## Judges' comments The program plays the game that the layout of the source implies. The source, on the other hand, implies a language along the lines of Lisp. :-) - -Selected notes from the author: +## Author's comments For each turn, the board is displayed and the player is prompted for a move. Enter your move as an upper-case character followed by a number. diff --git a/1994/dodsond2/Makefile b/1994/dodsond2/Makefile index 964287422..3c655cff4 100644 --- a/1994/dodsond2/Makefile +++ b/1994/dodsond2/Makefile @@ -1,157 +1,595 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1994 makefile +# IOCCC 1994 winning entry - dodsond2 + +################################################################################ # -# Copyright (c) 1994, Landon Curt Noll & Larry Bassel. -# All Rights Reserved. Permission for personal, educational or non-profit -# use is granted provided this this copyright and notice are included in its -# entirety and remains unaltered. All other uses must receive prior permission -# from Landon Curt Noll and Larry Bassel. - - -SHELL=/bin/sh -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true - -# flags for ANSI compiles +# An Historical Makefile NOTE: # -# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode, -# others such as gcc may want -ansi, others may want nothing -# at all. Adjust the CFLAGS line as needed. +# The orig.Makefile, if it exits, is the original Makefile before this IOCCC +# year directory was reworked so that entries are in separate directories. +# This also applies to any orig.ansi.mk and orig.common.mk files. # -# NOTE: Some compilers cannot optimize, or optimize some entries -# entries incorrectly. You might want need to turn on -O -# to see if your compiler can handle them. +# Several Makefiles were modified / formed in 2022, and as such it may have +# elements that are not historically compatible with way entries were built. +# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile. # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= - -# ANSI compiler +# Regarding individual entries: # -# Set CC to the name of your ANSI compiler. -#CC=cc -CC=gcc - -# winners that compile under ANSI C +# 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. # -WINNERS= dodsond1 dodsond2 horton imc ldb schnitzi shapiro smr tvr weisberg \ - westley -ALT_NAMES= dodsond2.orig shapiro.alt horton.alt gtface weisberg.alt tvr.alt - -all: $(WINNERS) $(ALT_NAMES) - -westley: westley.c - ${CC} ${CFLAGS} westley.c -DO -o westley - -weisberg: weisberg.c - ${CC} ${CFLAGS} -Dc='n*n>x?p:((m=*(b+1)),N))' \ - -De='(2<<6*sizeof(int))' \ - -Do='(8<<5*sizeof(int))' \ - -DN='((b=t+1),x+=2,x>e?exit():o' \ - -Dp='(a-t shapiro_t2.c - -shapiro_t1: shapiro.c - ${CC} ${CFLAGS} shapiro.c -o shapiro_t1 - -shapiro.alt: shapiro.alt.c - ${CC} ${CFLAGS} shapiro.alt.c -o shapiro.alt - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -horton: horton.c - ${CC} ${CFLAGS} horton.c -o horton - -# Here are some programs related to the horton entry. See horton.hint -# for details. +# 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. # -horton.alt: horton.alt.c - ${CC} ${CFLAGS} horton.alt.c -o horton.alt -gtface: gtface.c - ${CC} ${CFLAGS} gtface.c -o gtface - -ldb: ldb.c - ${CC} ${CFLAGS} ldb.c -o ldb - -imc: imc.c - ${CC} ${CFLAGS} imc.c -o imc - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 - -# NOTE: this is the original (gziped) file that won +# 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: # -dodsond2.orig: dodsond2.gz - @${RM} -f dodsond2.orig.c - -${GUNZIP} < dodsond2.gz > dodsond2.orig.c - -@if [ -s dodsond2.orig.c ]; then \ - echo "${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig"; \ - ${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig; \ - else \ - ${RM} -f dodsond2.orig.c; \ - echo "sorry, we could not gunzip dodsond2.gz"; \ - fi +# https://github.com/ioccc-src/winner +# +################################################################################ -dodsond2.gz: dodsond2.gz.uu - @${RM} -f dodsond2.gz - ${UUDECODE} dodsond2.gz.uu +# 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/ -dodsond1: dodsond1.c - ${CC} ${CFLAGS} dodsond1.c -o dodsond1 -clean: - $(RM) -f *.o a.out core +############################# +# shell used by this Makefile +############################# +# +SHELL= bash -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - ${RM} -f dodsond2.orig.c dodsond2.gz shapiro_t2.c shapiro_t1 +####################### +# common tool locations +####################### +# +A2P= a2p +AR= ar +ASA= asa +AT= at +ATQ= atq +ATRM= atrm +AWK= awk +BANNER= banner +BASE64= base64 +BASENAME= basename +BATCH= batch +BC= bc +BINHEX= binhex +BISON= bison +BUNZIP2= bunzip2 +BZCAT= bzcat +BZCMP= bzcmp +BZDIFF= bzdiff +BZEGREP= bzegrep +BZFGREP= bzfgrep +BZGREP= bzgrep +BZIP2= bzip2 +BZLESS= bzless +BZMORE= bzmore +C2PH= c2ph +C89= c89 +C99= c99 +CAL= cal +CALC= calc +CAT= cat +CD= cd +CHFLAGS= chflags +CHGRP= chgrp +CHMOD= chmod +CKSUM= cksum +CLANG= clang +CLANG_PLUSPLUS= clang++ +CLEAR= clear +CMP= cmp +COL= col +COLLDEF= colldef +COLRM= colrm +COLUMN= column +COMPRESS= compress +CP= cp +CPIO= cpio +CPP= cpp +CRC32= crc32 +CSH= csh +CSPLIT= csplit +CURL= curl +CUT= cut +C_PLUSPLUS= c++ +C_PLUSPLUS_FILT= c++filt +DATE= date +DC= dc +DD= dd +DF= df +DIFF3= diff3 +DIFF= diff +DIG= dig +DIRNAME= dirname +ED= ed +EGREP= egrep +ENV= env +EQN= eqn +ETAGS= etags +EXPECT= expect +EXPR= expr +FALSE= false +FGREP= fgrep +FILE= file +FIND2PERL= find2perl +FIND= find +FLEX= flex +FLEX_PLUSPLUS= flex++ +FMT= fmt +FOLD= fold +FS_USAGE= fs_usage +FUNZIP= funzip +FUSER= fuser +GCC= gcc +GDIFFMK= gdiffmk +GENCAT= gencat +GENSTRINGS= genstrings +GETOPT= getopt +GETOPTS= getopts +GINDENT= gindent +GNUMAKE= gnumake +GREP= grep +GROFF= groff +GROFFER= groffer +GROG= grog +GROPS= grops +GROTTY= grotty +GUNZIP= gunzip +GVIM= gvim +GZCAT= gzcat +GZEXE= gzexe +GZIP_PROG= gzip +G_PLUSPLUS= g++ +H2PH= h2ph +H2XS= h2xs +HASH= hash +HEAD= head +HOSTNAME_PROG= hostname +ICONV= iconv +ID= id +INDENT= indent +INFO= info +JOT= jot +KILL= kill +KSH= ksh +LAST= last +LD= ld +LESSECHO= lessecho +LEX= len +LINK= link +LN= ln +LS= ls +M4= m4 +MAKE= make +MAN= man +MKDIR= mkdir +MKFIFO= mkfifo +MKTEMP= mktemp +MV= mv +NANO= nano +NASM= nasm +NEQN= neqn +NICE= nice +NL= nl +NM= nm +NOHUP= nohup +NROFF= nroff +NSLOOKUP= nslookup +OD= od +OPENSSL= openssl +PASTE= paste +PATCH= patch +PATHCHK= pathchk +PAX= pax +PERL= perl +PICO= pico +PR= pr +PRINTENV= printenv +PS= ps +PTAR= ptar +PTARDIFF= ptardiff +PTARGREP= ptargrep +PWD= pwd +PYDOC= pydoc +PYTHON= python +PYTHONW= pythonw +READLINK= readlink +RENICE= renice +RESET= reset +REV= rev +RI= ri +RM= rm +RMDIR= rmdir +RSYNC= rsync +RUBY= ruby +RVIM= rvim +SAY= say +SCP= scp +SCREEN= screen +SCRIPT= script +SDIFF= sdiff +SED= sed +SEQ= seq +SFTP= sftp +SH= sh +SHA1= sha1 +SHA= sha +SHAR= shar +SHASUM5_18= shasum5.18 +SHASUM= shasum +SIZE= size +SLEEP= sleep +SORT= sort +SSH= ssh +STAT= stat +STRIP= strip +STTY= stty +SUM= sum +SYNC= sync +TABS= tabs +TAIL= tail +TAR= tar +TEE= tee +TEST= test +TFTP= tftp +TIDY= tidy +TIME= time +TOP= top +TOUCH= touch +TPUT= tout +TPUT= tput +TR= tr +TROFF= troff +TRUE= true +TSET= tset +TSORT= tsort +UL= ul +UNAME= uname +UNCOMPRESS= uncompress +UNEXPAND= unexpand +UNIFDEF= unifdef +UNIFDEFALL= unifdefall +UNIQ= uniq +UNITS= units +UNLINK= unlink +UNZIP= unzip +UNZIPSFX= unzipsfx +UPTIME= uptime +UUDECODE= uudecode +UUENCODE= uuencode +UUIDGEN= uuidgen +VI= vi +VIEW= view +VIM= vim +VIMDIFF= vimdiff +W= w +WAIT4PATH= wait4path +WAIT= wait +WC= wc +WGET= wget +WHAT= what +WHATIS= whatis +WHICH= which +WHO= who +WHOAMI= whoami +WHOIS= whois +WRTIE= write +XAR= xar +XARGS= xargs +XATTR= xattr +XXD= xxd +YACC= yacc +YES= yes +ZCAT= zcat +ZCMP= zcmp +ZDIFF= zdiff +ZEGREP= zegrep +ZFGREP= zfgrep +ZFORCE= zforce +ZGREP= zgrep +ZIP= zip +ZIPCLOAK= zipcloak +ZIPGREP= zipgrep +ZIPINFO= zipinfo +ZIPNOTE= zipnote +ZIPSPLIT= zipsplit +ZLESS= zless +ZMORE= zmore +ZNEW= znew +ZPRINT= zprint +ZSH= zsh -nuke: clobber +# Set X11_LIBDIR to the directory where the X11 library resides +# +#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/X11/include +X11_INCDIR= /opt/X11/include + +# Common C compiler warnings to silence +# +#CSILENCE= +CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-return-type + +# 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=gnu90 + +# Compiler bit architecture +# +# Some entries require 32-bitness: +# ARCH= -m32 +# +# Some entries require 64-bitness: +# ARCH= -m64 +# +# By default we assume nothing: +# +ARCH= + +# 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} +#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 + +# 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 + +# 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= -L ${HOMEBREW_PREFIX}/lib -lSDL + +# C compiler to use +# +CC= cc +#CC=clang +#CC=gcc + +# Compiler add-ons or replacements for clang only +# +ifeq ($(CC),clang) +# +CSILENCE+= -Wno-implicit-int-conversion -Wno-missing-prototypes \ + -Wno-missing-variable-declarations -Wno-poison-system-directories \ + -Wno-shadow -Wno-strict-prototypes +# +CWARN+= -Weverything +# +endif + +# Specific add-ons or replacements for gcc only +# +ifeq ($(CC),gcc) +# +#CSILENCE+= +# +#CWARN+= +# +endif + + +############################## +# Special flags for this entry +############################## +# +ENTRY= dodsond2 +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= + + +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +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 + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + 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: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + 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 --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + 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/1994/dodsond2/README.md b/1994/dodsond2/README.md index 6d28dd4a2..789d7cf85 100644 --- a/1994/dodsond2/README.md +++ b/1994/dodsond2/README.md @@ -1,4 +1,4 @@ -Most Obfuscated Packaging: +# Most Obfuscated Packaging: Don Dodson AG Communication Systems @@ -6,12 +6,15 @@ Most Obfuscated Packaging: Phoenix, AZ 85023 USA +## To build: -Judges' comments: + make all - To use: - make dodsond2 - dodsond2 +### To run + + ./dodsond2 + +## Judges' comments The original source file may be found in dodsond2.gz. For people who don't have gunzip, an un-zipped version is provided as dodsond2.c. @@ -21,8 +24,7 @@ Judges' comments: to get around the size limit will find themselves squeezed out of the contest! - -Selected notes from the author: +## Author's comments Go searching for the Wumpus in the Caverns of Doom! But be careful... There are pits and bats waiting to seal your fate, as well as a diff --git a/1994/horton/Makefile b/1994/horton/Makefile index 964287422..f3f80da39 100644 --- a/1994/horton/Makefile +++ b/1994/horton/Makefile @@ -1,157 +1,604 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1994 makefile +# IOCCC 1994 winning entry - horton + +################################################################################ # -# Copyright (c) 1994, Landon Curt Noll & Larry Bassel. -# All Rights Reserved. Permission for personal, educational or non-profit -# use is granted provided this this copyright and notice are included in its -# entirety and remains unaltered. All other uses must receive prior permission -# from Landon Curt Noll and Larry Bassel. - - -SHELL=/bin/sh -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true - -# flags for ANSI compiles +# An Historical Makefile NOTE: # -# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode, -# others such as gcc may want -ansi, others may want nothing -# at all. Adjust the CFLAGS line as needed. +# The orig.Makefile, if it exits, is the original Makefile before this IOCCC +# year directory was reworked so that entries are in separate directories. +# This also applies to any orig.ansi.mk and orig.common.mk files. # -# NOTE: Some compilers cannot optimize, or optimize some entries -# entries incorrectly. You might want need to turn on -O -# to see if your compiler can handle them. +# Several Makefiles were modified / formed in 2022, and as such it may have +# elements that are not historically compatible with way entries were built. +# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile. # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= - -# ANSI compiler +# Regarding individual entries: # -# Set CC to the name of your ANSI compiler. -#CC=cc -CC=gcc - -# winners that compile under ANSI C +# 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. # -WINNERS= dodsond1 dodsond2 horton imc ldb schnitzi shapiro smr tvr weisberg \ - westley -ALT_NAMES= dodsond2.orig shapiro.alt horton.alt gtface weisberg.alt tvr.alt - -all: $(WINNERS) $(ALT_NAMES) - -westley: westley.c - ${CC} ${CFLAGS} westley.c -DO -o westley - -weisberg: weisberg.c - ${CC} ${CFLAGS} -Dc='n*n>x?p:((m=*(b+1)),N))' \ - -De='(2<<6*sizeof(int))' \ - -Do='(8<<5*sizeof(int))' \ - -DN='((b=t+1),x+=2,x>e?exit():o' \ - -Dp='(a-t shapiro_t2.c - -shapiro_t1: shapiro.c - ${CC} ${CFLAGS} shapiro.c -o shapiro_t1 - -shapiro.alt: shapiro.alt.c - ${CC} ${CFLAGS} shapiro.alt.c -o shapiro.alt - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -horton: horton.c - ${CC} ${CFLAGS} horton.c -o horton - -# Here are some programs related to the horton entry. See horton.hint -# for details. +# 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. # -horton.alt: horton.alt.c - ${CC} ${CFLAGS} horton.alt.c -o horton.alt -gtface: gtface.c - ${CC} ${CFLAGS} gtface.c -o gtface - -ldb: ldb.c - ${CC} ${CFLAGS} ldb.c -o ldb - -imc: imc.c - ${CC} ${CFLAGS} imc.c -o imc - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 - -# NOTE: this is the original (gziped) file that won +# 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: # -dodsond2.orig: dodsond2.gz - @${RM} -f dodsond2.orig.c - -${GUNZIP} < dodsond2.gz > dodsond2.orig.c - -@if [ -s dodsond2.orig.c ]; then \ - echo "${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig"; \ - ${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig; \ - else \ - ${RM} -f dodsond2.orig.c; \ - echo "sorry, we could not gunzip dodsond2.gz"; \ - fi +# https://github.com/ioccc-src/winner +# +################################################################################ -dodsond2.gz: dodsond2.gz.uu - @${RM} -f dodsond2.gz - ${UUDECODE} dodsond2.gz.uu +# 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/ -dodsond1: dodsond1.c - ${CC} ${CFLAGS} dodsond1.c -o dodsond1 -clean: - $(RM) -f *.o a.out core +############################# +# shell used by this Makefile +############################# +# +SHELL= bash -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - ${RM} -f dodsond2.orig.c dodsond2.gz shapiro_t2.c shapiro_t1 +####################### +# common tool locations +####################### +# +A2P= a2p +AR= ar +ASA= asa +AT= at +ATQ= atq +ATRM= atrm +AWK= awk +BANNER= banner +BASE64= base64 +BASENAME= basename +BATCH= batch +BC= bc +BINHEX= binhex +BISON= bison +BUNZIP2= bunzip2 +BZCAT= bzcat +BZCMP= bzcmp +BZDIFF= bzdiff +BZEGREP= bzegrep +BZFGREP= bzfgrep +BZGREP= bzgrep +BZIP2= bzip2 +BZLESS= bzless +BZMORE= bzmore +C2PH= c2ph +C89= c89 +C99= c99 +CAL= cal +CALC= calc +CAT= cat +CD= cd +CHFLAGS= chflags +CHGRP= chgrp +CHMOD= chmod +CKSUM= cksum +CLANG= clang +CLANG_PLUSPLUS= clang++ +CLEAR= clear +CMP= cmp +COL= col +COLLDEF= colldef +COLRM= colrm +COLUMN= column +COMPRESS= compress +CP= cp +CPIO= cpio +CPP= cpp +CRC32= crc32 +CSH= csh +CSPLIT= csplit +CURL= curl +CUT= cut +C_PLUSPLUS= c++ +C_PLUSPLUS_FILT= c++filt +DATE= date +DC= dc +DD= dd +DF= df +DIFF3= diff3 +DIFF= diff +DIG= dig +DIRNAME= dirname +ED= ed +EGREP= egrep +ENV= env +EQN= eqn +ETAGS= etags +EXPECT= expect +EXPR= expr +FALSE= false +FGREP= fgrep +FILE= file +FIND2PERL= find2perl +FIND= find +FLEX= flex +FLEX_PLUSPLUS= flex++ +FMT= fmt +FOLD= fold +FS_USAGE= fs_usage +FUNZIP= funzip +FUSER= fuser +GCC= gcc +GDIFFMK= gdiffmk +GENCAT= gencat +GENSTRINGS= genstrings +GETOPT= getopt +GETOPTS= getopts +GINDENT= gindent +GNUMAKE= gnumake +GREP= grep +GROFF= groff +GROFFER= groffer +GROG= grog +GROPS= grops +GROTTY= grotty +GUNZIP= gunzip +GVIM= gvim +GZCAT= gzcat +GZEXE= gzexe +GZIP_PROG= gzip +G_PLUSPLUS= g++ +H2PH= h2ph +H2XS= h2xs +HASH= hash +HEAD= head +HOSTNAME_PROG= hostname +ICONV= iconv +ID= id +INDENT= indent +INFO= info +JOT= jot +KILL= kill +KSH= ksh +LAST= last +LD= ld +LESSECHO= lessecho +LEX= len +LINK= link +LN= ln +LS= ls +M4= m4 +MAKE= make +MAN= man +MKDIR= mkdir +MKFIFO= mkfifo +MKTEMP= mktemp +MV= mv +NANO= nano +NASM= nasm +NEQN= neqn +NICE= nice +NL= nl +NM= nm +NOHUP= nohup +NROFF= nroff +NSLOOKUP= nslookup +OD= od +OPENSSL= openssl +PASTE= paste +PATCH= patch +PATHCHK= pathchk +PAX= pax +PERL= perl +PICO= pico +PR= pr +PRINTENV= printenv +PS= ps +PTAR= ptar +PTARDIFF= ptardiff +PTARGREP= ptargrep +PWD= pwd +PYDOC= pydoc +PYTHON= python +PYTHONW= pythonw +READLINK= readlink +RENICE= renice +RESET= reset +REV= rev +RI= ri +RM= rm +RMDIR= rmdir +RSYNC= rsync +RUBY= ruby +RVIM= rvim +SAY= say +SCP= scp +SCREEN= screen +SCRIPT= script +SDIFF= sdiff +SED= sed +SEQ= seq +SFTP= sftp +SH= sh +SHA1= sha1 +SHA= sha +SHAR= shar +SHASUM5_18= shasum5.18 +SHASUM= shasum +SIZE= size +SLEEP= sleep +SORT= sort +SSH= ssh +STAT= stat +STRIP= strip +STTY= stty +SUM= sum +SYNC= sync +TABS= tabs +TAIL= tail +TAR= tar +TEE= tee +TEST= test +TFTP= tftp +TIDY= tidy +TIME= time +TOP= top +TOUCH= touch +TPUT= tout +TPUT= tput +TR= tr +TROFF= troff +TRUE= true +TSET= tset +TSORT= tsort +UL= ul +UNAME= uname +UNCOMPRESS= uncompress +UNEXPAND= unexpand +UNIFDEF= unifdef +UNIFDEFALL= unifdefall +UNIQ= uniq +UNITS= units +UNLINK= unlink +UNZIP= unzip +UNZIPSFX= unzipsfx +UPTIME= uptime +UUDECODE= uudecode +UUENCODE= uuencode +UUIDGEN= uuidgen +VI= vi +VIEW= view +VIM= vim +VIMDIFF= vimdiff +W= w +WAIT4PATH= wait4path +WAIT= wait +WC= wc +WGET= wget +WHAT= what +WHATIS= whatis +WHICH= which +WHO= who +WHOAMI= whoami +WHOIS= whois +WRTIE= write +XAR= xar +XARGS= xargs +XATTR= xattr +XXD= xxd +YACC= yacc +YES= yes +ZCAT= zcat +ZCMP= zcmp +ZDIFF= zdiff +ZEGREP= zegrep +ZFGREP= zfgrep +ZFORCE= zforce +ZGREP= zgrep +ZIP= zip +ZIPCLOAK= zipcloak +ZIPGREP= zipgrep +ZIPINFO= zipinfo +ZIPNOTE= zipnote +ZIPSPLIT= zipsplit +ZLESS= zless +ZMORE= zmore +ZNEW= znew +ZPRINT= zprint +ZSH= zsh -nuke: clobber +# Set X11_LIBDIR to the directory where the X11 library resides +# +#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/X11/include +X11_INCDIR= /opt/X11/include + +# Common C compiler warnings to silence +# +#CSILENCE= +CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-unused-parameter \ + -Wno-missing-braces -Wno-return-type -Wno-unused-but-set-variable \ + -Wno-unused-variable + +# 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=gnu90 + +# Compiler bit architecture +# +# Some entries require 32-bitness: +# ARCH= -m32 +# +# Some entries require 64-bitness: +# ARCH= -m64 +# +# By default we assume nothing: +# +ARCH= + +# 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} +#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 + +# 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 + +# 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= -L ${HOMEBREW_PREFIX}/lib -lSDL + +# C compiler to use +# +CC= cc +#CC=clang +#CC=gcc + +# Compiler add-ons or replacements for clang only +# +ifeq ($(CC),clang) +# +CSILENCE+= -Wno-float-conversion -Wno-missing-prototypes \ + -Wno-missing-variable-declarations -Wno-pedantic \ + -Wno-poison-system-directories -Wno-sign-conversion -Wno-strict-prototypes \ + -Wno-unused-macros +# +CWARN+= -Weverything +# +endif + +# Specific add-ons or replacements for gcc only +# +ifeq ($(CC),gcc) +# +#CSILENCE+= +# +#CWARN+= +# +endif + + +############################## +# Special flags for this entry +############################## +# +ENTRY= horton +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= gtface.data +TARGET= ${PROG} gtface ${PROG}.alt +# +ALT_OBJ= ${PROG}.alt.o +ALT_TARGET= ${PROG}.alt + + +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +gtface: gtface.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +${PROG}.alt: ${PROG}.alt.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +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 + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + 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: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + 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 --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + 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/1994/horton/README.md b/1994/horton/README.md index 0e6f9e7ca..49c349287 100644 --- a/1994/horton/README.md +++ b/1994/horton/README.md @@ -1,4 +1,4 @@ -Best Utility: +# Best Utility: Mark Horton AT&T Bell Labs @@ -7,29 +7,31 @@ Best Utility: Columbus OH 43213 USA +## To build: -Judges' comments: + make all + +### To run - To use: - make horton ./horton A B C D A, B, C, D are numeric arguments (try 3 2 1 0). +## Judges' comments + Try to figure out how this program prints, for a given slope, the right character. And for extra credit, try to figure out which character is at the bottom on this hint file. :-) This confuses cb greatly. See gtplot.c for an unobfuscated/enhanced - version. To compile it: + version. To run this alternate version: make horton.alt ./horton.alt A B C D A, B, C, D are numeric arguments (try 3 2 1 0). - -Selected notes from the author: +## Author's comments Run it with any 4 numeric arguments, e.g. prog 3 2 1 0. Play with the numbers to get a pleasing result, or use it for your high school algebra diff --git a/1994/imc/Makefile b/1994/imc/Makefile index 964287422..980a660b0 100644 --- a/1994/imc/Makefile +++ b/1994/imc/Makefile @@ -1,157 +1,595 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1994 makefile +# IOCCC 1994 winning entry - imc + +################################################################################ # -# Copyright (c) 1994, Landon Curt Noll & Larry Bassel. -# All Rights Reserved. Permission for personal, educational or non-profit -# use is granted provided this this copyright and notice are included in its -# entirety and remains unaltered. All other uses must receive prior permission -# from Landon Curt Noll and Larry Bassel. - - -SHELL=/bin/sh -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true - -# flags for ANSI compiles +# An Historical Makefile NOTE: # -# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode, -# others such as gcc may want -ansi, others may want nothing -# at all. Adjust the CFLAGS line as needed. +# The orig.Makefile, if it exits, is the original Makefile before this IOCCC +# year directory was reworked so that entries are in separate directories. +# This also applies to any orig.ansi.mk and orig.common.mk files. # -# NOTE: Some compilers cannot optimize, or optimize some entries -# entries incorrectly. You might want need to turn on -O -# to see if your compiler can handle them. +# Several Makefiles were modified / formed in 2022, and as such it may have +# elements that are not historically compatible with way entries were built. +# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile. # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= - -# ANSI compiler +# Regarding individual entries: # -# Set CC to the name of your ANSI compiler. -#CC=cc -CC=gcc - -# winners that compile under ANSI C +# 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. # -WINNERS= dodsond1 dodsond2 horton imc ldb schnitzi shapiro smr tvr weisberg \ - westley -ALT_NAMES= dodsond2.orig shapiro.alt horton.alt gtface weisberg.alt tvr.alt - -all: $(WINNERS) $(ALT_NAMES) - -westley: westley.c - ${CC} ${CFLAGS} westley.c -DO -o westley - -weisberg: weisberg.c - ${CC} ${CFLAGS} -Dc='n*n>x?p:((m=*(b+1)),N))' \ - -De='(2<<6*sizeof(int))' \ - -Do='(8<<5*sizeof(int))' \ - -DN='((b=t+1),x+=2,x>e?exit():o' \ - -Dp='(a-t shapiro_t2.c - -shapiro_t1: shapiro.c - ${CC} ${CFLAGS} shapiro.c -o shapiro_t1 - -shapiro.alt: shapiro.alt.c - ${CC} ${CFLAGS} shapiro.alt.c -o shapiro.alt - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -horton: horton.c - ${CC} ${CFLAGS} horton.c -o horton - -# Here are some programs related to the horton entry. See horton.hint -# for details. +# 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. # -horton.alt: horton.alt.c - ${CC} ${CFLAGS} horton.alt.c -o horton.alt -gtface: gtface.c - ${CC} ${CFLAGS} gtface.c -o gtface - -ldb: ldb.c - ${CC} ${CFLAGS} ldb.c -o ldb - -imc: imc.c - ${CC} ${CFLAGS} imc.c -o imc - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 - -# NOTE: this is the original (gziped) file that won +# 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: # -dodsond2.orig: dodsond2.gz - @${RM} -f dodsond2.orig.c - -${GUNZIP} < dodsond2.gz > dodsond2.orig.c - -@if [ -s dodsond2.orig.c ]; then \ - echo "${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig"; \ - ${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig; \ - else \ - ${RM} -f dodsond2.orig.c; \ - echo "sorry, we could not gunzip dodsond2.gz"; \ - fi +# https://github.com/ioccc-src/winner +# +################################################################################ -dodsond2.gz: dodsond2.gz.uu - @${RM} -f dodsond2.gz - ${UUDECODE} dodsond2.gz.uu +# 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/ -dodsond1: dodsond1.c - ${CC} ${CFLAGS} dodsond1.c -o dodsond1 -clean: - $(RM) -f *.o a.out core +############################# +# shell used by this Makefile +############################# +# +SHELL= bash -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - ${RM} -f dodsond2.orig.c dodsond2.gz shapiro_t2.c shapiro_t1 +####################### +# common tool locations +####################### +# +A2P= a2p +AR= ar +ASA= asa +AT= at +ATQ= atq +ATRM= atrm +AWK= awk +BANNER= banner +BASE64= base64 +BASENAME= basename +BATCH= batch +BC= bc +BINHEX= binhex +BISON= bison +BUNZIP2= bunzip2 +BZCAT= bzcat +BZCMP= bzcmp +BZDIFF= bzdiff +BZEGREP= bzegrep +BZFGREP= bzfgrep +BZGREP= bzgrep +BZIP2= bzip2 +BZLESS= bzless +BZMORE= bzmore +C2PH= c2ph +C89= c89 +C99= c99 +CAL= cal +CALC= calc +CAT= cat +CD= cd +CHFLAGS= chflags +CHGRP= chgrp +CHMOD= chmod +CKSUM= cksum +CLANG= clang +CLANG_PLUSPLUS= clang++ +CLEAR= clear +CMP= cmp +COL= col +COLLDEF= colldef +COLRM= colrm +COLUMN= column +COMPRESS= compress +CP= cp +CPIO= cpio +CPP= cpp +CRC32= crc32 +CSH= csh +CSPLIT= csplit +CURL= curl +CUT= cut +C_PLUSPLUS= c++ +C_PLUSPLUS_FILT= c++filt +DATE= date +DC= dc +DD= dd +DF= df +DIFF3= diff3 +DIFF= diff +DIG= dig +DIRNAME= dirname +ED= ed +EGREP= egrep +ENV= env +EQN= eqn +ETAGS= etags +EXPECT= expect +EXPR= expr +FALSE= false +FGREP= fgrep +FILE= file +FIND2PERL= find2perl +FIND= find +FLEX= flex +FLEX_PLUSPLUS= flex++ +FMT= fmt +FOLD= fold +FS_USAGE= fs_usage +FUNZIP= funzip +FUSER= fuser +GCC= gcc +GDIFFMK= gdiffmk +GENCAT= gencat +GENSTRINGS= genstrings +GETOPT= getopt +GETOPTS= getopts +GINDENT= gindent +GNUMAKE= gnumake +GREP= grep +GROFF= groff +GROFFER= groffer +GROG= grog +GROPS= grops +GROTTY= grotty +GUNZIP= gunzip +GVIM= gvim +GZCAT= gzcat +GZEXE= gzexe +GZIP_PROG= gzip +G_PLUSPLUS= g++ +H2PH= h2ph +H2XS= h2xs +HASH= hash +HEAD= head +HOSTNAME_PROG= hostname +ICONV= iconv +ID= id +INDENT= indent +INFO= info +JOT= jot +KILL= kill +KSH= ksh +LAST= last +LD= ld +LESSECHO= lessecho +LEX= len +LINK= link +LN= ln +LS= ls +M4= m4 +MAKE= make +MAN= man +MKDIR= mkdir +MKFIFO= mkfifo +MKTEMP= mktemp +MV= mv +NANO= nano +NASM= nasm +NEQN= neqn +NICE= nice +NL= nl +NM= nm +NOHUP= nohup +NROFF= nroff +NSLOOKUP= nslookup +OD= od +OPENSSL= openssl +PASTE= paste +PATCH= patch +PATHCHK= pathchk +PAX= pax +PERL= perl +PICO= pico +PR= pr +PRINTENV= printenv +PS= ps +PTAR= ptar +PTARDIFF= ptardiff +PTARGREP= ptargrep +PWD= pwd +PYDOC= pydoc +PYTHON= python +PYTHONW= pythonw +READLINK= readlink +RENICE= renice +RESET= reset +REV= rev +RI= ri +RM= rm +RMDIR= rmdir +RSYNC= rsync +RUBY= ruby +RVIM= rvim +SAY= say +SCP= scp +SCREEN= screen +SCRIPT= script +SDIFF= sdiff +SED= sed +SEQ= seq +SFTP= sftp +SH= sh +SHA1= sha1 +SHA= sha +SHAR= shar +SHASUM5_18= shasum5.18 +SHASUM= shasum +SIZE= size +SLEEP= sleep +SORT= sort +SSH= ssh +STAT= stat +STRIP= strip +STTY= stty +SUM= sum +SYNC= sync +TABS= tabs +TAIL= tail +TAR= tar +TEE= tee +TEST= test +TFTP= tftp +TIDY= tidy +TIME= time +TOP= top +TOUCH= touch +TPUT= tout +TPUT= tput +TR= tr +TROFF= troff +TRUE= true +TSET= tset +TSORT= tsort +UL= ul +UNAME= uname +UNCOMPRESS= uncompress +UNEXPAND= unexpand +UNIFDEF= unifdef +UNIFDEFALL= unifdefall +UNIQ= uniq +UNITS= units +UNLINK= unlink +UNZIP= unzip +UNZIPSFX= unzipsfx +UPTIME= uptime +UUDECODE= uudecode +UUENCODE= uuencode +UUIDGEN= uuidgen +VI= vi +VIEW= view +VIM= vim +VIMDIFF= vimdiff +W= w +WAIT4PATH= wait4path +WAIT= wait +WC= wc +WGET= wget +WHAT= what +WHATIS= whatis +WHICH= which +WHO= who +WHOAMI= whoami +WHOIS= whois +WRTIE= write +XAR= xar +XARGS= xargs +XATTR= xattr +XXD= xxd +YACC= yacc +YES= yes +ZCAT= zcat +ZCMP= zcmp +ZDIFF= zdiff +ZEGREP= zegrep +ZFGREP= zfgrep +ZFORCE= zforce +ZGREP= zgrep +ZIP= zip +ZIPCLOAK= zipcloak +ZIPGREP= zipgrep +ZIPINFO= zipinfo +ZIPNOTE= zipnote +ZIPSPLIT= zipsplit +ZLESS= zless +ZMORE= zmore +ZNEW= znew +ZPRINT= zprint +ZSH= zsh -nuke: clobber +# Set X11_LIBDIR to the directory where the X11 library resides +# +#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/X11/include +X11_INCDIR= /opt/X11/include + +# Common C compiler warnings to silence +# +#CSILENCE= +CSILENCE= -Wno-error -Wno-implicit-function-declaration + +# 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=gnu90 + +# Compiler bit architecture +# +# Some entries require 32-bitness: +# ARCH= -m32 +# +# Some entries require 64-bitness: +# ARCH= -m64 +# +# By default we assume nothing: +# +ARCH= + +# 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} +#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 + +# 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 + +# 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= -L ${HOMEBREW_PREFIX}/lib -lSDL + +# C compiler to use +# +CC= cc +#CC=clang +#CC=gcc + +# Compiler add-ons or replacements for clang only +# +ifeq ($(CC),clang) +# +CSILENCE+= -Wno-comma -Wno-conditional-uninitialized -Wno-missing-prototypes \ + -Wno-missing-variable-declarations -Wno-poison-system-directories \ + -Wno-shadow -Wno-sign-conversion -Wno-strict-prototypes +# +CWARN+= -Weverything +# +endif + +# Specific add-ons or replacements for gcc only +# +ifeq ($(CC),gcc) +# +#CSILENCE+= +# +#CWARN+= +# +endif + + +############################## +# Special flags for this entry +############################## +# +ENTRY= imc +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= + + +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +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 + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + 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: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + 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 --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + 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/1994/imc/README.md b/1994/imc/README.md index 4679ff4d1..68f022b70 100644 --- a/1994/imc/README.md +++ b/1994/imc/README.md @@ -1,4 +1,4 @@ -Most Obfuscated Algorithm: +# Most Obfuscated Algorithm: Ian Collier Oxford University @@ -7,13 +7,17 @@ Most Obfuscated Algorithm: BL3 4LG England +## To build: -Judges' comments: + make all + +### To run To use: - make imc ./imc INTEGER +## Judges' comments + Try: ./imc 3 ./imc 3 @@ -23,8 +27,7 @@ Judges' comments: This entry's algorithm is as magic as its output! - -Selected notes from the author: +## Author's comments This program may be compiled with an ANSI or K&R compiler. A few harmless warnings are displayed only if "gcc -Wall" is used. diff --git a/1994/ldb/Makefile b/1994/ldb/Makefile index 964287422..59c4fe5e5 100644 --- a/1994/ldb/Makefile +++ b/1994/ldb/Makefile @@ -1,157 +1,593 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1994 makefile +# IOCCC 1994 winning entry - ldb + +################################################################################ # -# Copyright (c) 1994, Landon Curt Noll & Larry Bassel. -# All Rights Reserved. Permission for personal, educational or non-profit -# use is granted provided this this copyright and notice are included in its -# entirety and remains unaltered. All other uses must receive prior permission -# from Landon Curt Noll and Larry Bassel. - - -SHELL=/bin/sh -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true - -# flags for ANSI compiles +# An Historical Makefile NOTE: # -# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode, -# others such as gcc may want -ansi, others may want nothing -# at all. Adjust the CFLAGS line as needed. +# The orig.Makefile, if it exits, is the original Makefile before this IOCCC +# year directory was reworked so that entries are in separate directories. +# This also applies to any orig.ansi.mk and orig.common.mk files. # -# NOTE: Some compilers cannot optimize, or optimize some entries -# entries incorrectly. You might want need to turn on -O -# to see if your compiler can handle them. +# Several Makefiles were modified / formed in 2022, and as such it may have +# elements that are not historically compatible with way entries were built. +# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile. # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= - -# ANSI compiler +# Regarding individual entries: # -# Set CC to the name of your ANSI compiler. -#CC=cc -CC=gcc - -# winners that compile under ANSI C +# 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. # -WINNERS= dodsond1 dodsond2 horton imc ldb schnitzi shapiro smr tvr weisberg \ - westley -ALT_NAMES= dodsond2.orig shapiro.alt horton.alt gtface weisberg.alt tvr.alt - -all: $(WINNERS) $(ALT_NAMES) - -westley: westley.c - ${CC} ${CFLAGS} westley.c -DO -o westley - -weisberg: weisberg.c - ${CC} ${CFLAGS} -Dc='n*n>x?p:((m=*(b+1)),N))' \ - -De='(2<<6*sizeof(int))' \ - -Do='(8<<5*sizeof(int))' \ - -DN='((b=t+1),x+=2,x>e?exit():o' \ - -Dp='(a-t shapiro_t2.c - -shapiro_t1: shapiro.c - ${CC} ${CFLAGS} shapiro.c -o shapiro_t1 - -shapiro.alt: shapiro.alt.c - ${CC} ${CFLAGS} shapiro.alt.c -o shapiro.alt - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -horton: horton.c - ${CC} ${CFLAGS} horton.c -o horton - -# Here are some programs related to the horton entry. See horton.hint -# for details. +# 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. # -horton.alt: horton.alt.c - ${CC} ${CFLAGS} horton.alt.c -o horton.alt -gtface: gtface.c - ${CC} ${CFLAGS} gtface.c -o gtface - -ldb: ldb.c - ${CC} ${CFLAGS} ldb.c -o ldb - -imc: imc.c - ${CC} ${CFLAGS} imc.c -o imc - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 - -# NOTE: this is the original (gziped) file that won +# 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: # -dodsond2.orig: dodsond2.gz - @${RM} -f dodsond2.orig.c - -${GUNZIP} < dodsond2.gz > dodsond2.orig.c - -@if [ -s dodsond2.orig.c ]; then \ - echo "${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig"; \ - ${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig; \ - else \ - ${RM} -f dodsond2.orig.c; \ - echo "sorry, we could not gunzip dodsond2.gz"; \ - fi +# https://github.com/ioccc-src/winner +# +################################################################################ -dodsond2.gz: dodsond2.gz.uu - @${RM} -f dodsond2.gz - ${UUDECODE} dodsond2.gz.uu +# 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/ -dodsond1: dodsond1.c - ${CC} ${CFLAGS} dodsond1.c -o dodsond1 -clean: - $(RM) -f *.o a.out core +############################# +# shell used by this Makefile +############################# +# +SHELL= bash -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - ${RM} -f dodsond2.orig.c dodsond2.gz shapiro_t2.c shapiro_t1 +####################### +# common tool locations +####################### +# +A2P= a2p +AR= ar +ASA= asa +AT= at +ATQ= atq +ATRM= atrm +AWK= awk +BANNER= banner +BASE64= base64 +BASENAME= basename +BATCH= batch +BC= bc +BINHEX= binhex +BISON= bison +BUNZIP2= bunzip2 +BZCAT= bzcat +BZCMP= bzcmp +BZDIFF= bzdiff +BZEGREP= bzegrep +BZFGREP= bzfgrep +BZGREP= bzgrep +BZIP2= bzip2 +BZLESS= bzless +BZMORE= bzmore +C2PH= c2ph +C89= c89 +C99= c99 +CAL= cal +CALC= calc +CAT= cat +CD= cd +CHFLAGS= chflags +CHGRP= chgrp +CHMOD= chmod +CKSUM= cksum +CLANG= clang +CLANG_PLUSPLUS= clang++ +CLEAR= clear +CMP= cmp +COL= col +COLLDEF= colldef +COLRM= colrm +COLUMN= column +COMPRESS= compress +CP= cp +CPIO= cpio +CPP= cpp +CRC32= crc32 +CSH= csh +CSPLIT= csplit +CURL= curl +CUT= cut +C_PLUSPLUS= c++ +C_PLUSPLUS_FILT= c++filt +DATE= date +DC= dc +DD= dd +DF= df +DIFF3= diff3 +DIFF= diff +DIG= dig +DIRNAME= dirname +ED= ed +EGREP= egrep +ENV= env +EQN= eqn +ETAGS= etags +EXPECT= expect +EXPR= expr +FALSE= false +FGREP= fgrep +FILE= file +FIND2PERL= find2perl +FIND= find +FLEX= flex +FLEX_PLUSPLUS= flex++ +FMT= fmt +FOLD= fold +FS_USAGE= fs_usage +FUNZIP= funzip +FUSER= fuser +GCC= gcc +GDIFFMK= gdiffmk +GENCAT= gencat +GENSTRINGS= genstrings +GETOPT= getopt +GETOPTS= getopts +GINDENT= gindent +GNUMAKE= gnumake +GREP= grep +GROFF= groff +GROFFER= groffer +GROG= grog +GROPS= grops +GROTTY= grotty +GUNZIP= gunzip +GVIM= gvim +GZCAT= gzcat +GZEXE= gzexe +GZIP_PROG= gzip +G_PLUSPLUS= g++ +H2PH= h2ph +H2XS= h2xs +HASH= hash +HEAD= head +HOSTNAME_PROG= hostname +ICONV= iconv +ID= id +INDENT= indent +INFO= info +JOT= jot +KILL= kill +KSH= ksh +LAST= last +LD= ld +LESSECHO= lessecho +LEX= len +LINK= link +LN= ln +LS= ls +M4= m4 +MAKE= make +MAN= man +MKDIR= mkdir +MKFIFO= mkfifo +MKTEMP= mktemp +MV= mv +NANO= nano +NASM= nasm +NEQN= neqn +NICE= nice +NL= nl +NM= nm +NOHUP= nohup +NROFF= nroff +NSLOOKUP= nslookup +OD= od +OPENSSL= openssl +PASTE= paste +PATCH= patch +PATHCHK= pathchk +PAX= pax +PERL= perl +PICO= pico +PR= pr +PRINTENV= printenv +PS= ps +PTAR= ptar +PTARDIFF= ptardiff +PTARGREP= ptargrep +PWD= pwd +PYDOC= pydoc +PYTHON= python +PYTHONW= pythonw +READLINK= readlink +RENICE= renice +RESET= reset +REV= rev +RI= ri +RM= rm +RMDIR= rmdir +RSYNC= rsync +RUBY= ruby +RVIM= rvim +SAY= say +SCP= scp +SCREEN= screen +SCRIPT= script +SDIFF= sdiff +SED= sed +SEQ= seq +SFTP= sftp +SH= sh +SHA1= sha1 +SHA= sha +SHAR= shar +SHASUM5_18= shasum5.18 +SHASUM= shasum +SIZE= size +SLEEP= sleep +SORT= sort +SSH= ssh +STAT= stat +STRIP= strip +STTY= stty +SUM= sum +SYNC= sync +TABS= tabs +TAIL= tail +TAR= tar +TEE= tee +TEST= test +TFTP= tftp +TIDY= tidy +TIME= time +TOP= top +TOUCH= touch +TPUT= tout +TPUT= tput +TR= tr +TROFF= troff +TRUE= true +TSET= tset +TSORT= tsort +UL= ul +UNAME= uname +UNCOMPRESS= uncompress +UNEXPAND= unexpand +UNIFDEF= unifdef +UNIFDEFALL= unifdefall +UNIQ= uniq +UNITS= units +UNLINK= unlink +UNZIP= unzip +UNZIPSFX= unzipsfx +UPTIME= uptime +UUDECODE= uudecode +UUENCODE= uuencode +UUIDGEN= uuidgen +VI= vi +VIEW= view +VIM= vim +VIMDIFF= vimdiff +W= w +WAIT4PATH= wait4path +WAIT= wait +WC= wc +WGET= wget +WHAT= what +WHATIS= whatis +WHICH= which +WHO= who +WHOAMI= whoami +WHOIS= whois +WRTIE= write +XAR= xar +XARGS= xargs +XATTR= xattr +XXD= xxd +YACC= yacc +YES= yes +ZCAT= zcat +ZCMP= zcmp +ZDIFF= zdiff +ZEGREP= zegrep +ZFGREP= zfgrep +ZFORCE= zforce +ZGREP= zgrep +ZIP= zip +ZIPCLOAK= zipcloak +ZIPGREP= zipgrep +ZIPINFO= zipinfo +ZIPNOTE= zipnote +ZIPSPLIT= zipsplit +ZLESS= zless +ZMORE= zmore +ZNEW= znew +ZPRINT= zprint +ZSH= zsh -nuke: clobber +# Set X11_LIBDIR to the directory where the X11 library resides +# +#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/X11/include +X11_INCDIR= /opt/X11/include + +# Common C compiler warnings to silence +# +#CSILENCE= +CSILENCE= -Wno-trigraphs + +# 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=gnu90 + +# Compiler bit architecture +# +# Some entries require 32-bitness: +# ARCH= -m32 +# +# Some entries require 64-bitness: +# ARCH= -m64 +# +# By default we assume nothing: +# +ARCH= + +# 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} +#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 + +# 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 + +# 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= -L ${HOMEBREW_PREFIX}/lib -lSDL + +# C compiler to use +# +CC= cc +#CC=clang +#CC=gcc + +# Compiler add-ons or replacements for clang only +# +ifeq ($(CC),clang) +# +CSILENCE+= -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 + + +############################## +# Special flags for this entry +############################## +# +ENTRY= ldb +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= + + +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +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 + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + 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: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + 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 --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + 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/1994/ldb/README.md b/1994/ldb/README.md index ced51b55b..5df2ce072 100644 --- a/1994/ldb/README.md +++ b/1994/ldb/README.md @@ -1,4 +1,4 @@ -Best One-liner: +# Best One-liner: Laurion Burchall Brown University @@ -6,23 +6,25 @@ Best One-liner: Providence RI 02912-4641 USA +## To build: -Judges' comments: + make all + +### To run - To use: - make ldb ./ldb < file Try: ./ldb < /etc/passwd +## Judges' comments + Tri-graphs are natural obfuscators. Most C-beautifiers become C-uglifiers because they don't handle them correctly. Can you figure out how it prints a given random line from stdin? - -Selected notes from the author: +## Author's comments All input lines must be under 232 characters long. The compiling platform should be ASCII based. diff --git a/1994/schnitzi/Makefile b/1994/schnitzi/Makefile index 964287422..ed41adb15 100644 --- a/1994/schnitzi/Makefile +++ b/1994/schnitzi/Makefile @@ -1,157 +1,594 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1994 makefile +# IOCCC 1994 winning entry - schnitzi + +################################################################################ # -# Copyright (c) 1994, Landon Curt Noll & Larry Bassel. -# All Rights Reserved. Permission for personal, educational or non-profit -# use is granted provided this this copyright and notice are included in its -# entirety and remains unaltered. All other uses must receive prior permission -# from Landon Curt Noll and Larry Bassel. - - -SHELL=/bin/sh -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true - -# flags for ANSI compiles +# An Historical Makefile NOTE: # -# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode, -# others such as gcc may want -ansi, others may want nothing -# at all. Adjust the CFLAGS line as needed. +# The orig.Makefile, if it exits, is the original Makefile before this IOCCC +# year directory was reworked so that entries are in separate directories. +# This also applies to any orig.ansi.mk and orig.common.mk files. # -# NOTE: Some compilers cannot optimize, or optimize some entries -# entries incorrectly. You might want need to turn on -O -# to see if your compiler can handle them. +# Several Makefiles were modified / formed in 2022, and as such it may have +# elements that are not historically compatible with way entries were built. +# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile. # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= - -# ANSI compiler +# Regarding individual entries: # -# Set CC to the name of your ANSI compiler. -#CC=cc -CC=gcc - -# winners that compile under ANSI C +# 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. # -WINNERS= dodsond1 dodsond2 horton imc ldb schnitzi shapiro smr tvr weisberg \ - westley -ALT_NAMES= dodsond2.orig shapiro.alt horton.alt gtface weisberg.alt tvr.alt - -all: $(WINNERS) $(ALT_NAMES) - -westley: westley.c - ${CC} ${CFLAGS} westley.c -DO -o westley - -weisberg: weisberg.c - ${CC} ${CFLAGS} -Dc='n*n>x?p:((m=*(b+1)),N))' \ - -De='(2<<6*sizeof(int))' \ - -Do='(8<<5*sizeof(int))' \ - -DN='((b=t+1),x+=2,x>e?exit():o' \ - -Dp='(a-t shapiro_t2.c - -shapiro_t1: shapiro.c - ${CC} ${CFLAGS} shapiro.c -o shapiro_t1 - -shapiro.alt: shapiro.alt.c - ${CC} ${CFLAGS} shapiro.alt.c -o shapiro.alt - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -horton: horton.c - ${CC} ${CFLAGS} horton.c -o horton - -# Here are some programs related to the horton entry. See horton.hint -# for details. +# 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. # -horton.alt: horton.alt.c - ${CC} ${CFLAGS} horton.alt.c -o horton.alt -gtface: gtface.c - ${CC} ${CFLAGS} gtface.c -o gtface - -ldb: ldb.c - ${CC} ${CFLAGS} ldb.c -o ldb - -imc: imc.c - ${CC} ${CFLAGS} imc.c -o imc - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 - -# NOTE: this is the original (gziped) file that won +# 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: # -dodsond2.orig: dodsond2.gz - @${RM} -f dodsond2.orig.c - -${GUNZIP} < dodsond2.gz > dodsond2.orig.c - -@if [ -s dodsond2.orig.c ]; then \ - echo "${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig"; \ - ${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig; \ - else \ - ${RM} -f dodsond2.orig.c; \ - echo "sorry, we could not gunzip dodsond2.gz"; \ - fi +# https://github.com/ioccc-src/winner +# +################################################################################ -dodsond2.gz: dodsond2.gz.uu - @${RM} -f dodsond2.gz - ${UUDECODE} dodsond2.gz.uu +# 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/ -dodsond1: dodsond1.c - ${CC} ${CFLAGS} dodsond1.c -o dodsond1 -clean: - $(RM) -f *.o a.out core +############################# +# shell used by this Makefile +############################# +# +SHELL= bash -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - ${RM} -f dodsond2.orig.c dodsond2.gz shapiro_t2.c shapiro_t1 +####################### +# common tool locations +####################### +# +A2P= a2p +AR= ar +ASA= asa +AT= at +ATQ= atq +ATRM= atrm +AWK= awk +BANNER= banner +BASE64= base64 +BASENAME= basename +BATCH= batch +BC= bc +BINHEX= binhex +BISON= bison +BUNZIP2= bunzip2 +BZCAT= bzcat +BZCMP= bzcmp +BZDIFF= bzdiff +BZEGREP= bzegrep +BZFGREP= bzfgrep +BZGREP= bzgrep +BZIP2= bzip2 +BZLESS= bzless +BZMORE= bzmore +C2PH= c2ph +C89= c89 +C99= c99 +CAL= cal +CALC= calc +CAT= cat +CD= cd +CHFLAGS= chflags +CHGRP= chgrp +CHMOD= chmod +CKSUM= cksum +CLANG= clang +CLANG_PLUSPLUS= clang++ +CLEAR= clear +CMP= cmp +COL= col +COLLDEF= colldef +COLRM= colrm +COLUMN= column +COMPRESS= compress +CP= cp +CPIO= cpio +CPP= cpp +CRC32= crc32 +CSH= csh +CSPLIT= csplit +CURL= curl +CUT= cut +C_PLUSPLUS= c++ +C_PLUSPLUS_FILT= c++filt +DATE= date +DC= dc +DD= dd +DF= df +DIFF3= diff3 +DIFF= diff +DIG= dig +DIRNAME= dirname +ED= ed +EGREP= egrep +ENV= env +EQN= eqn +ETAGS= etags +EXPECT= expect +EXPR= expr +FALSE= false +FGREP= fgrep +FILE= file +FIND2PERL= find2perl +FIND= find +FLEX= flex +FLEX_PLUSPLUS= flex++ +FMT= fmt +FOLD= fold +FS_USAGE= fs_usage +FUNZIP= funzip +FUSER= fuser +GCC= gcc +GDIFFMK= gdiffmk +GENCAT= gencat +GENSTRINGS= genstrings +GETOPT= getopt +GETOPTS= getopts +GINDENT= gindent +GNUMAKE= gnumake +GREP= grep +GROFF= groff +GROFFER= groffer +GROG= grog +GROPS= grops +GROTTY= grotty +GUNZIP= gunzip +GVIM= gvim +GZCAT= gzcat +GZEXE= gzexe +GZIP_PROG= gzip +G_PLUSPLUS= g++ +H2PH= h2ph +H2XS= h2xs +HASH= hash +HEAD= head +HOSTNAME_PROG= hostname +ICONV= iconv +ID= id +INDENT= indent +INFO= info +JOT= jot +KILL= kill +KSH= ksh +LAST= last +LD= ld +LESSECHO= lessecho +LEX= len +LINK= link +LN= ln +LS= ls +M4= m4 +MAKE= make +MAN= man +MKDIR= mkdir +MKFIFO= mkfifo +MKTEMP= mktemp +MV= mv +NANO= nano +NASM= nasm +NEQN= neqn +NICE= nice +NL= nl +NM= nm +NOHUP= nohup +NROFF= nroff +NSLOOKUP= nslookup +OD= od +OPENSSL= openssl +PASTE= paste +PATCH= patch +PATHCHK= pathchk +PAX= pax +PERL= perl +PICO= pico +PR= pr +PRINTENV= printenv +PS= ps +PTAR= ptar +PTARDIFF= ptardiff +PTARGREP= ptargrep +PWD= pwd +PYDOC= pydoc +PYTHON= python +PYTHONW= pythonw +READLINK= readlink +RENICE= renice +RESET= reset +REV= rev +RI= ri +RM= rm +RMDIR= rmdir +RSYNC= rsync +RUBY= ruby +RVIM= rvim +SAY= say +SCP= scp +SCREEN= screen +SCRIPT= script +SDIFF= sdiff +SED= sed +SEQ= seq +SFTP= sftp +SH= sh +SHA1= sha1 +SHA= sha +SHAR= shar +SHASUM5_18= shasum5.18 +SHASUM= shasum +SIZE= size +SLEEP= sleep +SORT= sort +SSH= ssh +STAT= stat +STRIP= strip +STTY= stty +SUM= sum +SYNC= sync +TABS= tabs +TAIL= tail +TAR= tar +TEE= tee +TEST= test +TFTP= tftp +TIDY= tidy +TIME= time +TOP= top +TOUCH= touch +TPUT= tout +TPUT= tput +TR= tr +TROFF= troff +TRUE= true +TSET= tset +TSORT= tsort +UL= ul +UNAME= uname +UNCOMPRESS= uncompress +UNEXPAND= unexpand +UNIFDEF= unifdef +UNIFDEFALL= unifdefall +UNIQ= uniq +UNITS= units +UNLINK= unlink +UNZIP= unzip +UNZIPSFX= unzipsfx +UPTIME= uptime +UUDECODE= uudecode +UUENCODE= uuencode +UUIDGEN= uuidgen +VI= vi +VIEW= view +VIM= vim +VIMDIFF= vimdiff +W= w +WAIT4PATH= wait4path +WAIT= wait +WC= wc +WGET= wget +WHAT= what +WHATIS= whatis +WHICH= which +WHO= who +WHOAMI= whoami +WHOIS= whois +WRTIE= write +XAR= xar +XARGS= xargs +XATTR= xattr +XXD= xxd +YACC= yacc +YES= yes +ZCAT= zcat +ZCMP= zcmp +ZDIFF= zdiff +ZEGREP= zegrep +ZFGREP= zfgrep +ZFORCE= zforce +ZGREP= zgrep +ZIP= zip +ZIPCLOAK= zipcloak +ZIPGREP= zipgrep +ZIPINFO= zipinfo +ZIPNOTE= zipnote +ZIPSPLIT= zipsplit +ZLESS= zless +ZMORE= zmore +ZNEW= znew +ZPRINT= zprint +ZSH= zsh -nuke: clobber +# Set X11_LIBDIR to the directory where the X11 library resides +# +#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/X11/include +X11_INCDIR= /opt/X11/include + +# Common C compiler warnings to silence +# +#CSILENCE= +CSILENCE= -Wno-deprecated-declarations -Wno-error -Wno-implicit-function-declaration + +# 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=gnu90 + +# Compiler bit architecture +# +# Some entries require 32-bitness: +# ARCH= -m32 +# +# Some entries require 64-bitness: +# ARCH= -m64 +# +# By default we assume nothing: +# +ARCH= + +# 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} +#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 + +# 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 + +# 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= -L ${HOMEBREW_PREFIX}/lib -lSDL + +# C compiler to use +# +CC= cc +#CC=clang +#CC=gcc + +# Compiler add-ons or replacements for clang only +# +ifeq ($(CC),clang) +# +CSILENCE+= -Wno-missing-variable-declarations -Wno-poison-system-directories \ + -Wno-shorten-64-to-32 +# +CWARN+= -Weverything +# +endif + +# Specific add-ons or replacements for gcc only +# +ifeq ($(CC),gcc) +# +#CSILENCE+= +# +#CWARN+= +# +endif + + +############################## +# Special flags for this entry +############################## +# +ENTRY= schnitzi +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= + + +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +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 + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + 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: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + 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 --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + 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/1994/schnitzi/README.md b/1994/schnitzi/README.md index d1104edf6..483653e26 100644 --- a/1994/schnitzi/README.md +++ b/1994/schnitzi/README.md @@ -1,4 +1,4 @@ -Best Layout: +# Best Layout: Mark Schnitzius ISX Corporation @@ -6,14 +6,18 @@ Best Layout: Marietta, GA 30067 USA +## To build: -Judges' comments: + make all + +### To run - To use: - make schnitzi ./schnitzi < textfile +## Judges' comments + Try: + ./schnitzi < /etc/motd ./schnitzi < schnitzi.c @@ -21,8 +25,7 @@ Judges' comments: is different, but there is more than meets the diff's eye. Can you find out why? - -Selected notes from the author: +## Author's comments SPOILER: diff --git a/1994/shapiro/.gitignore b/1994/shapiro/.gitignore index 9912ed2e4..784ac9419 100644 --- a/1994/shapiro/.gitignore +++ b/1994/shapiro/.gitignore @@ -1 +1,3 @@ shapiro +shapiro_t1 +shapiro_t2.c diff --git a/1994/shapiro/Makefile b/1994/shapiro/Makefile index 964287422..d47ef71c6 100644 --- a/1994/shapiro/Makefile +++ b/1994/shapiro/Makefile @@ -1,157 +1,602 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1994 makefile +# IOCCC 1994 winning entry - shapiro + +################################################################################ # -# Copyright (c) 1994, Landon Curt Noll & Larry Bassel. -# All Rights Reserved. Permission for personal, educational or non-profit -# use is granted provided this this copyright and notice are included in its -# entirety and remains unaltered. All other uses must receive prior permission -# from Landon Curt Noll and Larry Bassel. - - -SHELL=/bin/sh -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true - -# flags for ANSI compiles +# An Historical Makefile NOTE: # -# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode, -# others such as gcc may want -ansi, others may want nothing -# at all. Adjust the CFLAGS line as needed. +# The orig.Makefile, if it exits, is the original Makefile before this IOCCC +# year directory was reworked so that entries are in separate directories. +# This also applies to any orig.ansi.mk and orig.common.mk files. # -# NOTE: Some compilers cannot optimize, or optimize some entries -# entries incorrectly. You might want need to turn on -O -# to see if your compiler can handle them. +# Several Makefiles were modified / formed in 2022, and as such it may have +# elements that are not historically compatible with way entries were built. +# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile. # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= - -# ANSI compiler +# Regarding individual entries: # -# Set CC to the name of your ANSI compiler. -#CC=cc -CC=gcc - -# winners that compile under ANSI C +# 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. # -WINNERS= dodsond1 dodsond2 horton imc ldb schnitzi shapiro smr tvr weisberg \ - westley -ALT_NAMES= dodsond2.orig shapiro.alt horton.alt gtface weisberg.alt tvr.alt - -all: $(WINNERS) $(ALT_NAMES) - -westley: westley.c - ${CC} ${CFLAGS} westley.c -DO -o westley - -weisberg: weisberg.c - ${CC} ${CFLAGS} -Dc='n*n>x?p:((m=*(b+1)),N))' \ - -De='(2<<6*sizeof(int))' \ - -Do='(8<<5*sizeof(int))' \ - -DN='((b=t+1),x+=2,x>e?exit():o' \ - -Dp='(a-t shapiro_t2.c - -shapiro_t1: shapiro.c - ${CC} ${CFLAGS} shapiro.c -o shapiro_t1 - -shapiro.alt: shapiro.alt.c - ${CC} ${CFLAGS} shapiro.alt.c -o shapiro.alt - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -horton: horton.c - ${CC} ${CFLAGS} horton.c -o horton - -# Here are some programs related to the horton entry. See horton.hint -# for details. +# 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. # -horton.alt: horton.alt.c - ${CC} ${CFLAGS} horton.alt.c -o horton.alt -gtface: gtface.c - ${CC} ${CFLAGS} gtface.c -o gtface - -ldb: ldb.c - ${CC} ${CFLAGS} ldb.c -o ldb - -imc: imc.c - ${CC} ${CFLAGS} imc.c -o imc - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 - -# NOTE: this is the original (gziped) file that won +# 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: # -dodsond2.orig: dodsond2.gz - @${RM} -f dodsond2.orig.c - -${GUNZIP} < dodsond2.gz > dodsond2.orig.c - -@if [ -s dodsond2.orig.c ]; then \ - echo "${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig"; \ - ${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig; \ - else \ - ${RM} -f dodsond2.orig.c; \ - echo "sorry, we could not gunzip dodsond2.gz"; \ - fi +# https://github.com/ioccc-src/winner +# +################################################################################ -dodsond2.gz: dodsond2.gz.uu - @${RM} -f dodsond2.gz - ${UUDECODE} dodsond2.gz.uu +# 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/ -dodsond1: dodsond1.c - ${CC} ${CFLAGS} dodsond1.c -o dodsond1 -clean: - $(RM) -f *.o a.out core +############################# +# shell used by this Makefile +############################# +# +SHELL= bash -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - ${RM} -f dodsond2.orig.c dodsond2.gz shapiro_t2.c shapiro_t1 +####################### +# common tool locations +####################### +# +A2P= a2p +AR= ar +ASA= asa +AT= at +ATQ= atq +ATRM= atrm +AWK= awk +BANNER= banner +BASE64= base64 +BASENAME= basename +BATCH= batch +BC= bc +BINHEX= binhex +BISON= bison +BUNZIP2= bunzip2 +BZCAT= bzcat +BZCMP= bzcmp +BZDIFF= bzdiff +BZEGREP= bzegrep +BZFGREP= bzfgrep +BZGREP= bzgrep +BZIP2= bzip2 +BZLESS= bzless +BZMORE= bzmore +C2PH= c2ph +C89= c89 +C99= c99 +CAL= cal +CALC= calc +CAT= cat +CD= cd +CHFLAGS= chflags +CHGRP= chgrp +CHMOD= chmod +CKSUM= cksum +CLANG= clang +CLANG_PLUSPLUS= clang++ +CLEAR= clear +CMP= cmp +COL= col +COLLDEF= colldef +COLRM= colrm +COLUMN= column +COMPRESS= compress +CP= cp +CPIO= cpio +CPP= cpp +CRC32= crc32 +CSH= csh +CSPLIT= csplit +CURL= curl +CUT= cut +C_PLUSPLUS= c++ +C_PLUSPLUS_FILT= c++filt +DATE= date +DC= dc +DD= dd +DF= df +DIFF3= diff3 +DIFF= diff +DIG= dig +DIRNAME= dirname +ED= ed +EGREP= egrep +ENV= env +EQN= eqn +ETAGS= etags +EXPECT= expect +EXPR= expr +FALSE= false +FGREP= fgrep +FILE= file +FIND2PERL= find2perl +FIND= find +FLEX= flex +FLEX_PLUSPLUS= flex++ +FMT= fmt +FOLD= fold +FS_USAGE= fs_usage +FUNZIP= funzip +FUSER= fuser +GCC= gcc +GDIFFMK= gdiffmk +GENCAT= gencat +GENSTRINGS= genstrings +GETOPT= getopt +GETOPTS= getopts +GINDENT= gindent +GNUMAKE= gnumake +GREP= grep +GROFF= groff +GROFFER= groffer +GROG= grog +GROPS= grops +GROTTY= grotty +GUNZIP= gunzip +GVIM= gvim +GZCAT= gzcat +GZEXE= gzexe +GZIP_PROG= gzip +G_PLUSPLUS= g++ +H2PH= h2ph +H2XS= h2xs +HASH= hash +HEAD= head +HOSTNAME_PROG= hostname +ICONV= iconv +ID= id +INDENT= indent +INFO= info +JOT= jot +KILL= kill +KSH= ksh +LAST= last +LD= ld +LESSECHO= lessecho +LEX= len +LINK= link +LN= ln +LS= ls +M4= m4 +MAKE= make +MAN= man +MKDIR= mkdir +MKFIFO= mkfifo +MKTEMP= mktemp +MV= mv +NANO= nano +NASM= nasm +NEQN= neqn +NICE= nice +NL= nl +NM= nm +NOHUP= nohup +NROFF= nroff +NSLOOKUP= nslookup +OD= od +OPENSSL= openssl +PASTE= paste +PATCH= patch +PATHCHK= pathchk +PAX= pax +PERL= perl +PICO= pico +PR= pr +PRINTENV= printenv +PS= ps +PTAR= ptar +PTARDIFF= ptardiff +PTARGREP= ptargrep +PWD= pwd +PYDOC= pydoc +PYTHON= python +PYTHONW= pythonw +READLINK= readlink +RENICE= renice +RESET= reset +REV= rev +RI= ri +RM= rm +RMDIR= rmdir +RSYNC= rsync +RUBY= ruby +RVIM= rvim +SAY= say +SCP= scp +SCREEN= screen +SCRIPT= script +SDIFF= sdiff +SED= sed +SEQ= seq +SFTP= sftp +SH= sh +SHA1= sha1 +SHA= sha +SHAR= shar +SHASUM5_18= shasum5.18 +SHASUM= shasum +SIZE= size +SLEEP= sleep +SORT= sort +SSH= ssh +STAT= stat +STRIP= strip +STTY= stty +SUM= sum +SYNC= sync +TABS= tabs +TAIL= tail +TAR= tar +TEE= tee +TEST= test +TFTP= tftp +TIDY= tidy +TIME= time +TOP= top +TOUCH= touch +TPUT= tout +TPUT= tput +TR= tr +TROFF= troff +TRUE= true +TSET= tset +TSORT= tsort +UL= ul +UNAME= uname +UNCOMPRESS= uncompress +UNEXPAND= unexpand +UNIFDEF= unifdef +UNIFDEFALL= unifdefall +UNIQ= uniq +UNITS= units +UNLINK= unlink +UNZIP= unzip +UNZIPSFX= unzipsfx +UPTIME= uptime +UUDECODE= uudecode +UUENCODE= uuencode +UUIDGEN= uuidgen +VI= vi +VIEW= view +VIM= vim +VIMDIFF= vimdiff +W= w +WAIT4PATH= wait4path +WAIT= wait +WC= wc +WGET= wget +WHAT= what +WHATIS= whatis +WHICH= which +WHO= who +WHOAMI= whoami +WHOIS= whois +WRTIE= write +XAR= xar +XARGS= xargs +XATTR= xattr +XXD= xxd +YACC= yacc +YES= yes +ZCAT= zcat +ZCMP= zcmp +ZDIFF= zdiff +ZEGREP= zegrep +ZFGREP= zfgrep +ZFORCE= zforce +ZGREP= zgrep +ZIP= zip +ZIPCLOAK= zipcloak +ZIPGREP= zipgrep +ZIPINFO= zipinfo +ZIPNOTE= zipnote +ZIPSPLIT= zipsplit +ZLESS= zless +ZMORE= zmore +ZNEW= znew +ZPRINT= zprint +ZSH= zsh -nuke: clobber +# Set X11_LIBDIR to the directory where the X11 library resides +# +#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/X11/include +X11_INCDIR= /opt/X11/include + +# Common C compiler warnings to silence +# +#CSILENCE= +CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-shift-op-parentheses + +# 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=gnu90 + +# Compiler bit architecture +# +# Some entries require 32-bitness: +# ARCH= -m32 +# +# Some entries require 64-bitness: +# ARCH= -m64 +# +# By default we assume nothing: +# +ARCH= + +# 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} +#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 + +# 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 + +# 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= -L ${HOMEBREW_PREFIX}/lib -lSDL + +# C compiler to use +# +CC= cc +#CC=clang +#CC=gcc + +# Compiler add-ons or replacements for clang only +# +ifeq ($(CC),clang) +# +CSILENCE+= -Wno-conditional-uninitialized -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 + + +############################## +# Special flags for this entry +############################## +# +ENTRY= shapiro +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= shapiro.info +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= + + +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}_t2.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +${PROG}_t2.c: ${PROG}_t1 + ${RM} -f $@ + ./${PROG}_t1 > $@ + +${PROG}_t1: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + ${RM} -f ${PROG}_t2.c ${PROG}_t1 + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +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 + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + 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: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + 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 --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + 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/1994/shapiro/README.md b/1994/shapiro/README.md index f612c88b2..a057af031 100644 --- a/1994/shapiro/README.md +++ b/1994/shapiro/README.md @@ -1,4 +1,4 @@ -Most Well Rounded Obfuscation: +# Most Well Rounded Obfuscation: Andrew T. Shapiro CSES/CIRES University of Colorado @@ -6,13 +6,16 @@ Most Well Rounded Obfuscation: Boulder, CO 80309-0216 USA +## To build: -Judges' comments: + make all + +### To run - To use: - make shapiro ./shapiro & +## Judges' comments + This entry has many different levels of obfuscation, and yet the source file is self documenting. :-) @@ -21,8 +24,7 @@ Judges' comments: See shapiro.info for more information in the internals of this program. The file shapiro.alt contains a non-obfuscated version of this program. - -Selected notes from the author: +## Author's comments The basic theme (pun) of this program is: diff --git a/1994/smr/Makefile b/1994/smr/Makefile index 964287422..3381d4d31 100644 --- a/1994/smr/Makefile +++ b/1994/smr/Makefile @@ -1,157 +1,595 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1994 makefile +# IOCCC 1994 winning entry - smr + +################################################################################ # -# Copyright (c) 1994, Landon Curt Noll & Larry Bassel. -# All Rights Reserved. Permission for personal, educational or non-profit -# use is granted provided this this copyright and notice are included in its -# entirety and remains unaltered. All other uses must receive prior permission -# from Landon Curt Noll and Larry Bassel. - - -SHELL=/bin/sh -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true - -# flags for ANSI compiles +# An Historical Makefile NOTE: # -# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode, -# others such as gcc may want -ansi, others may want nothing -# at all. Adjust the CFLAGS line as needed. +# The orig.Makefile, if it exits, is the original Makefile before this IOCCC +# year directory was reworked so that entries are in separate directories. +# This also applies to any orig.ansi.mk and orig.common.mk files. # -# NOTE: Some compilers cannot optimize, or optimize some entries -# entries incorrectly. You might want need to turn on -O -# to see if your compiler can handle them. +# Several Makefiles were modified / formed in 2022, and as such it may have +# elements that are not historically compatible with way entries were built. +# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile. # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= - -# ANSI compiler +# Regarding individual entries: # -# Set CC to the name of your ANSI compiler. -#CC=cc -CC=gcc - -# winners that compile under ANSI C +# 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. # -WINNERS= dodsond1 dodsond2 horton imc ldb schnitzi shapiro smr tvr weisberg \ - westley -ALT_NAMES= dodsond2.orig shapiro.alt horton.alt gtface weisberg.alt tvr.alt - -all: $(WINNERS) $(ALT_NAMES) - -westley: westley.c - ${CC} ${CFLAGS} westley.c -DO -o westley - -weisberg: weisberg.c - ${CC} ${CFLAGS} -Dc='n*n>x?p:((m=*(b+1)),N))' \ - -De='(2<<6*sizeof(int))' \ - -Do='(8<<5*sizeof(int))' \ - -DN='((b=t+1),x+=2,x>e?exit():o' \ - -Dp='(a-t shapiro_t2.c - -shapiro_t1: shapiro.c - ${CC} ${CFLAGS} shapiro.c -o shapiro_t1 - -shapiro.alt: shapiro.alt.c - ${CC} ${CFLAGS} shapiro.alt.c -o shapiro.alt - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -horton: horton.c - ${CC} ${CFLAGS} horton.c -o horton - -# Here are some programs related to the horton entry. See horton.hint -# for details. +# 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. # -horton.alt: horton.alt.c - ${CC} ${CFLAGS} horton.alt.c -o horton.alt -gtface: gtface.c - ${CC} ${CFLAGS} gtface.c -o gtface - -ldb: ldb.c - ${CC} ${CFLAGS} ldb.c -o ldb - -imc: imc.c - ${CC} ${CFLAGS} imc.c -o imc - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 - -# NOTE: this is the original (gziped) file that won +# 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: # -dodsond2.orig: dodsond2.gz - @${RM} -f dodsond2.orig.c - -${GUNZIP} < dodsond2.gz > dodsond2.orig.c - -@if [ -s dodsond2.orig.c ]; then \ - echo "${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig"; \ - ${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig; \ - else \ - ${RM} -f dodsond2.orig.c; \ - echo "sorry, we could not gunzip dodsond2.gz"; \ - fi +# https://github.com/ioccc-src/winner +# +################################################################################ -dodsond2.gz: dodsond2.gz.uu - @${RM} -f dodsond2.gz - ${UUDECODE} dodsond2.gz.uu +# 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/ -dodsond1: dodsond1.c - ${CC} ${CFLAGS} dodsond1.c -o dodsond1 -clean: - $(RM) -f *.o a.out core +############################# +# shell used by this Makefile +############################# +# +SHELL= bash -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - ${RM} -f dodsond2.orig.c dodsond2.gz shapiro_t2.c shapiro_t1 +####################### +# common tool locations +####################### +# +A2P= a2p +AR= ar +ASA= asa +AT= at +ATQ= atq +ATRM= atrm +AWK= awk +BANNER= banner +BASE64= base64 +BASENAME= basename +BATCH= batch +BC= bc +BINHEX= binhex +BISON= bison +BUNZIP2= bunzip2 +BZCAT= bzcat +BZCMP= bzcmp +BZDIFF= bzdiff +BZEGREP= bzegrep +BZFGREP= bzfgrep +BZGREP= bzgrep +BZIP2= bzip2 +BZLESS= bzless +BZMORE= bzmore +C2PH= c2ph +C89= c89 +C99= c99 +CAL= cal +CALC= calc +CAT= cat +CD= cd +CHFLAGS= chflags +CHGRP= chgrp +CHMOD= chmod +CKSUM= cksum +CLANG= clang +CLANG_PLUSPLUS= clang++ +CLEAR= clear +CMP= cmp +COL= col +COLLDEF= colldef +COLRM= colrm +COLUMN= column +COMPRESS= compress +CP= cp +CPIO= cpio +CPP= cpp +CRC32= crc32 +CSH= csh +CSPLIT= csplit +CURL= curl +CUT= cut +C_PLUSPLUS= c++ +C_PLUSPLUS_FILT= c++filt +DATE= date +DC= dc +DD= dd +DF= df +DIFF3= diff3 +DIFF= diff +DIG= dig +DIRNAME= dirname +ED= ed +EGREP= egrep +ENV= env +EQN= eqn +ETAGS= etags +EXPECT= expect +EXPR= expr +FALSE= false +FGREP= fgrep +FILE= file +FIND2PERL= find2perl +FIND= find +FLEX= flex +FLEX_PLUSPLUS= flex++ +FMT= fmt +FOLD= fold +FS_USAGE= fs_usage +FUNZIP= funzip +FUSER= fuser +GCC= gcc +GDIFFMK= gdiffmk +GENCAT= gencat +GENSTRINGS= genstrings +GETOPT= getopt +GETOPTS= getopts +GINDENT= gindent +GNUMAKE= gnumake +GREP= grep +GROFF= groff +GROFFER= groffer +GROG= grog +GROPS= grops +GROTTY= grotty +GUNZIP= gunzip +GVIM= gvim +GZCAT= gzcat +GZEXE= gzexe +GZIP_PROG= gzip +G_PLUSPLUS= g++ +H2PH= h2ph +H2XS= h2xs +HASH= hash +HEAD= head +HOSTNAME_PROG= hostname +ICONV= iconv +ID= id +INDENT= indent +INFO= info +JOT= jot +KILL= kill +KSH= ksh +LAST= last +LD= ld +LESSECHO= lessecho +LEX= len +LINK= link +LN= ln +LS= ls +M4= m4 +MAKE= make +MAN= man +MKDIR= mkdir +MKFIFO= mkfifo +MKTEMP= mktemp +MV= mv +NANO= nano +NASM= nasm +NEQN= neqn +NICE= nice +NL= nl +NM= nm +NOHUP= nohup +NROFF= nroff +NSLOOKUP= nslookup +OD= od +OPENSSL= openssl +PASTE= paste +PATCH= patch +PATHCHK= pathchk +PAX= pax +PERL= perl +PICO= pico +PR= pr +PRINTENV= printenv +PS= ps +PTAR= ptar +PTARDIFF= ptardiff +PTARGREP= ptargrep +PWD= pwd +PYDOC= pydoc +PYTHON= python +PYTHONW= pythonw +READLINK= readlink +RENICE= renice +RESET= reset +REV= rev +RI= ri +RM= rm +RMDIR= rmdir +RSYNC= rsync +RUBY= ruby +RVIM= rvim +SAY= say +SCP= scp +SCREEN= screen +SCRIPT= script +SDIFF= sdiff +SED= sed +SEQ= seq +SFTP= sftp +SH= sh +SHA1= sha1 +SHA= sha +SHAR= shar +SHASUM5_18= shasum5.18 +SHASUM= shasum +SIZE= size +SLEEP= sleep +SORT= sort +SSH= ssh +STAT= stat +STRIP= strip +STTY= stty +SUM= sum +SYNC= sync +TABS= tabs +TAIL= tail +TAR= tar +TEE= tee +TEST= test +TFTP= tftp +TIDY= tidy +TIME= time +TOP= top +TOUCH= touch +TPUT= tout +TPUT= tput +TR= tr +TROFF= troff +TRUE= true +TSET= tset +TSORT= tsort +UL= ul +UNAME= uname +UNCOMPRESS= uncompress +UNEXPAND= unexpand +UNIFDEF= unifdef +UNIFDEFALL= unifdefall +UNIQ= uniq +UNITS= units +UNLINK= unlink +UNZIP= unzip +UNZIPSFX= unzipsfx +UPTIME= uptime +UUDECODE= uudecode +UUENCODE= uuencode +UUIDGEN= uuidgen +VI= vi +VIEW= view +VIM= vim +VIMDIFF= vimdiff +W= w +WAIT4PATH= wait4path +WAIT= wait +WC= wc +WGET= wget +WHAT= what +WHATIS= whatis +WHICH= which +WHO= who +WHOAMI= whoami +WHOIS= whois +WRTIE= write +XAR= xar +XARGS= xargs +XATTR= xattr +XXD= xxd +YACC= yacc +YES= yes +ZCAT= zcat +ZCMP= zcmp +ZDIFF= zdiff +ZEGREP= zegrep +ZFGREP= zfgrep +ZFORCE= zforce +ZGREP= zgrep +ZIP= zip +ZIPCLOAK= zipcloak +ZIPGREP= zipgrep +ZIPINFO= zipinfo +ZIPNOTE= zipnote +ZIPSPLIT= zipsplit +ZLESS= zless +ZMORE= zmore +ZNEW= znew +ZPRINT= zprint +ZSH= zsh -nuke: clobber +# Set X11_LIBDIR to the directory where the X11 library resides +# +#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/X11/include +X11_INCDIR= /opt/X11/include + +# Common C compiler warnings to silence +# +CSILENCE= +#CSILENCE= -Wno-implicit-int + +# 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=gnu90 + +# Compiler bit architecture +# +# Some entries require 32-bitness: +# ARCH= -m32 +# +# Some entries require 64-bitness: +# ARCH= -m64 +# +# By default we assume nothing: +# +ARCH= + +# 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} +#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 + +# 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 + +# 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= -L ${HOMEBREW_PREFIX}/lib -lSDL + +# C compiler to use +# +CC= cc +#CC=clang +#CC=gcc + +# Compiler add-ons or replacements for clang only +# +ifeq ($(CC),clang) +# +#CSILENCE+= +# +CWARN+= -Weverything +# +endif + +# Specific add-ons or replacements for gcc only +# +ifeq ($(CC),gcc) +# +#CSILENCE+= +# +#CWARN+= +# +endif + + +############################## +# Special flags for this entry +############################## +# +ENTRY= smr +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= + + +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${RM} -f $@ + ${CP} $< $@ + ${CHMOD} +x $@ + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +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 + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + 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: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + 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 --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + 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/1994/smr/README.md b/1994/smr/README.md index 51c536625..b610a9447 100644 --- a/1994/smr/README.md +++ b/1994/smr/README.md @@ -1,4 +1,4 @@ -Worst Abuse of the Rules: +# Worst Abuse of the Rules: Szymon Rusinkiewicz Massachusetts Institute of Technology @@ -6,13 +6,16 @@ Worst Abuse of the Rules: Cambridge, Ma 02139 USA +## To build: -Judges' comments: + make all + +### To run - To use: - make smr ./smr +## Judges' comments + Nearly every year, one or more people would submit what they claimed was the world's smallest self reproducing program. While the sizes of these submissions varied, a quick glance would reveal that they @@ -30,8 +33,7 @@ Judges' comments: this sort of program from contest. After all, how many variations can one make on this entry? :-) - -Selected notes from the author: +## Author's comments The world's smallest self-replicating program. Guaranteed. Produces a listing of itself on stdout. diff --git a/1994/tvr/.gitignore b/1994/tvr/.gitignore index c681d6557..925bd5602 100644 --- a/1994/tvr/.gitignore +++ b/1994/tvr/.gitignore @@ -1 +1,2 @@ tvr +tvr.alt diff --git a/1994/tvr/Makefile b/1994/tvr/Makefile index 964287422..3dd0acb02 100644 --- a/1994/tvr/Makefile +++ b/1994/tvr/Makefile @@ -1,157 +1,601 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1994 makefile +# IOCCC 1994 winning entry - tvr + +################################################################################ # -# Copyright (c) 1994, Landon Curt Noll & Larry Bassel. -# All Rights Reserved. Permission for personal, educational or non-profit -# use is granted provided this this copyright and notice are included in its -# entirety and remains unaltered. All other uses must receive prior permission -# from Landon Curt Noll and Larry Bassel. - - -SHELL=/bin/sh -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true - -# flags for ANSI compiles +# An Historical Makefile NOTE: # -# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode, -# others such as gcc may want -ansi, others may want nothing -# at all. Adjust the CFLAGS line as needed. +# The orig.Makefile, if it exits, is the original Makefile before this IOCCC +# year directory was reworked so that entries are in separate directories. +# This also applies to any orig.ansi.mk and orig.common.mk files. # -# NOTE: Some compilers cannot optimize, or optimize some entries -# entries incorrectly. You might want need to turn on -O -# to see if your compiler can handle them. +# Several Makefiles were modified / formed in 2022, and as such it may have +# elements that are not historically compatible with way entries were built. +# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile. # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= - -# ANSI compiler +# Regarding individual entries: # -# Set CC to the name of your ANSI compiler. -#CC=cc -CC=gcc - -# winners that compile under ANSI C +# 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. # -WINNERS= dodsond1 dodsond2 horton imc ldb schnitzi shapiro smr tvr weisberg \ - westley -ALT_NAMES= dodsond2.orig shapiro.alt horton.alt gtface weisberg.alt tvr.alt - -all: $(WINNERS) $(ALT_NAMES) - -westley: westley.c - ${CC} ${CFLAGS} westley.c -DO -o westley - -weisberg: weisberg.c - ${CC} ${CFLAGS} -Dc='n*n>x?p:((m=*(b+1)),N))' \ - -De='(2<<6*sizeof(int))' \ - -Do='(8<<5*sizeof(int))' \ - -DN='((b=t+1),x+=2,x>e?exit():o' \ - -Dp='(a-t shapiro_t2.c - -shapiro_t1: shapiro.c - ${CC} ${CFLAGS} shapiro.c -o shapiro_t1 - -shapiro.alt: shapiro.alt.c - ${CC} ${CFLAGS} shapiro.alt.c -o shapiro.alt - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -horton: horton.c - ${CC} ${CFLAGS} horton.c -o horton - -# Here are some programs related to the horton entry. See horton.hint -# for details. +# 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. # -horton.alt: horton.alt.c - ${CC} ${CFLAGS} horton.alt.c -o horton.alt -gtface: gtface.c - ${CC} ${CFLAGS} gtface.c -o gtface - -ldb: ldb.c - ${CC} ${CFLAGS} ldb.c -o ldb - -imc: imc.c - ${CC} ${CFLAGS} imc.c -o imc - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 - -# NOTE: this is the original (gziped) file that won +# 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: # -dodsond2.orig: dodsond2.gz - @${RM} -f dodsond2.orig.c - -${GUNZIP} < dodsond2.gz > dodsond2.orig.c - -@if [ -s dodsond2.orig.c ]; then \ - echo "${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig"; \ - ${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig; \ - else \ - ${RM} -f dodsond2.orig.c; \ - echo "sorry, we could not gunzip dodsond2.gz"; \ - fi +# https://github.com/ioccc-src/winner +# +################################################################################ -dodsond2.gz: dodsond2.gz.uu - @${RM} -f dodsond2.gz - ${UUDECODE} dodsond2.gz.uu +# 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/ -dodsond1: dodsond1.c - ${CC} ${CFLAGS} dodsond1.c -o dodsond1 -clean: - $(RM) -f *.o a.out core +############################# +# shell used by this Makefile +############################# +# +SHELL= bash -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - ${RM} -f dodsond2.orig.c dodsond2.gz shapiro_t2.c shapiro_t1 +####################### +# common tool locations +####################### +# +A2P= a2p +AR= ar +ASA= asa +AT= at +ATQ= atq +ATRM= atrm +AWK= awk +BANNER= banner +BASE64= base64 +BASENAME= basename +BATCH= batch +BC= bc +BINHEX= binhex +BISON= bison +BUNZIP2= bunzip2 +BZCAT= bzcat +BZCMP= bzcmp +BZDIFF= bzdiff +BZEGREP= bzegrep +BZFGREP= bzfgrep +BZGREP= bzgrep +BZIP2= bzip2 +BZLESS= bzless +BZMORE= bzmore +C2PH= c2ph +C89= c89 +C99= c99 +CAL= cal +CALC= calc +CAT= cat +CD= cd +CHFLAGS= chflags +CHGRP= chgrp +CHMOD= chmod +CKSUM= cksum +CLANG= clang +CLANG_PLUSPLUS= clang++ +CLEAR= clear +CMP= cmp +COL= col +COLLDEF= colldef +COLRM= colrm +COLUMN= column +COMPRESS= compress +CP= cp +CPIO= cpio +CPP= cpp +CRC32= crc32 +CSH= csh +CSPLIT= csplit +CURL= curl +CUT= cut +C_PLUSPLUS= c++ +C_PLUSPLUS_FILT= c++filt +DATE= date +DC= dc +DD= dd +DF= df +DIFF3= diff3 +DIFF= diff +DIG= dig +DIRNAME= dirname +ED= ed +EGREP= egrep +ENV= env +EQN= eqn +ETAGS= etags +EXPECT= expect +EXPR= expr +FALSE= false +FGREP= fgrep +FILE= file +FIND2PERL= find2perl +FIND= find +FLEX= flex +FLEX_PLUSPLUS= flex++ +FMT= fmt +FOLD= fold +FS_USAGE= fs_usage +FUNZIP= funzip +FUSER= fuser +GCC= gcc +GDIFFMK= gdiffmk +GENCAT= gencat +GENSTRINGS= genstrings +GETOPT= getopt +GETOPTS= getopts +GINDENT= gindent +GNUMAKE= gnumake +GREP= grep +GROFF= groff +GROFFER= groffer +GROG= grog +GROPS= grops +GROTTY= grotty +GUNZIP= gunzip +GVIM= gvim +GZCAT= gzcat +GZEXE= gzexe +GZIP_PROG= gzip +G_PLUSPLUS= g++ +H2PH= h2ph +H2XS= h2xs +HASH= hash +HEAD= head +HOSTNAME_PROG= hostname +ICONV= iconv +ID= id +INDENT= indent +INFO= info +JOT= jot +KILL= kill +KSH= ksh +LAST= last +LD= ld +LESSECHO= lessecho +LEX= len +LINK= link +LN= ln +LS= ls +M4= m4 +MAKE= make +MAN= man +MKDIR= mkdir +MKFIFO= mkfifo +MKTEMP= mktemp +MV= mv +NANO= nano +NASM= nasm +NEQN= neqn +NICE= nice +NL= nl +NM= nm +NOHUP= nohup +NROFF= nroff +NSLOOKUP= nslookup +OD= od +OPENSSL= openssl +PASTE= paste +PATCH= patch +PATHCHK= pathchk +PAX= pax +PERL= perl +PICO= pico +PR= pr +PRINTENV= printenv +PS= ps +PTAR= ptar +PTARDIFF= ptardiff +PTARGREP= ptargrep +PWD= pwd +PYDOC= pydoc +PYTHON= python +PYTHONW= pythonw +READLINK= readlink +RENICE= renice +RESET= reset +REV= rev +RI= ri +RM= rm +RMDIR= rmdir +RSYNC= rsync +RUBY= ruby +RVIM= rvim +SAY= say +SCP= scp +SCREEN= screen +SCRIPT= script +SDIFF= sdiff +SED= sed +SEQ= seq +SFTP= sftp +SH= sh +SHA1= sha1 +SHA= sha +SHAR= shar +SHASUM5_18= shasum5.18 +SHASUM= shasum +SIZE= size +SLEEP= sleep +SORT= sort +SSH= ssh +STAT= stat +STRIP= strip +STTY= stty +SUM= sum +SYNC= sync +TABS= tabs +TAIL= tail +TAR= tar +TEE= tee +TEST= test +TFTP= tftp +TIDY= tidy +TIME= time +TOP= top +TOUCH= touch +TPUT= tout +TPUT= tput +TR= tr +TROFF= troff +TRUE= true +TSET= tset +TSORT= tsort +UL= ul +UNAME= uname +UNCOMPRESS= uncompress +UNEXPAND= unexpand +UNIFDEF= unifdef +UNIFDEFALL= unifdefall +UNIQ= uniq +UNITS= units +UNLINK= unlink +UNZIP= unzip +UNZIPSFX= unzipsfx +UPTIME= uptime +UUDECODE= uudecode +UUENCODE= uuencode +UUIDGEN= uuidgen +VI= vi +VIEW= view +VIM= vim +VIMDIFF= vimdiff +W= w +WAIT4PATH= wait4path +WAIT= wait +WC= wc +WGET= wget +WHAT= what +WHATIS= whatis +WHICH= which +WHO= who +WHOAMI= whoami +WHOIS= whois +WRTIE= write +XAR= xar +XARGS= xargs +XATTR= xattr +XXD= xxd +YACC= yacc +YES= yes +ZCAT= zcat +ZCMP= zcmp +ZDIFF= zdiff +ZEGREP= zegrep +ZFGREP= zfgrep +ZFORCE= zforce +ZGREP= zgrep +ZIP= zip +ZIPCLOAK= zipcloak +ZIPGREP= zipgrep +ZIPINFO= zipinfo +ZIPNOTE= zipnote +ZIPSPLIT= zipsplit +ZLESS= zless +ZMORE= zmore +ZNEW= znew +ZPRINT= zprint +ZSH= zsh -nuke: clobber +# Set X11_LIBDIR to the directory where the X11 library resides +# +#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/X11/include +X11_INCDIR= /opt/X11/include + +# Common C compiler warnings to silence +# +#CSILENCE= +CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-main-return-type \ + -Wno-sign-compare -Wno-string-plus-int -Wno-unsequenced -Wno-unused-variable \ + -Wno-incompatible-pointer-types + +# 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=gnu90 + +# Compiler bit architecture +# +# Some entries require 32-bitness: +# ARCH= -m32 +# +# Some entries require 64-bitness: +# ARCH= -m64 +# +# By default we assume nothing: +# +ARCH= + +# 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} +#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 + +# 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 + +# 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= -L ${HOMEBREW_PREFIX}/lib -lSDL + +# C compiler to use +# +CC= cc +#CC=clang +#CC=gcc + +# Compiler add-ons or replacements for clang only +# +ifeq ($(CC),clang) +# +CSILENCE+= -Wno-comma -Wno-conditional-uninitialized -Wno-implicit-int-conversion \ + -Wno-missing-prototypes -Wno-missing-variable-declarations \ + -Wno-poison-system-directories -Wno-shadow -Wno-shorten-64-to-32 \ + -Wno-sign-conversion -Wno-strict-prototypes +# +CWARN+= -Weverything +# +endif + +# Specific add-ons or replacements for gcc only +# +ifeq ($(CC),gcc) +# +#CSILENCE+= +# +#CWARN+= +# +endif + + +############################## +# Special flags for this entry +############################## +# +ENTRY= tvr +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= tvr.bw tvr.color +TARGET= ${PROG} +# +ALT_OBJ= ${PROG}.alt.o +ALT_TARGET= ${PROG}.alt + + +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +${PROG}.alt: ${PROG}.alt.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +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 + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + 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: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + 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 --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + 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/1994/tvr/README.md b/1994/tvr/README.md index f1cbc22cc..e939208f2 100644 --- a/1994/tvr/README.md +++ b/1994/tvr/README.md @@ -1,4 +1,4 @@ -Best X11 Program: +# Best X11 Program: Teemu Rantanen Helsinki University of Technology @@ -6,13 +6,16 @@ Best X11 Program: 00210 Helsinki Finland +## To build: -Judges' comments: + make all + +### To run - To use: - make tvr ./tvr mode screensize/2 < colormapfile +## Judges' comments + Try: ./tvr 0 128 < tvr.color (for color displays) ./tvr 0 128 < tvr.bw (for Black & White displays) @@ -36,9 +39,7 @@ Judges' comments: where altmode 1-4 correspond to mode 0-3 in the original entry and altmode 0 calculates Mandelbrot/Julian sets correctly. - -Selected notes from the author: - +## Author's comments Interactive Fractals for X Window System diff --git a/1994/tvr/tvr.alt.c b/1994/tvr/tvr.alt.c index 048d7fb72..8996541f0 100644 --- a/1994/tvr/tvr.alt.c +++ b/1994/tvr/tvr.alt.c @@ -125,8 +125,9 @@ U () } } _ -main (b i, d * W) +main (b i, char *W_arg[]) { + d * W = W_arg; o; if (i > 2) { diff --git a/1994/tvr/tvr.c b/1994/tvr/tvr.c index f3c7797fb..5c82447a1 100644 --- a/1994/tvr/tvr.c +++ b/1994/tvr/tvr.c @@ -77,8 +77,8 @@ V -> y * n - l) : ( O = - 42 ) ) XNextEvent ( q , r - = V ) ; } } _ main ( b X , d * W ) { b H, F - ,G; c R; if ( X < 3 ) { puts( "tvr: mode size < cmap" + = V ) ; } } _ main ( b X , char *Wa[]) { d*W=Wa; + b H, F ,G; c R; if ( X < 3 ) { puts( "tvr: mode size < cmap" ); exit(0);} P(); I(*++ W); w = y %12; I(*++ W); n = y *2; j = n * n ; P ( ) ; m = y ; l = j / 2 + m ; q=XOpenDisplay ( 0 ) ; Q ( 0 ) diff --git a/1994/weisberg/.gitignore b/1994/weisberg/.gitignore index 59d69f5d6..114557979 100644 --- a/1994/weisberg/.gitignore +++ b/1994/weisberg/.gitignore @@ -1 +1,2 @@ weisberg +weisberg.alt diff --git a/1994/weisberg/Makefile b/1994/weisberg/Makefile index 964287422..7082d9900 100644 --- a/1994/weisberg/Makefile +++ b/1994/weisberg/Makefile @@ -1,157 +1,603 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1994 makefile +# IOCCC 1994 winning entry - weisberg + +################################################################################ # -# Copyright (c) 1994, Landon Curt Noll & Larry Bassel. -# All Rights Reserved. Permission for personal, educational or non-profit -# use is granted provided this this copyright and notice are included in its -# entirety and remains unaltered. All other uses must receive prior permission -# from Landon Curt Noll and Larry Bassel. - - -SHELL=/bin/sh -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true - -# flags for ANSI compiles +# An Historical Makefile NOTE: # -# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode, -# others such as gcc may want -ansi, others may want nothing -# at all. Adjust the CFLAGS line as needed. +# The orig.Makefile, if it exits, is the original Makefile before this IOCCC +# year directory was reworked so that entries are in separate directories. +# This also applies to any orig.ansi.mk and orig.common.mk files. # -# NOTE: Some compilers cannot optimize, or optimize some entries -# entries incorrectly. You might want need to turn on -O -# to see if your compiler can handle them. +# Several Makefiles were modified / formed in 2022, and as such it may have +# elements that are not historically compatible with way entries were built. +# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile. # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= - -# ANSI compiler +# Regarding individual entries: # -# Set CC to the name of your ANSI compiler. -#CC=cc -CC=gcc - -# winners that compile under ANSI C +# 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. # -WINNERS= dodsond1 dodsond2 horton imc ldb schnitzi shapiro smr tvr weisberg \ - westley -ALT_NAMES= dodsond2.orig shapiro.alt horton.alt gtface weisberg.alt tvr.alt - -all: $(WINNERS) $(ALT_NAMES) - -westley: westley.c - ${CC} ${CFLAGS} westley.c -DO -o westley - -weisberg: weisberg.c - ${CC} ${CFLAGS} -Dc='n*n>x?p:((m=*(b+1)),N))' \ - -De='(2<<6*sizeof(int))' \ - -Do='(8<<5*sizeof(int))' \ - -DN='((b=t+1),x+=2,x>e?exit():o' \ - -Dp='(a-t shapiro_t2.c - -shapiro_t1: shapiro.c - ${CC} ${CFLAGS} shapiro.c -o shapiro_t1 - -shapiro.alt: shapiro.alt.c - ${CC} ${CFLAGS} shapiro.alt.c -o shapiro.alt - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -horton: horton.c - ${CC} ${CFLAGS} horton.c -o horton - -# Here are some programs related to the horton entry. See horton.hint -# for details. +# 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. # -horton.alt: horton.alt.c - ${CC} ${CFLAGS} horton.alt.c -o horton.alt -gtface: gtface.c - ${CC} ${CFLAGS} gtface.c -o gtface - -ldb: ldb.c - ${CC} ${CFLAGS} ldb.c -o ldb - -imc: imc.c - ${CC} ${CFLAGS} imc.c -o imc - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 - -# NOTE: this is the original (gziped) file that won +# 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: # -dodsond2.orig: dodsond2.gz - @${RM} -f dodsond2.orig.c - -${GUNZIP} < dodsond2.gz > dodsond2.orig.c - -@if [ -s dodsond2.orig.c ]; then \ - echo "${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig"; \ - ${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig; \ - else \ - ${RM} -f dodsond2.orig.c; \ - echo "sorry, we could not gunzip dodsond2.gz"; \ - fi +# https://github.com/ioccc-src/winner +# +################################################################################ -dodsond2.gz: dodsond2.gz.uu - @${RM} -f dodsond2.gz - ${UUDECODE} dodsond2.gz.uu +# 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/ -dodsond1: dodsond1.c - ${CC} ${CFLAGS} dodsond1.c -o dodsond1 -clean: - $(RM) -f *.o a.out core +############################# +# shell used by this Makefile +############################# +# +SHELL= bash -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - ${RM} -f dodsond2.orig.c dodsond2.gz shapiro_t2.c shapiro_t1 +####################### +# common tool locations +####################### +# +A2P= a2p +AR= ar +ASA= asa +AT= at +ATQ= atq +ATRM= atrm +AWK= awk +BANNER= banner +BASE64= base64 +BASENAME= basename +BATCH= batch +BC= bc +BINHEX= binhex +BISON= bison +BUNZIP2= bunzip2 +BZCAT= bzcat +BZCMP= bzcmp +BZDIFF= bzdiff +BZEGREP= bzegrep +BZFGREP= bzfgrep +BZGREP= bzgrep +BZIP2= bzip2 +BZLESS= bzless +BZMORE= bzmore +C2PH= c2ph +C89= c89 +C99= c99 +CAL= cal +CALC= calc +CAT= cat +CD= cd +CHFLAGS= chflags +CHGRP= chgrp +CHMOD= chmod +CKSUM= cksum +CLANG= clang +CLANG_PLUSPLUS= clang++ +CLEAR= clear +CMP= cmp +COL= col +COLLDEF= colldef +COLRM= colrm +COLUMN= column +COMPRESS= compress +CP= cp +CPIO= cpio +CPP= cpp +CRC32= crc32 +CSH= csh +CSPLIT= csplit +CURL= curl +CUT= cut +C_PLUSPLUS= c++ +C_PLUSPLUS_FILT= c++filt +DATE= date +DC= dc +DD= dd +DF= df +DIFF3= diff3 +DIFF= diff +DIG= dig +DIRNAME= dirname +ED= ed +EGREP= egrep +ENV= env +EQN= eqn +ETAGS= etags +EXPECT= expect +EXPR= expr +FALSE= false +FGREP= fgrep +FILE= file +FIND2PERL= find2perl +FIND= find +FLEX= flex +FLEX_PLUSPLUS= flex++ +FMT= fmt +FOLD= fold +FS_USAGE= fs_usage +FUNZIP= funzip +FUSER= fuser +GCC= gcc +GDIFFMK= gdiffmk +GENCAT= gencat +GENSTRINGS= genstrings +GETOPT= getopt +GETOPTS= getopts +GINDENT= gindent +GNUMAKE= gnumake +GREP= grep +GROFF= groff +GROFFER= groffer +GROG= grog +GROPS= grops +GROTTY= grotty +GUNZIP= gunzip +GVIM= gvim +GZCAT= gzcat +GZEXE= gzexe +GZIP_PROG= gzip +G_PLUSPLUS= g++ +H2PH= h2ph +H2XS= h2xs +HASH= hash +HEAD= head +HOSTNAME_PROG= hostname +ICONV= iconv +ID= id +INDENT= indent +INFO= info +JOT= jot +KILL= kill +KSH= ksh +LAST= last +LD= ld +LESSECHO= lessecho +LEX= len +LINK= link +LN= ln +LS= ls +M4= m4 +MAKE= make +MAN= man +MKDIR= mkdir +MKFIFO= mkfifo +MKTEMP= mktemp +MV= mv +NANO= nano +NASM= nasm +NEQN= neqn +NICE= nice +NL= nl +NM= nm +NOHUP= nohup +NROFF= nroff +NSLOOKUP= nslookup +OD= od +OPENSSL= openssl +PASTE= paste +PATCH= patch +PATHCHK= pathchk +PAX= pax +PERL= perl +PICO= pico +PR= pr +PRINTENV= printenv +PS= ps +PTAR= ptar +PTARDIFF= ptardiff +PTARGREP= ptargrep +PWD= pwd +PYDOC= pydoc +PYTHON= python +PYTHONW= pythonw +READLINK= readlink +RENICE= renice +RESET= reset +REV= rev +RI= ri +RM= rm +RMDIR= rmdir +RSYNC= rsync +RUBY= ruby +RVIM= rvim +SAY= say +SCP= scp +SCREEN= screen +SCRIPT= script +SDIFF= sdiff +SED= sed +SEQ= seq +SFTP= sftp +SH= sh +SHA1= sha1 +SHA= sha +SHAR= shar +SHASUM5_18= shasum5.18 +SHASUM= shasum +SIZE= size +SLEEP= sleep +SORT= sort +SSH= ssh +STAT= stat +STRIP= strip +STTY= stty +SUM= sum +SYNC= sync +TABS= tabs +TAIL= tail +TAR= tar +TEE= tee +TEST= test +TFTP= tftp +TIDY= tidy +TIME= time +TOP= top +TOUCH= touch +TPUT= tout +TPUT= tput +TR= tr +TROFF= troff +TRUE= true +TSET= tset +TSORT= tsort +UL= ul +UNAME= uname +UNCOMPRESS= uncompress +UNEXPAND= unexpand +UNIFDEF= unifdef +UNIFDEFALL= unifdefall +UNIQ= uniq +UNITS= units +UNLINK= unlink +UNZIP= unzip +UNZIPSFX= unzipsfx +UPTIME= uptime +UUDECODE= uudecode +UUENCODE= uuencode +UUIDGEN= uuidgen +VI= vi +VIEW= view +VIM= vim +VIMDIFF= vimdiff +W= w +WAIT4PATH= wait4path +WAIT= wait +WC= wc +WGET= wget +WHAT= what +WHATIS= whatis +WHICH= which +WHO= who +WHOAMI= whoami +WHOIS= whois +WRTIE= write +XAR= xar +XARGS= xargs +XATTR= xattr +XXD= xxd +YACC= yacc +YES= yes +ZCAT= zcat +ZCMP= zcmp +ZDIFF= zdiff +ZEGREP= zegrep +ZFGREP= zfgrep +ZFORCE= zforce +ZGREP= zgrep +ZIP= zip +ZIPCLOAK= zipcloak +ZIPGREP= zipgrep +ZIPINFO= zipinfo +ZIPNOTE= zipnote +ZIPSPLIT= zipsplit +ZLESS= zless +ZMORE= zmore +ZNEW= znew +ZPRINT= zprint +ZSH= zsh -nuke: clobber +# Set X11_LIBDIR to the directory where the X11 library resides +# +#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/X11/include +X11_INCDIR= /opt/X11/include + +# Common C compiler warnings to silence +# +#CSILENCE= +CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-pointer-to-int-cast \ + -Wno-shift-op-parentheses + +# 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=gnu90 + +# Compiler bit architecture +# +# Some entries require 32-bitness: +# ARCH= -m32 +# +# Some entries require 64-bitness: +# ARCH= -m64 +# +# By default we assume nothing: +# +ARCH= + +# Defines that are needed to compile +# +#CDEFINE= +CDEFINE= -Dc='n*n>x?p:((m=*(b+1)),N))' \ + -DN='((b=t+1),x+=2,x>e?exit(0):o' \ + -Dp='(a-t /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${C_SMALL} ${CFLAGS} $< -o $@ ${LIBS} + +${PROG}.alt: ${PROG}.c + ${CC} ${C_LARGE} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +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 + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + 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: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + 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 --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + 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/1994/weisberg/README.md b/1994/weisberg/README.md index 67de4532c..3d3837ee0 100644 --- a/1994/weisberg/README.md +++ b/1994/weisberg/README.md @@ -1,4 +1,4 @@ -Best Short Program: +# Best Short Program: Jeff Weisberg University of Rochester @@ -7,13 +7,16 @@ Best Short Program: Rochester, NY 14627 USA +## To build: -Judges' comments: + make all + +### To run - To use: - make weisberg ./weisberg +## Judges' comments + This entry confuses some C-preprocessors and some C-beautifiers. We found one cpp that processed this source differently when it was read on stdin instead of via cc -E. @@ -28,8 +31,7 @@ Judges' comments: Lesser systems will find this alternative version a good way to create a core file. :-) - -Selected notes from the author: +## Author's comments Description: The following short program implements the "Yet Another" algorithm for diff --git a/1994/westley/Makefile b/1994/westley/Makefile index 964287422..4be6bffb4 100644 --- a/1994/westley/Makefile +++ b/1994/westley/Makefile @@ -1,157 +1,593 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1994 makefile +# IOCCC 1994 winning entry - westley + +################################################################################ # -# Copyright (c) 1994, Landon Curt Noll & Larry Bassel. -# All Rights Reserved. Permission for personal, educational or non-profit -# use is granted provided this this copyright and notice are included in its -# entirety and remains unaltered. All other uses must receive prior permission -# from Landon Curt Noll and Larry Bassel. - - -SHELL=/bin/sh -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true - -# flags for ANSI compiles +# An Historical Makefile NOTE: # -# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode, -# others such as gcc may want -ansi, others may want nothing -# at all. Adjust the CFLAGS line as needed. +# The orig.Makefile, if it exits, is the original Makefile before this IOCCC +# year directory was reworked so that entries are in separate directories. +# This also applies to any orig.ansi.mk and orig.common.mk files. # -# NOTE: Some compilers cannot optimize, or optimize some entries -# entries incorrectly. You might want need to turn on -O -# to see if your compiler can handle them. +# Several Makefiles were modified / formed in 2022, and as such it may have +# elements that are not historically compatible with way entries were built. +# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile. # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= - -# ANSI compiler +# Regarding individual entries: # -# Set CC to the name of your ANSI compiler. -#CC=cc -CC=gcc - -# winners that compile under ANSI C +# 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. # -WINNERS= dodsond1 dodsond2 horton imc ldb schnitzi shapiro smr tvr weisberg \ - westley -ALT_NAMES= dodsond2.orig shapiro.alt horton.alt gtface weisberg.alt tvr.alt - -all: $(WINNERS) $(ALT_NAMES) - -westley: westley.c - ${CC} ${CFLAGS} westley.c -DO -o westley - -weisberg: weisberg.c - ${CC} ${CFLAGS} -Dc='n*n>x?p:((m=*(b+1)),N))' \ - -De='(2<<6*sizeof(int))' \ - -Do='(8<<5*sizeof(int))' \ - -DN='((b=t+1),x+=2,x>e?exit():o' \ - -Dp='(a-t shapiro_t2.c - -shapiro_t1: shapiro.c - ${CC} ${CFLAGS} shapiro.c -o shapiro_t1 - -shapiro.alt: shapiro.alt.c - ${CC} ${CFLAGS} shapiro.alt.c -o shapiro.alt - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -horton: horton.c - ${CC} ${CFLAGS} horton.c -o horton - -# Here are some programs related to the horton entry. See horton.hint -# for details. +# 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. # -horton.alt: horton.alt.c - ${CC} ${CFLAGS} horton.alt.c -o horton.alt -gtface: gtface.c - ${CC} ${CFLAGS} gtface.c -o gtface - -ldb: ldb.c - ${CC} ${CFLAGS} ldb.c -o ldb - -imc: imc.c - ${CC} ${CFLAGS} imc.c -o imc - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 - -# NOTE: this is the original (gziped) file that won +# 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: # -dodsond2.orig: dodsond2.gz - @${RM} -f dodsond2.orig.c - -${GUNZIP} < dodsond2.gz > dodsond2.orig.c - -@if [ -s dodsond2.orig.c ]; then \ - echo "${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig"; \ - ${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig; \ - else \ - ${RM} -f dodsond2.orig.c; \ - echo "sorry, we could not gunzip dodsond2.gz"; \ - fi +# https://github.com/ioccc-src/winner +# +################################################################################ -dodsond2.gz: dodsond2.gz.uu - @${RM} -f dodsond2.gz - ${UUDECODE} dodsond2.gz.uu +# 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/ -dodsond1: dodsond1.c - ${CC} ${CFLAGS} dodsond1.c -o dodsond1 -clean: - $(RM) -f *.o a.out core +############################# +# shell used by this Makefile +############################# +# +SHELL= bash -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - ${RM} -f dodsond2.orig.c dodsond2.gz shapiro_t2.c shapiro_t1 +####################### +# common tool locations +####################### +# +A2P= a2p +AR= ar +ASA= asa +AT= at +ATQ= atq +ATRM= atrm +AWK= awk +BANNER= banner +BASE64= base64 +BASENAME= basename +BATCH= batch +BC= bc +BINHEX= binhex +BISON= bison +BUNZIP2= bunzip2 +BZCAT= bzcat +BZCMP= bzcmp +BZDIFF= bzdiff +BZEGREP= bzegrep +BZFGREP= bzfgrep +BZGREP= bzgrep +BZIP2= bzip2 +BZLESS= bzless +BZMORE= bzmore +C2PH= c2ph +C89= c89 +C99= c99 +CAL= cal +CALC= calc +CAT= cat +CD= cd +CHFLAGS= chflags +CHGRP= chgrp +CHMOD= chmod +CKSUM= cksum +CLANG= clang +CLANG_PLUSPLUS= clang++ +CLEAR= clear +CMP= cmp +COL= col +COLLDEF= colldef +COLRM= colrm +COLUMN= column +COMPRESS= compress +CP= cp +CPIO= cpio +CPP= cpp +CRC32= crc32 +CSH= csh +CSPLIT= csplit +CURL= curl +CUT= cut +C_PLUSPLUS= c++ +C_PLUSPLUS_FILT= c++filt +DATE= date +DC= dc +DD= dd +DF= df +DIFF3= diff3 +DIFF= diff +DIG= dig +DIRNAME= dirname +ED= ed +EGREP= egrep +ENV= env +EQN= eqn +ETAGS= etags +EXPECT= expect +EXPR= expr +FALSE= false +FGREP= fgrep +FILE= file +FIND2PERL= find2perl +FIND= find +FLEX= flex +FLEX_PLUSPLUS= flex++ +FMT= fmt +FOLD= fold +FS_USAGE= fs_usage +FUNZIP= funzip +FUSER= fuser +GCC= gcc +GDIFFMK= gdiffmk +GENCAT= gencat +GENSTRINGS= genstrings +GETOPT= getopt +GETOPTS= getopts +GINDENT= gindent +GNUMAKE= gnumake +GREP= grep +GROFF= groff +GROFFER= groffer +GROG= grog +GROPS= grops +GROTTY= grotty +GUNZIP= gunzip +GVIM= gvim +GZCAT= gzcat +GZEXE= gzexe +GZIP_PROG= gzip +G_PLUSPLUS= g++ +H2PH= h2ph +H2XS= h2xs +HASH= hash +HEAD= head +HOSTNAME_PROG= hostname +ICONV= iconv +ID= id +INDENT= indent +INFO= info +JOT= jot +KILL= kill +KSH= ksh +LAST= last +LD= ld +LESSECHO= lessecho +LEX= len +LINK= link +LN= ln +LS= ls +M4= m4 +MAKE= make +MAN= man +MKDIR= mkdir +MKFIFO= mkfifo +MKTEMP= mktemp +MV= mv +NANO= nano +NASM= nasm +NEQN= neqn +NICE= nice +NL= nl +NM= nm +NOHUP= nohup +NROFF= nroff +NSLOOKUP= nslookup +OD= od +OPENSSL= openssl +PASTE= paste +PATCH= patch +PATHCHK= pathchk +PAX= pax +PERL= perl +PICO= pico +PR= pr +PRINTENV= printenv +PS= ps +PTAR= ptar +PTARDIFF= ptardiff +PTARGREP= ptargrep +PWD= pwd +PYDOC= pydoc +PYTHON= python +PYTHONW= pythonw +READLINK= readlink +RENICE= renice +RESET= reset +REV= rev +RI= ri +RM= rm +RMDIR= rmdir +RSYNC= rsync +RUBY= ruby +RVIM= rvim +SAY= say +SCP= scp +SCREEN= screen +SCRIPT= script +SDIFF= sdiff +SED= sed +SEQ= seq +SFTP= sftp +SH= sh +SHA1= sha1 +SHA= sha +SHAR= shar +SHASUM5_18= shasum5.18 +SHASUM= shasum +SIZE= size +SLEEP= sleep +SORT= sort +SSH= ssh +STAT= stat +STRIP= strip +STTY= stty +SUM= sum +SYNC= sync +TABS= tabs +TAIL= tail +TAR= tar +TEE= tee +TEST= test +TFTP= tftp +TIDY= tidy +TIME= time +TOP= top +TOUCH= touch +TPUT= tout +TPUT= tput +TR= tr +TROFF= troff +TRUE= true +TSET= tset +TSORT= tsort +UL= ul +UNAME= uname +UNCOMPRESS= uncompress +UNEXPAND= unexpand +UNIFDEF= unifdef +UNIFDEFALL= unifdefall +UNIQ= uniq +UNITS= units +UNLINK= unlink +UNZIP= unzip +UNZIPSFX= unzipsfx +UPTIME= uptime +UUDECODE= uudecode +UUENCODE= uuencode +UUIDGEN= uuidgen +VI= vi +VIEW= view +VIM= vim +VIMDIFF= vimdiff +W= w +WAIT4PATH= wait4path +WAIT= wait +WC= wc +WGET= wget +WHAT= what +WHATIS= whatis +WHICH= which +WHO= who +WHOAMI= whoami +WHOIS= whois +WRTIE= write +XAR= xar +XARGS= xargs +XATTR= xattr +XXD= xxd +YACC= yacc +YES= yes +ZCAT= zcat +ZCMP= zcmp +ZDIFF= zdiff +ZEGREP= zegrep +ZFGREP= zfgrep +ZFORCE= zforce +ZGREP= zgrep +ZIP= zip +ZIPCLOAK= zipcloak +ZIPGREP= zipgrep +ZIPINFO= zipinfo +ZIPNOTE= zipnote +ZIPSPLIT= zipsplit +ZLESS= zless +ZMORE= zmore +ZNEW= znew +ZPRINT= zprint +ZSH= zsh -nuke: clobber +# Set X11_LIBDIR to the directory where the X11 library resides +# +#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/X11/include +X11_INCDIR= /opt/X11/include + +# Common C compiler warnings to silence +# +CSILENCE= +#CSILENCE= -Wno-implicit-int + +# 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=gnu90 + +# Compiler bit architecture +# +# Some entries require 32-bitness: +# ARCH= -m32 +# +# Some entries require 64-bitness: +# ARCH= -m64 +# +# By default we assume nothing: +# +ARCH= + +# 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} +#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 + +# 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 + +# 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= -L ${HOMEBREW_PREFIX}/lib -lSDL + +# C compiler to use +# +CC= cc +#CC=clang +#CC=gcc + +# Compiler add-ons or replacements for clang only +# +ifeq ($(CC),clang) +# +#CSILENCE+= +# +CWARN+= -Weverything +# +endif + +# Specific add-ons or replacements for gcc only +# +ifeq ($(CC),gcc) +# +#CSILENCE+= +# +#CWARN+= +# +endif + + +############################## +# Special flags for this entry +############################## +# +ENTRY= westley +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= + + +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + -${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +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 + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + 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: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + 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 --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + 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/1994/westley/README.md b/1994/westley/README.md index 5d8677fc4..c0f046102 100644 --- a/1994/westley/README.md +++ b/1994/westley/README.md @@ -1,4 +1,4 @@ -Worst Abuse of the C Preprocessor: +# Worst Abuse of the C Preprocessor: Brian Westley (Merlyn LeRoy on Usenet) Digi International @@ -6,13 +6,16 @@ Worst Abuse of the C Preprocessor: St. Paul, MN 55105 USA +## To build: -Judges' comments: + make all + +### To run - To use: - make westley ./westley +## Judges' comments + But for something more interesting try compiling it with different cc arguments. For example: @@ -23,8 +26,7 @@ Judges' comments: For spoilers see the end of the notes from the author below. - -Selected notes from the author: +## Author's comments This program, in accordance with the rules, compiles into a legal C program without human intervention. However, it simply compiles