From 79c7f3d1a04dc9b356cc017a3e25244201071010 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Wed, 22 Feb 2023 01:24:18 -0800 Subject: [PATCH] fix 1992 Makefiles and update README.md files --- 1992/Makefile | 2 +- 1992/adrian/.gitignore | 11 + 1992/adrian/Makefile | 799 ++++++++++++++++++++++++++++---------- 1992/adrian/README.md | 23 +- 1992/albert/Makefile | 753 +++++++++++++++++++++++++---------- 1992/albert/README.md | 16 +- 1992/ant/.gitignore | 2 + 1992/ant/Makefile | 765 ++++++++++++++++++++++++++---------- 1992/ant/README.md | 23 +- 1992/buzzard.1/.gitignore | 3 + 1992/buzzard.1/Makefile | 789 +++++++++++++++++++++++++++---------- 1992/buzzard.1/README.md | 24 +- 1992/buzzard.2/.gitignore | 1 + 1992/buzzard.2/Makefile | 760 ++++++++++++++++++++++++++---------- 1992/buzzard.2/README.md | 36 +- 1992/gson/.gitignore | 1 + 1992/gson/Makefile | 763 ++++++++++++++++++++++++++---------- 1992/gson/README.md | 39 +- 1992/imc/Makefile | 755 +++++++++++++++++++++++++---------- 1992/imc/README.md | 16 +- 1992/imc/imc.c | 3 +- 1992/kivinen/Makefile | 755 +++++++++++++++++++++++++---------- 1992/lush/Makefile | 760 ++++++++++++++++++++++++++---------- 1992/lush/README.md | 22 +- 1992/marangon/Makefile | 757 ++++++++++++++++++++++++++---------- 1992/marangon/README.md | 14 +- 1992/nathan/Makefile | 753 +++++++++++++++++++++++++---------- 1992/nathan/README.md | 17 +- 1992/vern/.gitignore | 1 + 1992/vern/Makefile | 763 ++++++++++++++++++++++++++---------- 1992/vern/README.md | 22 +- 1992/westley/Makefile | 760 ++++++++++++++++++++++++++---------- 1992/westley/README.md | 20 +- 33 files changed, 7477 insertions(+), 2751 deletions(-) diff --git a/1992/Makefile b/1992/Makefile index 3e87e677d..1aee26224 100644 --- a/1992/Makefile +++ b/1992/Makefile @@ -50,7 +50,7 @@ # tool locations ################ # -SHELL= /bin/bash +SHELL= bash MAKE= make diff --git a/1992/adrian/.gitignore b/1992/adrian/.gitignore index b1b4723da..4450cfb5f 100644 --- a/1992/adrian/.gitignore +++ b/1992/adrian/.gitignore @@ -1 +1,12 @@ +adbasename +adbasename.c +adecho +adecho.c +adgrep +adhead +adhead.c adrian +adsleep +adsleep.c +adwc +adwc.c diff --git a/1992/adrian/Makefile b/1992/adrian/Makefile index 2eb115d13..32e4c820f 100644 --- a/1992/adrian/Makefile +++ b/1992/adrian/Makefile @@ -1,244 +1,621 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1992 makefile +# IOCCC 1992 winning entry - adrian + +################################################################################ # -# Copyright (c) 1992, 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. +# An Historical Makefile NOTE: +# +# 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. +# +# 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. +# +# Regarding individual entries: +# +# IOCCC winning entry code may not work on your system. Even with standards, +# conditions and build environments change, especially when it comes to more +# extreme code such you might find in an IOCCC winner. Moreover, what was +# allowed and liked in one IOCCC contest may no longer be liked/allowed in +# later IOCCC years. +# +# Corrections on winning author and fixing typos in remarks are VERY WELCOME. +# +# GitHub pull requests are welcome: +# +# If you have a patch that might make running an entry work in modern Unix-like +# environments, please create a GitHub pull request for the IOCCC judges to +# consider. +# +# Suggestions and corrections regarding Makefiles, winning author information, +# fixing typos in remarks, and code patches are welcome via opening a GitHub +# issue or better yet, by creating a GitHub pull request for the IOCCC judges +# to consider. To form a GitHub issue or GitHub pull, please visit: +# +# https://github.com/ioccc-src/winner +# +################################################################################ + +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: +# +# Creative Commons Attribution-ShareAlike 3.0 Unported License. +# +# See: http://creativecommons.org/licenses/by-sa/3.0/ -SHELL=/bin/sh -CHMOD=chmod -CP=cp -RM=rm -SED=sed -LN=ln -UNIQ=uniq -CB=cb -GREP=grep -# set this to where your C Processor resides +############################# +# shell used by this Makefile +############################# # -# On some systems: -# CPP=/lib/cpp -# -CPP=/usr/ccs/lib/acpp +SHELL= bash -# flags for ansi compiles +####################### +# common tool locations +####################### # -# 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. -# -# 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. -# -#CFLAGS=-O -Xa -CFLAGS=-Xa -CC=cc +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 -# misc shell babble +# Set X11_LIBDIR to the directory where the X11 library resides # -NOINCLUDE=$(SED) -e 's/^.\([ ]*\)include/%include/' -SPACECLEAN=$(SED) -e 's/\([^ ]\)\([ ]\)[ ][ ]*/\1\2/g' -CPPCLEAN=$(GREP) -v '^. [0-9][0-9]*' +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib -# winners that compile under ANSI C +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -WINNERS= adrian albert ant buzzard.1 buzzard.2 gson kivinen imc \ - lush marangon nathan vern westley -ALT_NAMES= adgrep am babble first ag whereami +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include -all: $(WINNERS) $(ALT_NAMES) +# Common C compiler warnings to silence +# +#CSILENCE= +CSILENCE= -Wno-bitwise-op-parentheses -Wno-comment -Wno-deprecated-declarations \ + -Wno-error -Wno-implicit-function-declaration -Wno-format-security \ + -Wno-logical-op-parentheses -Wno-macro-redefined -Wno-parentheses \ + -Wno-return-type -Wno-uninitialized -Wno-unused-value -Wno-unused-variable \ + -Wno-unused-but-set-variable -Wno-unsequenced -Wno-unused-parameter -adrian: adrian.c - $(CC) $(CFLAGS) adrian.c -o adrian - $(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c - $(SED) '1s/\..*\./. wc ./' adrian.c > ad.temp +# 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-float-conversion -Wno-missing-noreturn \ + -Wno-missing-prototypes -Wno-missing-variable-declarations -Wno-padded \ + -Wno-poison-system-directories -Wno-shadow -Wno-unreachable-code \ + -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= adrian +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= + + +################# +# build the entry +################# +# +all: data ${TARGET} + @${TRUE} + +.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} + ${RM} -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c + ${SED} '1s/\..*\./. wc ./' adrian.c > ad.temp -./adrian ad.temp adwc.c - $(CC) -o adwc adwc.c - $(SED) '1s/\..*\./. basename ./' adrian.c > ad.temp + ${CC} ${CFLAGS} -o adwc adwc.c + ${SED} '1s/\..*\./. basename ./' adrian.c > ad.temp -./adrian ad.temp adbasename.c - $(CC) -o adbasename adbasename.c - $(SED) '1s/\..*\./. echo| ./' adrian.c > ad.temp + ${CC} ${CFLAGS} -o adbasename adbasename.c + ${SED} '1s/\..*\./. echo| ./' adrian.c > ad.temp -./adrian ad.temp adecho.c - $(CC) -o adecho adecho.c - $(SED) '1s/\..*\./. head; ./' adrian.c > ad.temp + ${CC} ${CFLAGS} -o adecho adecho.c + ${SED} '1s/\..*\./. head; ./' adrian.c > ad.temp -./adrian ad.temp adhead.c - $(CC) -o adhead adhead.c - $(SED) '1s/\..*\./. sleep ./' adrian.c > ad.temp + ${CC} ${CFLAGS} -o adhead adhead.c + ${SED} '1s/\..*\./. sleep ./' adrian.c > ad.temp -./adrian ad.temp adsleep.c - $(CC) -o adsleep adsleep.c - $(RM) -f ad.temp + ${CC} ${CFLAGS} -o adsleep adsleep.c + ${RM} -f ad.temp -# NOTE: this is the original source that won +adgrep: ${PROG} + ${RM} -f $@ + ${LN} $< $@ + +# alternative executable # -adrian.orig: adrian.orig.c - $(CC) $(CFLAGS) adrian.orig.c -o adrian.orig +alt: data ${ALT_TARGET} + @${TRUE} -albert: albert.c - $(CC) $(CFLAGS) albert.c -o albert - -# NOTE: this is the original source that won +# data files # -albert.orig: albert.orig.c - $(CC) $(CFLAGS) albert.orig.c -o albert.orig +data: ${DATA} + @${TRUE} -ant: ant.c - $(CC) $(CFLAGS) ant.c -o ant - -buzzard.1: buzzard.1.c - $(CC) $(CFLAGS) buzzard.1.c -o buzzard.1 - -babble.cppcb: buzzard.1.c - $(NOINCLUDE) buzzard.1.c | \ - $(CPP) $(CPPFLAGS) | \ - $(CPPCLEAN) | \ - $(CB) $(CBFLAGS) | \ - $(UNIQ) | \ - $(SPACECLEAN) > babble.cppcb 2>&1 - -buzzard.2: buzzard.2.c - $(CC) $(CFLAGS) buzzard.2.c -o buzzard.2 - -# NOTE: this is the original source that won +# both all and alt # -buzzard.2.orig: buzzard.2.orig.c - $(CC) $(CFLAGS) buzzard.2.orig.c -o buzzard.2.orig +everything: all alt -gson: gson.c - $(CC) $(CFLAGS) gson.c -o gson -# NOTE: some systems may only need: +############### +# utility rules +############### # -# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 -# -kivinen: kivinen.c - $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 -lsocket -lresolv -lnsl - -# NOTE: this is the original program that won -# -# NOTE: some systems may only need: -# -# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 -# -kivinen.orig: kivinen.orig.c - $(CC) $(CFLAGS) kivinen.orig.c -o kivinen.orig -lX11 \ - -lsocket -lresolv -lnsl - -imc: imc.c - $(CC) $(CFLAGS) imc.c -o imc - -# NOTE: this is the original program that won -# -imc.orig: imc.orig.c - $(CC) $(CFLAGS) imc.orig.c -o imc.orig - -lush: lush.c - $(CC) $(CFLAGS) lush.c -o lush - -lush.again: lush.c - $(CC) $(CFLAGS) lush.c -o lush.again - $(RM) -f lush.again - -# NOTE: this is the original program that won -# -lush.orig: lush.orig.c - $(CC) $(CFLAGS) lush.orig.c -o lush.orig - -# NOTE: some systems may need: -# -# $(CC) $(CFLAGS) marangon.c -o marangon -lcurses -ltermcap -# -marangon: marangon.c - $(CC) $(CFLAGS) marangon.c -o marangon -lcurses - -# NOTE: this is the original program that won -# -# NOTE: some systems may need: -# -# $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses -ltermcap -# -marangon.orig: marangon.orig.c - $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses - -nathan: nathan.c - $(CC) $(CFLAGS) nathan.c -o nathan - -# NOTE: this is the original program that won -# -nathan.orig: nathan.orig.c - $(CC) $(CFLAGS) nathan.orig.c -o nathan.orig - -vern: vern.tmp.c - $(CC) $(CFLAGS) vern.tmp.c -o vern - -vern.tmp.c: vern.c - $(RM) -f vern.tmp.c - $(SED) vern.tmp.c - -# NOTE: this is the original program that won -# -vern.orig: vern.orig.tmp.c - $(CC) $(CFLAGS) vern.orig.tmp.c -o vern.orig - -vern.orig.tmp.c: vern.orig.c - $(RM) -f vern.orig.tmp.c - $(SED) vern.orig.tmp.c - -westley: westley.c - $(CC) $(CFLAGS) westley.c -o westley - -# alternate names for selected entries -# -adgrep: adrian - $(RM) -f adgrep - $(LN) adrian adgrep -am: ant - $(RM) -f am - $(LN) ant am -babble: buzzard.1 - $(RM) -f babble - $(LN) buzzard.1 babble -first: buzzard.2 - $(RM) -f first - $(LN) buzzard.2 first -ag: gson - $(RM) -f ag - $(LN) gson ag -whereami: westley - $(RM) -f whereami - $(LN) westley whereami - clean: - $(RM) -f *.o a.out core - $(RM) -f vern.tmp.c lush.again babble.cppcb vern.orig.tmp.c - $(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi clobber: clean - $(RM) -f $(WINNERS) a.out - $(RM) -f $(ALT_NAMES) - $(RM) -f adwc adbasename adecho adhead adsleep - $(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig - $(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi -am_clobber: clean am - $(RM) -f am.safe - $(CP) am am.safe - $(RM) -f $(WINNERS) a.out - $(RM) -f $(ALT_NAMES) - $(RM) -f adwc adbasename adecho adhead adsleep - $(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig - $(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig - $(CP) am.safe am - $(RM) -f am.safe +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} -nuke: clobber - @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 -install: all - cat $(WINNERS) > /dev/null + +################## +# 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/1992/adrian/README.md b/1992/adrian/README.md index 56ac4acc4..e57b2691a 100644 --- a/1992/adrian/README.md +++ b/1992/adrian/README.md @@ -1,4 +1,4 @@ -Most Educational: +# Most Educational: Adrian Mariano University of Washington @@ -6,25 +6,26 @@ Most Educational: Mercer Island, WA 98040 USA +## To build: -Judges' comments: + make all - To build: - make adrian +### To run - Try: - adrian adrian.grep.try < adrian.hint - - For the slow minded, try: - adsleep 32767 + ./adrian adrian.grep.try < adrian.hint + + For the slow minded, try: + + ./adsleep 32767 + +## Judges' comments Once you get past the obfuscation, you have an opportunity to learn about regular expressions and state machines. NOTE: Some compilers have had trouble optimizing this entry. - -Selected notes from the author: +## Author's comments ADrian's GREP (adgrep) diff --git a/1992/albert/Makefile b/1992/albert/Makefile index 2eb115d13..391713ff9 100644 --- a/1992/albert/Makefile +++ b/1992/albert/Makefile @@ -1,244 +1,593 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1992 makefile +# IOCCC 1992 winning entry - albert + +################################################################################ # -# Copyright (c) 1992, 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 -CHMOD=chmod -CP=cp -RM=rm -SED=sed -LN=ln -UNIQ=uniq -CB=cb -GREP=grep -# set this to where your C Processor resides +# An Historical Makefile NOTE: # -# On some systems: -# CPP=/lib/cpp +# 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. # -CPP=/usr/ccs/lib/acpp - -# flags for ansi compiles +# 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. # -# 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. +# Regarding individual entries: # -# 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. +# 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. # -#CFLAGS=-O -Xa -CFLAGS=-Xa -CC=cc - -# misc shell babble +# Corrections on winning author and fixing typos in remarks are VERY WELCOME. # -NOINCLUDE=$(SED) -e 's/^.\([ ]*\)include/%include/' -SPACECLEAN=$(SED) -e 's/\([^ ]\)\([ ]\)[ ][ ]*/\1\2/g' -CPPCLEAN=$(GREP) -v '^. [0-9][0-9]*' - -# winners that compile under ANSI C +# GitHub pull requests are welcome: # -WINNERS= adrian albert ant buzzard.1 buzzard.2 gson kivinen imc \ - lush marangon nathan vern westley -ALT_NAMES= adgrep am babble first ag whereami - -all: $(WINNERS) $(ALT_NAMES) - -adrian: adrian.c - $(CC) $(CFLAGS) adrian.c -o adrian - $(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c - $(SED) '1s/\..*\./. wc ./' adrian.c > ad.temp - -./adrian ad.temp adwc.c - $(CC) -o adwc adwc.c - $(SED) '1s/\..*\./. basename ./' adrian.c > ad.temp - -./adrian ad.temp adbasename.c - $(CC) -o adbasename adbasename.c - $(SED) '1s/\..*\./. echo| ./' adrian.c > ad.temp - -./adrian ad.temp adecho.c - $(CC) -o adecho adecho.c - $(SED) '1s/\..*\./. head; ./' adrian.c > ad.temp - -./adrian ad.temp adhead.c - $(CC) -o adhead adhead.c - $(SED) '1s/\..*\./. sleep ./' adrian.c > ad.temp - -./adrian ad.temp adsleep.c - $(CC) -o adsleep adsleep.c - $(RM) -f ad.temp - -# NOTE: this is the original source that won +# 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. # -adrian.orig: adrian.orig.c - $(CC) $(CFLAGS) adrian.orig.c -o adrian.orig - -albert: albert.c - $(CC) $(CFLAGS) albert.c -o albert - -# NOTE: this is the original source 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: # -albert.orig: albert.orig.c - $(CC) $(CFLAGS) albert.orig.c -o albert.orig - -ant: ant.c - $(CC) $(CFLAGS) ant.c -o ant - -buzzard.1: buzzard.1.c - $(CC) $(CFLAGS) buzzard.1.c -o buzzard.1 - -babble.cppcb: buzzard.1.c - $(NOINCLUDE) buzzard.1.c | \ - $(CPP) $(CPPFLAGS) | \ - $(CPPCLEAN) | \ - $(CB) $(CBFLAGS) | \ - $(UNIQ) | \ - $(SPACECLEAN) > babble.cppcb 2>&1 - -buzzard.2: buzzard.2.c - $(CC) $(CFLAGS) buzzard.2.c -o buzzard.2 - -# NOTE: this is the original source that won +# https://github.com/ioccc-src/winner # -buzzard.2.orig: buzzard.2.orig.c - $(CC) $(CFLAGS) buzzard.2.orig.c -o buzzard.2.orig +################################################################################ -gson: gson.c - $(CC) $(CFLAGS) gson.c -o gson - -# NOTE: some systems may only need: +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: # -# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 +# Creative Commons Attribution-ShareAlike 3.0 Unported License. # -kivinen: kivinen.c - $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 -lsocket -lresolv -lnsl +# See: http://creativecommons.org/licenses/by-sa/3.0/ -# NOTE: this is the original program that won + +############################# +# shell used by this Makefile +############################# # -# NOTE: some systems may only need: +SHELL= bash + +####################### +# common tool locations +####################### # -# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 +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 + +# Set X11_LIBDIR to the directory where the X11 library resides # -kivinen.orig: kivinen.orig.c - $(CC) $(CFLAGS) kivinen.orig.c -o kivinen.orig -lX11 \ - -lsocket -lresolv -lnsl +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib -imc: imc.c - $(CC) $(CFLAGS) imc.c -o imc - -# NOTE: this is the original program that won +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -imc.orig: imc.orig.c - $(CC) $(CFLAGS) imc.orig.c -o imc.orig +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include -lush: lush.c - $(CC) $(CFLAGS) lush.c -o lush - -lush.again: lush.c - $(CC) $(CFLAGS) lush.c -o lush.again - $(RM) -f lush.again - -# NOTE: this is the original program that won +# Common C compiler warnings to silence # -lush.orig: lush.orig.c - $(CC) $(CFLAGS) lush.orig.c -o lush.orig +#CSILENCE= +CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-unused-parameter -# NOTE: some systems may need: +# Common C compiler warning flags # -# $(CC) $(CFLAGS) marangon.c -o marangon -lcurses -ltermcap +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +# Compiler standard # -marangon: marangon.c - $(CC) $(CFLAGS) marangon.c -o marangon -lcurses +#CSTD= +#CSTD= -ansi +CSTD= -std=gnu90 -# NOTE: this is the original program that won +# Compiler bit architecture # -# NOTE: some systems may need: +# Some entries require 32-bitness: +# ARCH= -m32 # -# $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses -ltermcap +# Some entries require 64-bitness: +# ARCH= -m64 # -marangon.orig: marangon.orig.c - $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses - -nathan: nathan.c - $(CC) $(CFLAGS) nathan.c -o nathan - -# NOTE: this is the original program that won +# By default we assume nothing: # -nathan.orig: nathan.orig.c - $(CC) $(CFLAGS) nathan.orig.c -o nathan.orig +ARCH= -vern: vern.tmp.c - $(CC) $(CFLAGS) vern.tmp.c -o vern - -vern.tmp.c: vern.c - $(RM) -f vern.tmp.c - $(SED) vern.tmp.c - -# NOTE: this is the original program that won +# Defines that are needed to compile # -vern.orig: vern.orig.tmp.c - $(CC) $(CFLAGS) vern.orig.tmp.c -o vern.orig +CDEFINE= +#CDEFINE= -DIOCCC -vern.orig.tmp.c: vern.orig.c - $(RM) -f vern.orig.tmp.c - $(SED) vern.orig.tmp.c - -westley: westley.c - $(CC) $(CFLAGS) westley.c -o westley - -# alternate names for selected entries +# Include files that are needed to compile # -adgrep: adrian - $(RM) -f adgrep - $(LN) adrian adgrep -am: ant - $(RM) -f am - $(LN) ant am -babble: buzzard.1 - $(RM) -f babble - $(LN) buzzard.1 babble -first: buzzard.2 - $(RM) -f first - $(LN) buzzard.2 first -ag: gson - $(RM) -f ag - $(LN) gson ag -whereami: westley - $(RM) -f whereami - $(LN) westley whereami +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-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= albert +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= + + +################# +# build the entry +################# +# +all: data ${TARGET} + @${TRUE} + +.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 *.o a.out core - $(RM) -f vern.tmp.c lush.again babble.cppcb vern.orig.tmp.c - $(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi clobber: clean - $(RM) -f $(WINNERS) a.out - $(RM) -f $(ALT_NAMES) - $(RM) -f adwc adbasename adecho adhead adsleep - $(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig - $(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi -am_clobber: clean am - $(RM) -f am.safe - $(CP) am am.safe - $(RM) -f $(WINNERS) a.out - $(RM) -f $(ALT_NAMES) - $(RM) -f adwc adbasename adecho adhead adsleep - $(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig - $(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig - $(CP) am.safe am - $(RM) -f am.safe +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} -nuke: clobber - @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 -install: all - cat $(WINNERS) > /dev/null + +################## +# 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/1992/albert/README.md b/1992/albert/README.md index 68c0bd2ac..c78f16702 100644 --- a/1992/albert/README.md +++ b/1992/albert/README.md @@ -1,4 +1,4 @@ -Most Useful Program: +# Most Useful Program: Albert van der Horst S P&A R&C @@ -6,19 +6,21 @@ Most Useful Program: 3511 RA UTRECHT The Netherlands +## To build: -Judges' comments: + make all - For a canned example: - make albert - albert 1234567890123456789 +### To run + + ./albert 1234567890123456789 + +## Judges' comments We were impressed with the speed at which it was able to factor arbitrarily large numbers consisting of factors that fit into a long. - -Selected notes from the author: +## Author's comments The Obfuscated version of the Horst algorithm. diff --git a/1992/ant/.gitignore b/1992/ant/.gitignore index 59b09c9c8..67f925559 100644 --- a/1992/ant/.gitignore +++ b/1992/ant/.gitignore @@ -1 +1,3 @@ +am +am.safe ant diff --git a/1992/ant/Makefile b/1992/ant/Makefile index 2eb115d13..395157b4e 100644 --- a/1992/ant/Makefile +++ b/1992/ant/Makefile @@ -1,244 +1,607 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1992 makefile +# IOCCC 1992 winning entry - ant + +################################################################################ # -# Copyright (c) 1992, 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 -CHMOD=chmod -CP=cp -RM=rm -SED=sed -LN=ln -UNIQ=uniq -CB=cb -GREP=grep -# set this to where your C Processor resides +# An Historical Makefile NOTE: # -# On some systems: -# CPP=/lib/cpp +# 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. # -CPP=/usr/ccs/lib/acpp - -# flags for ansi compiles +# 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. # -# 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. +# Regarding individual entries: # -# 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. +# 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. # -#CFLAGS=-O -Xa -CFLAGS=-Xa -CC=cc - -# misc shell babble +# Corrections on winning author and fixing typos in remarks are VERY WELCOME. # -NOINCLUDE=$(SED) -e 's/^.\([ ]*\)include/%include/' -SPACECLEAN=$(SED) -e 's/\([^ ]\)\([ ]\)[ ][ ]*/\1\2/g' -CPPCLEAN=$(GREP) -v '^. [0-9][0-9]*' - -# winners that compile under ANSI C +# GitHub pull requests are welcome: # -WINNERS= adrian albert ant buzzard.1 buzzard.2 gson kivinen imc \ - lush marangon nathan vern westley -ALT_NAMES= adgrep am babble first ag whereami - -all: $(WINNERS) $(ALT_NAMES) - -adrian: adrian.c - $(CC) $(CFLAGS) adrian.c -o adrian - $(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c - $(SED) '1s/\..*\./. wc ./' adrian.c > ad.temp - -./adrian ad.temp adwc.c - $(CC) -o adwc adwc.c - $(SED) '1s/\..*\./. basename ./' adrian.c > ad.temp - -./adrian ad.temp adbasename.c - $(CC) -o adbasename adbasename.c - $(SED) '1s/\..*\./. echo| ./' adrian.c > ad.temp - -./adrian ad.temp adecho.c - $(CC) -o adecho adecho.c - $(SED) '1s/\..*\./. head; ./' adrian.c > ad.temp - -./adrian ad.temp adhead.c - $(CC) -o adhead adhead.c - $(SED) '1s/\..*\./. sleep ./' adrian.c > ad.temp - -./adrian ad.temp adsleep.c - $(CC) -o adsleep adsleep.c - $(RM) -f ad.temp - -# NOTE: this is the original source that won +# 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. # -adrian.orig: adrian.orig.c - $(CC) $(CFLAGS) adrian.orig.c -o adrian.orig - -albert: albert.c - $(CC) $(CFLAGS) albert.c -o albert - -# NOTE: this is the original source 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: # -albert.orig: albert.orig.c - $(CC) $(CFLAGS) albert.orig.c -o albert.orig - -ant: ant.c - $(CC) $(CFLAGS) ant.c -o ant - -buzzard.1: buzzard.1.c - $(CC) $(CFLAGS) buzzard.1.c -o buzzard.1 - -babble.cppcb: buzzard.1.c - $(NOINCLUDE) buzzard.1.c | \ - $(CPP) $(CPPFLAGS) | \ - $(CPPCLEAN) | \ - $(CB) $(CBFLAGS) | \ - $(UNIQ) | \ - $(SPACECLEAN) > babble.cppcb 2>&1 - -buzzard.2: buzzard.2.c - $(CC) $(CFLAGS) buzzard.2.c -o buzzard.2 - -# NOTE: this is the original source that won +# https://github.com/ioccc-src/winner # -buzzard.2.orig: buzzard.2.orig.c - $(CC) $(CFLAGS) buzzard.2.orig.c -o buzzard.2.orig +################################################################################ -gson: gson.c - $(CC) $(CFLAGS) gson.c -o gson - -# NOTE: some systems may only need: +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: # -# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 +# Creative Commons Attribution-ShareAlike 3.0 Unported License. # -kivinen: kivinen.c - $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 -lsocket -lresolv -lnsl +# See: http://creativecommons.org/licenses/by-sa/3.0/ -# NOTE: this is the original program that won + +############################# +# shell used by this Makefile +############################# # -# NOTE: some systems may only need: +SHELL= bash + +####################### +# common tool locations +####################### # -# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 +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 + +# Set X11_LIBDIR to the directory where the X11 library resides # -kivinen.orig: kivinen.orig.c - $(CC) $(CFLAGS) kivinen.orig.c -o kivinen.orig -lX11 \ - -lsocket -lresolv -lnsl +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib -imc: imc.c - $(CC) $(CFLAGS) imc.c -o imc - -# NOTE: this is the original program that won +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -imc.orig: imc.orig.c - $(CC) $(CFLAGS) imc.orig.c -o imc.orig +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include -lush: lush.c - $(CC) $(CFLAGS) lush.c -o lush - -lush.again: lush.c - $(CC) $(CFLAGS) lush.c -o lush.again - $(RM) -f lush.again - -# NOTE: this is the original program that won +# Common C compiler warnings to silence # -lush.orig: lush.orig.c - $(CC) $(CFLAGS) lush.orig.c -o lush.orig +#CSILENCE= +CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-unsequenced -# NOTE: some systems may need: +# Common C compiler warning flags # -# $(CC) $(CFLAGS) marangon.c -o marangon -lcurses -ltermcap +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +# Compiler standard # -marangon: marangon.c - $(CC) $(CFLAGS) marangon.c -o marangon -lcurses +#CSTD= +#CSTD= -ansi +CSTD= -std=gnu90 -# NOTE: this is the original program that won +# Compiler bit architecture # -# NOTE: some systems may need: +# Some entries require 32-bitness: +# ARCH= -m32 # -# $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses -ltermcap +# Some entries require 64-bitness: +# ARCH= -m64 # -marangon.orig: marangon.orig.c - $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses - -nathan: nathan.c - $(CC) $(CFLAGS) nathan.c -o nathan - -# NOTE: this is the original program that won +# By default we assume nothing: # -nathan.orig: nathan.orig.c - $(CC) $(CFLAGS) nathan.orig.c -o nathan.orig +ARCH= -vern: vern.tmp.c - $(CC) $(CFLAGS) vern.tmp.c -o vern - -vern.tmp.c: vern.c - $(RM) -f vern.tmp.c - $(SED) vern.tmp.c - -# NOTE: this is the original program that won +# Defines that are needed to compile # -vern.orig: vern.orig.tmp.c - $(CC) $(CFLAGS) vern.orig.tmp.c -o vern.orig +CDEFINE= +#CDEFINE= -DIOCCC -vern.orig.tmp.c: vern.orig.c - $(RM) -f vern.orig.tmp.c - $(SED) vern.orig.tmp.c - -westley: westley.c - $(CC) $(CFLAGS) westley.c -o westley - -# alternate names for selected entries +# Include files that are needed to compile # -adgrep: adrian - $(RM) -f adgrep - $(LN) adrian adgrep -am: ant - $(RM) -f am - $(LN) ant am -babble: buzzard.1 - $(RM) -f babble - $(LN) buzzard.1 babble -first: buzzard.2 - $(RM) -f first - $(LN) buzzard.2 first -ag: gson - $(RM) -f ag - $(LN) gson ag -whereami: westley - $(RM) -f whereami - $(LN) westley whereami +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-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= ant +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= + + +################# +# build the entry +################# +# +all: data ${TARGET} + @${TRUE} + +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + am am_clobber \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +am: ${PROG} + ${RM} -f $@ + ${LN} $< $@ + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# clean: - $(RM) -f *.o a.out core - $(RM) -f vern.tmp.c lush.again babble.cppcb vern.orig.tmp.c - $(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi clobber: clean - $(RM) -f $(WINNERS) a.out - $(RM) -f $(ALT_NAMES) - $(RM) -f adwc adbasename adecho adhead adsleep - $(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig - $(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi am_clobber: clean am - $(RM) -f am.safe - $(CP) am am.safe - $(RM) -f $(WINNERS) a.out - $(RM) -f $(ALT_NAMES) - $(RM) -f adwc adbasename adecho adhead adsleep - $(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig - $(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig - $(CP) am.safe am - $(RM) -f am.safe + ${RM} -f am.safe + ${CP} am am.safe + ${CP} am.safe am + ${RM} -f am.safe -nuke: clobber - @true +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} -install: all - cat $(WINNERS) > /dev/null +# 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/1992/ant/README.md b/1992/ant/README.md index 42c5d78f2..9c8be6cfb 100644 --- a/1992/ant/README.md +++ b/1992/ant/README.md @@ -1,4 +1,4 @@ -Best Utility: +# Best Utility: Anthony C Howe Mortice Kern Systems Inc. @@ -7,13 +7,16 @@ Best Utility: N2J 3G4 Canada +## To build: -Judges' comments: + make all + +### To run + + ./am ant.test.mk + +## Judges' comments - To use: - make am - am ant.test.mk - Like much of Posix, obfuscation has its place. Your task is to figure out where. @@ -22,12 +25,12 @@ Judges' comments: P1003 sub-committee. We also suggest that you try: + make am - am Makefile am_clobber <-- clobber everything except am - am Makefile all + ./am Makefile am_clobber # clobber everything except am + ./am Makefile all - -Selected notes from the author: +## Author's comments See the file ant.README. diff --git a/1992/buzzard.1/.gitignore b/1992/buzzard.1/.gitignore index ea60d3e25..e5ab81324 100644 --- a/1992/buzzard.1/.gitignore +++ b/1992/buzzard.1/.gitignore @@ -1 +1,4 @@ +babble +babble.cppcb buzzard.1 +tmp diff --git a/1992/buzzard.1/Makefile b/1992/buzzard.1/Makefile index 2eb115d13..3a0072612 100644 --- a/1992/buzzard.1/Makefile +++ b/1992/buzzard.1/Makefile @@ -1,244 +1,629 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1992 makefile +# IOCCC 1992 winning entry - buzzard.1 + +################################################################################ # -# Copyright (c) 1992, 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 -CHMOD=chmod -CP=cp -RM=rm -SED=sed -LN=ln -UNIQ=uniq -CB=cb -GREP=grep -# set this to where your C Processor resides +# An Historical Makefile NOTE: # -# On some systems: -# CPP=/lib/cpp +# 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. # -CPP=/usr/ccs/lib/acpp - -# flags for ansi compiles +# 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. # -# 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. +# Regarding individual entries: # -# 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. +# 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. # -#CFLAGS=-O -Xa -CFLAGS=-Xa -CC=cc - -# misc shell babble +# Corrections on winning author and fixing typos in remarks are VERY WELCOME. # -NOINCLUDE=$(SED) -e 's/^.\([ ]*\)include/%include/' -SPACECLEAN=$(SED) -e 's/\([^ ]\)\([ ]\)[ ][ ]*/\1\2/g' -CPPCLEAN=$(GREP) -v '^. [0-9][0-9]*' - -# winners that compile under ANSI C +# GitHub pull requests are welcome: # -WINNERS= adrian albert ant buzzard.1 buzzard.2 gson kivinen imc \ - lush marangon nathan vern westley -ALT_NAMES= adgrep am babble first ag whereami - -all: $(WINNERS) $(ALT_NAMES) - -adrian: adrian.c - $(CC) $(CFLAGS) adrian.c -o adrian - $(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c - $(SED) '1s/\..*\./. wc ./' adrian.c > ad.temp - -./adrian ad.temp adwc.c - $(CC) -o adwc adwc.c - $(SED) '1s/\..*\./. basename ./' adrian.c > ad.temp - -./adrian ad.temp adbasename.c - $(CC) -o adbasename adbasename.c - $(SED) '1s/\..*\./. echo| ./' adrian.c > ad.temp - -./adrian ad.temp adecho.c - $(CC) -o adecho adecho.c - $(SED) '1s/\..*\./. head; ./' adrian.c > ad.temp - -./adrian ad.temp adhead.c - $(CC) -o adhead adhead.c - $(SED) '1s/\..*\./. sleep ./' adrian.c > ad.temp - -./adrian ad.temp adsleep.c - $(CC) -o adsleep adsleep.c - $(RM) -f ad.temp - -# NOTE: this is the original source that won +# 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. # -adrian.orig: adrian.orig.c - $(CC) $(CFLAGS) adrian.orig.c -o adrian.orig - -albert: albert.c - $(CC) $(CFLAGS) albert.c -o albert - -# NOTE: this is the original source 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: # -albert.orig: albert.orig.c - $(CC) $(CFLAGS) albert.orig.c -o albert.orig - -ant: ant.c - $(CC) $(CFLAGS) ant.c -o ant - -buzzard.1: buzzard.1.c - $(CC) $(CFLAGS) buzzard.1.c -o buzzard.1 - -babble.cppcb: buzzard.1.c - $(NOINCLUDE) buzzard.1.c | \ - $(CPP) $(CPPFLAGS) | \ - $(CPPCLEAN) | \ - $(CB) $(CBFLAGS) | \ - $(UNIQ) | \ - $(SPACECLEAN) > babble.cppcb 2>&1 - -buzzard.2: buzzard.2.c - $(CC) $(CFLAGS) buzzard.2.c -o buzzard.2 - -# NOTE: this is the original source that won +# https://github.com/ioccc-src/winner # -buzzard.2.orig: buzzard.2.orig.c - $(CC) $(CFLAGS) buzzard.2.orig.c -o buzzard.2.orig +################################################################################ -gson: gson.c - $(CC) $(CFLAGS) gson.c -o gson - -# NOTE: some systems may only need: +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: # -# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 +# Creative Commons Attribution-ShareAlike 3.0 Unported License. # -kivinen: kivinen.c - $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 -lsocket -lresolv -lnsl +# See: http://creativecommons.org/licenses/by-sa/3.0/ -# NOTE: this is the original program that won + +############################# +# shell used by this Makefile +############################# # -# NOTE: some systems may only need: +SHELL= bash + +####################### +# common tool locations +####################### # -# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 +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 + +# Set X11_LIBDIR to the directory where the X11 library resides # -kivinen.orig: kivinen.orig.c - $(CC) $(CFLAGS) kivinen.orig.c -o kivinen.orig -lX11 \ - -lsocket -lresolv -lnsl +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib -imc: imc.c - $(CC) $(CFLAGS) imc.c -o imc - -# NOTE: this is the original program that won +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -imc.orig: imc.orig.c - $(CC) $(CFLAGS) imc.orig.c -o imc.orig +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include -lush: lush.c - $(CC) $(CFLAGS) lush.c -o lush - -lush.again: lush.c - $(CC) $(CFLAGS) lush.c -o lush.again - $(RM) -f lush.again - -# NOTE: this is the original program that won +# Common C compiler warnings to silence # -lush.orig: lush.orig.c - $(CC) $(CFLAGS) lush.orig.c -o lush.orig +#CSILENCE= +CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-pedantic \ + -Wno-unused-parameter -# NOTE: some systems may need: +# Common C compiler warning flags # -# $(CC) $(CFLAGS) marangon.c -o marangon -lcurses -ltermcap +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +# Compiler standard # -marangon: marangon.c - $(CC) $(CFLAGS) marangon.c -o marangon -lcurses +#CSTD= +#CSTD= -ansi +CSTD= -std=gnu90 -# NOTE: this is the original program that won +# Compiler bit architecture # -# NOTE: some systems may need: +# Some entries require 32-bitness: +# ARCH= -m32 # -# $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses -ltermcap +# Some entries require 64-bitness: +# ARCH= -m64 # -marangon.orig: marangon.orig.c - $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses - -nathan: nathan.c - $(CC) $(CFLAGS) nathan.c -o nathan - -# NOTE: this is the original program that won +# By default we assume nothing: # -nathan.orig: nathan.orig.c - $(CC) $(CFLAGS) nathan.orig.c -o nathan.orig +ARCH= -vern: vern.tmp.c - $(CC) $(CFLAGS) vern.tmp.c -o vern - -vern.tmp.c: vern.c - $(RM) -f vern.tmp.c - $(SED) vern.tmp.c - -# NOTE: this is the original program that won +# Defines that are needed to compile # -vern.orig: vern.orig.tmp.c - $(CC) $(CFLAGS) vern.orig.tmp.c -o vern.orig +CDEFINE= +#CDEFINE= -DIOCCC -vern.orig.tmp.c: vern.orig.c - $(RM) -f vern.orig.tmp.c - $(SED) vern.orig.tmp.c - -westley: westley.c - $(CC) $(CFLAGS) westley.c -o westley - -# alternate names for selected entries +# Include files that are needed to compile # -adgrep: adrian - $(RM) -f adgrep - $(LN) adrian adgrep -am: ant - $(RM) -f am - $(LN) ant am -babble: buzzard.1 - $(RM) -f babble - $(LN) buzzard.1 babble -first: buzzard.2 - $(RM) -f first - $(LN) buzzard.2 first -ag: gson - $(RM) -f ag - $(LN) gson ag -whereami: westley - $(RM) -f whereami - $(LN) westley whereami +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-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= buzzard.1 +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= + +NOINCLUDE= ${SED} -e 's/^.\([ ]*\)include/%include/' +SPACECLEAN= ${SED} -e 's/\([^ ]\)\([ ]\)[ ][ ]*/\1\2/g' +CPPCLEAN= ${GREP} -v '^. [0-9][0-9]*' + + +################# +# build the entry +################# +# +all: data ${TARGET} + @${TRUE} + +.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} + +babble.cppcb: ${PROG}.c + ${RM} -f tmp + ${NOINCLUDE} ${PROG}.c | \ + ${CPP} ${CPPFLAGS} | \ + ${CPPCLEAN} | \ + ${UNIQ} | \ + ${SPACECLEAN} > tmp 2>&1 + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < tmp > $@"; \ + ${GINDENT} < tmp > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < tmp > $@; \ + else \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${MV} -f tmpbabble.cppcb $@"; \ + ${MV} -f tmp $@; \ + fi + ${RM} -f tmp + +babble: ${PROG} + ${RM} -f $@ + ${LN} $< $@ + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# clean: - $(RM) -f *.o a.out core - $(RM) -f vern.tmp.c lush.again babble.cppcb vern.orig.tmp.c - $(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi clobber: clean - $(RM) -f $(WINNERS) a.out - $(RM) -f $(ALT_NAMES) - $(RM) -f adwc adbasename adecho adhead adsleep - $(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig - $(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig + ${RM} -f ${TARGET} ${ALT_TARGET} + ${RM} -f babble.cppcb babble + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi -am_clobber: clean am - $(RM) -f am.safe - $(CP) am am.safe - $(RM) -f $(WINNERS) a.out - $(RM) -f $(ALT_NAMES) - $(RM) -f adwc adbasename adecho adhead adsleep - $(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig - $(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig - $(CP) am.safe am - $(RM) -f am.safe +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} -nuke: clobber - @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 -install: all - cat $(WINNERS) > /dev/null + +################## +# 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/1992/buzzard.1/README.md b/1992/buzzard.1/README.md index 0160ecc2e..dc72bddc5 100644 --- a/1992/buzzard.1/README.md +++ b/1992/buzzard.1/README.md @@ -7,24 +7,26 @@ Most Obfuscated Algorithm: USA -Judges' comments: +## To build: + + make all + +### To run + + ./babble 0 10 + ./babble 56 720 + ./babble 1 521 + +## Judges' comments - To see clearly why this won an award: - make babble - - Try: - babble 0 10 - babble 56 720 - babble 1 521 - To see good C Preprocessor babble, try: + make babble.cppcb cat babble.cppcb Notice how many statements it takes to do anything useful? - -Selected notes from the author: +## Author's comments What you shouldn't think about babble: diff --git a/1992/buzzard.2/.gitignore b/1992/buzzard.2/.gitignore index d970c21aa..4daf52b2f 100644 --- a/1992/buzzard.2/.gitignore +++ b/1992/buzzard.2/.gitignore @@ -1 +1,2 @@ buzzard.2 +first diff --git a/1992/buzzard.2/Makefile b/1992/buzzard.2/Makefile index 2eb115d13..a56f27b6b 100644 --- a/1992/buzzard.2/Makefile +++ b/1992/buzzard.2/Makefile @@ -1,244 +1,600 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1992 makefile +# IOCCC 1992 winning entry - buzzard.2 + +################################################################################ # -# Copyright (c) 1992, 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 -CHMOD=chmod -CP=cp -RM=rm -SED=sed -LN=ln -UNIQ=uniq -CB=cb -GREP=grep -# set this to where your C Processor resides +# An Historical Makefile NOTE: # -# On some systems: -# CPP=/lib/cpp +# 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. # -CPP=/usr/ccs/lib/acpp - -# flags for ansi compiles +# 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. # -# 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. +# Regarding individual entries: # -# 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. +# 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. # -#CFLAGS=-O -Xa -CFLAGS=-Xa -CC=cc - -# misc shell babble +# Corrections on winning author and fixing typos in remarks are VERY WELCOME. # -NOINCLUDE=$(SED) -e 's/^.\([ ]*\)include/%include/' -SPACECLEAN=$(SED) -e 's/\([^ ]\)\([ ]\)[ ][ ]*/\1\2/g' -CPPCLEAN=$(GREP) -v '^. [0-9][0-9]*' - -# winners that compile under ANSI C +# GitHub pull requests are welcome: # -WINNERS= adrian albert ant buzzard.1 buzzard.2 gson kivinen imc \ - lush marangon nathan vern westley -ALT_NAMES= adgrep am babble first ag whereami - -all: $(WINNERS) $(ALT_NAMES) - -adrian: adrian.c - $(CC) $(CFLAGS) adrian.c -o adrian - $(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c - $(SED) '1s/\..*\./. wc ./' adrian.c > ad.temp - -./adrian ad.temp adwc.c - $(CC) -o adwc adwc.c - $(SED) '1s/\..*\./. basename ./' adrian.c > ad.temp - -./adrian ad.temp adbasename.c - $(CC) -o adbasename adbasename.c - $(SED) '1s/\..*\./. echo| ./' adrian.c > ad.temp - -./adrian ad.temp adecho.c - $(CC) -o adecho adecho.c - $(SED) '1s/\..*\./. head; ./' adrian.c > ad.temp - -./adrian ad.temp adhead.c - $(CC) -o adhead adhead.c - $(SED) '1s/\..*\./. sleep ./' adrian.c > ad.temp - -./adrian ad.temp adsleep.c - $(CC) -o adsleep adsleep.c - $(RM) -f ad.temp - -# NOTE: this is the original source that won +# 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. # -adrian.orig: adrian.orig.c - $(CC) $(CFLAGS) adrian.orig.c -o adrian.orig - -albert: albert.c - $(CC) $(CFLAGS) albert.c -o albert - -# NOTE: this is the original source 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: # -albert.orig: albert.orig.c - $(CC) $(CFLAGS) albert.orig.c -o albert.orig - -ant: ant.c - $(CC) $(CFLAGS) ant.c -o ant - -buzzard.1: buzzard.1.c - $(CC) $(CFLAGS) buzzard.1.c -o buzzard.1 - -babble.cppcb: buzzard.1.c - $(NOINCLUDE) buzzard.1.c | \ - $(CPP) $(CPPFLAGS) | \ - $(CPPCLEAN) | \ - $(CB) $(CBFLAGS) | \ - $(UNIQ) | \ - $(SPACECLEAN) > babble.cppcb 2>&1 - -buzzard.2: buzzard.2.c - $(CC) $(CFLAGS) buzzard.2.c -o buzzard.2 - -# NOTE: this is the original source that won +# https://github.com/ioccc-src/winner # -buzzard.2.orig: buzzard.2.orig.c - $(CC) $(CFLAGS) buzzard.2.orig.c -o buzzard.2.orig +################################################################################ -gson: gson.c - $(CC) $(CFLAGS) gson.c -o gson - -# NOTE: some systems may only need: +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: # -# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 +# Creative Commons Attribution-ShareAlike 3.0 Unported License. # -kivinen: kivinen.c - $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 -lsocket -lresolv -lnsl +# See: http://creativecommons.org/licenses/by-sa/3.0/ -# NOTE: this is the original program that won + +############################# +# shell used by this Makefile +############################# # -# NOTE: some systems may only need: +SHELL= bash + +####################### +# common tool locations +####################### # -# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 +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 + +# Set X11_LIBDIR to the directory where the X11 library resides # -kivinen.orig: kivinen.orig.c - $(CC) $(CFLAGS) kivinen.orig.c -o kivinen.orig -lX11 \ - -lsocket -lresolv -lnsl +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib -imc: imc.c - $(CC) $(CFLAGS) imc.c -o imc - -# NOTE: this is the original program that won +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -imc.orig: imc.orig.c - $(CC) $(CFLAGS) imc.orig.c -o imc.orig +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include -lush: lush.c - $(CC) $(CFLAGS) lush.c -o lush - -lush.again: lush.c - $(CC) $(CFLAGS) lush.c -o lush.again - $(RM) -f lush.again - -# NOTE: this is the original program that won +# Common C compiler warnings to silence # -lush.orig: lush.orig.c - $(CC) $(CFLAGS) lush.orig.c -o lush.orig +#CSILENCE= +CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-pedantic \ + -Wno-return-type -# NOTE: some systems may need: +# Common C compiler warning flags # -# $(CC) $(CFLAGS) marangon.c -o marangon -lcurses -ltermcap +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +# Compiler standard # -marangon: marangon.c - $(CC) $(CFLAGS) marangon.c -o marangon -lcurses +#CSTD= +#CSTD= -ansi +CSTD= -std=gnu90 -# NOTE: this is the original program that won +# Compiler bit architecture # -# NOTE: some systems may need: +# Some entries require 32-bitness: +# ARCH= -m32 # -# $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses -ltermcap +# Some entries require 64-bitness: +# ARCH= -m64 # -marangon.orig: marangon.orig.c - $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses - -nathan: nathan.c - $(CC) $(CFLAGS) nathan.c -o nathan - -# NOTE: this is the original program that won +# By default we assume nothing: # -nathan.orig: nathan.orig.c - $(CC) $(CFLAGS) nathan.orig.c -o nathan.orig +ARCH= -vern: vern.tmp.c - $(CC) $(CFLAGS) vern.tmp.c -o vern - -vern.tmp.c: vern.c - $(RM) -f vern.tmp.c - $(SED) vern.tmp.c - -# NOTE: this is the original program that won +# Defines that are needed to compile # -vern.orig: vern.orig.tmp.c - $(CC) $(CFLAGS) vern.orig.tmp.c -o vern.orig +CDEFINE= +#CDEFINE= -DIOCCC -vern.orig.tmp.c: vern.orig.c - $(RM) -f vern.orig.tmp.c - $(SED) vern.orig.tmp.c - -westley: westley.c - $(CC) $(CFLAGS) westley.c -o westley - -# alternate names for selected entries +# Include files that are needed to compile # -adgrep: adrian - $(RM) -f adgrep - $(LN) adrian adgrep -am: ant - $(RM) -f am - $(LN) ant am -babble: buzzard.1 - $(RM) -f babble - $(LN) buzzard.1 babble -first: buzzard.2 - $(RM) -f first - $(LN) buzzard.2 first -ag: gson - $(RM) -f ag - $(LN) gson ag -whereami: westley - $(RM) -f whereami - $(LN) westley whereami +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-missing-prototypes -Wno-missing-variable-declarations \ + -Wno-poison-system-directories -Wno-strict-prototypes -Wno-unreachable-code +# +CWARN+= -Weverything +# +endif + +# Specific add-ons or replacements for gcc only +# +ifeq ($(CC),gcc) +# +#CSILENCE+= +# +#CWARN+= +# +endif + + +############################## +# Special flags for this entry +############################## +# +ENTRY= buzzard.2 +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= + + +################# +# build the entry +################# +# +all: data ${TARGET} + @${TRUE} + +.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} + +first: ${PROG} + ${RM} -f $@ + ${LN} $< $@ + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# clean: - $(RM) -f *.o a.out core - $(RM) -f vern.tmp.c lush.again babble.cppcb vern.orig.tmp.c - $(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi clobber: clean - $(RM) -f $(WINNERS) a.out - $(RM) -f $(ALT_NAMES) - $(RM) -f adwc adbasename adecho adhead adsleep - $(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig - $(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig + ${RM} -f ${TARGET} ${ALT_TARGET} + ${RM} -f first + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi -am_clobber: clean am - $(RM) -f am.safe - $(CP) am am.safe - $(RM) -f $(WINNERS) a.out - $(RM) -f $(ALT_NAMES) - $(RM) -f adwc adbasename adecho adhead adsleep - $(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig - $(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig - $(CP) am.safe am - $(RM) -f am.safe +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} -nuke: clobber - @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 -install: all - cat $(WINNERS) > /dev/null + +################## +# 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/1992/buzzard.2/README.md b/1992/buzzard.2/README.md index b0fe22b04..8fb6cf9f3 100644 --- a/1992/buzzard.2/README.md +++ b/1992/buzzard.2/README.md @@ -1,4 +1,4 @@ -Best Language Tool: +# Best Language Tool: Sean Barrett Software Construction Company @@ -6,27 +6,37 @@ Best Language Tool: College Station, TX 77840 USA +## To build: -Judges' comments: + make all + +### To run First: - make first - - Second: - echo help | cat third help.th - | first - cat third demo5.th | first - - Third: - cat third help.th - | first - Wait until Ok is printed and the type: + make first + + Second: + + echo help | cat third help.th - | ./first + cat third demo5.th | ./first + + Third: + + cat third help.th - | ./first + + NOTE: Wait until Ok is printed and the type: 2 3 + . cr <-- yes you should really type the 2 letters: cr Forth: + Sorry, this is third! +## Judges' comments -Selected notes from the author: + Have fun! + +## Author's comments What it does: @@ -116,7 +126,7 @@ Selected notes from the author: it also obfuscates the code. (Unfortunately, the top of stack is a global variable and neither gcc nor most bundled compilers seem to register allocate it.) - + More significant are the design obfuscations. m[0] is the "dictionary pointer", used when compiling words, and m[1] is the return stack index. Both are used as integer offsets into diff --git a/1992/gson/.gitignore b/1992/gson/.gitignore index 17752ddd6..0c62d5021 100644 --- a/1992/gson/.gitignore +++ b/1992/gson/.gitignore @@ -1 +1,2 @@ gson +og diff --git a/1992/gson/Makefile b/1992/gson/Makefile index 2eb115d13..794e49dbc 100644 --- a/1992/gson/Makefile +++ b/1992/gson/Makefile @@ -1,244 +1,603 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1992 makefile +# IOCCC 1992 winning entry - gson + +################################################################################ # -# Copyright (c) 1992, 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 -CHMOD=chmod -CP=cp -RM=rm -SED=sed -LN=ln -UNIQ=uniq -CB=cb -GREP=grep -# set this to where your C Processor resides +# An Historical Makefile NOTE: # -# On some systems: -# CPP=/lib/cpp +# 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. # -CPP=/usr/ccs/lib/acpp - -# flags for ansi compiles +# 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. # -# 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. +# Regarding individual entries: # -# 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. +# 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. # -#CFLAGS=-O -Xa -CFLAGS=-Xa -CC=cc - -# misc shell babble +# Corrections on winning author and fixing typos in remarks are VERY WELCOME. # -NOINCLUDE=$(SED) -e 's/^.\([ ]*\)include/%include/' -SPACECLEAN=$(SED) -e 's/\([^ ]\)\([ ]\)[ ][ ]*/\1\2/g' -CPPCLEAN=$(GREP) -v '^. [0-9][0-9]*' - -# winners that compile under ANSI C +# GitHub pull requests are welcome: # -WINNERS= adrian albert ant buzzard.1 buzzard.2 gson kivinen imc \ - lush marangon nathan vern westley -ALT_NAMES= adgrep am babble first ag whereami - -all: $(WINNERS) $(ALT_NAMES) - -adrian: adrian.c - $(CC) $(CFLAGS) adrian.c -o adrian - $(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c - $(SED) '1s/\..*\./. wc ./' adrian.c > ad.temp - -./adrian ad.temp adwc.c - $(CC) -o adwc adwc.c - $(SED) '1s/\..*\./. basename ./' adrian.c > ad.temp - -./adrian ad.temp adbasename.c - $(CC) -o adbasename adbasename.c - $(SED) '1s/\..*\./. echo| ./' adrian.c > ad.temp - -./adrian ad.temp adecho.c - $(CC) -o adecho adecho.c - $(SED) '1s/\..*\./. head; ./' adrian.c > ad.temp - -./adrian ad.temp adhead.c - $(CC) -o adhead adhead.c - $(SED) '1s/\..*\./. sleep ./' adrian.c > ad.temp - -./adrian ad.temp adsleep.c - $(CC) -o adsleep adsleep.c - $(RM) -f ad.temp - -# NOTE: this is the original source that won +# 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. # -adrian.orig: adrian.orig.c - $(CC) $(CFLAGS) adrian.orig.c -o adrian.orig - -albert: albert.c - $(CC) $(CFLAGS) albert.c -o albert - -# NOTE: this is the original source 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: # -albert.orig: albert.orig.c - $(CC) $(CFLAGS) albert.orig.c -o albert.orig - -ant: ant.c - $(CC) $(CFLAGS) ant.c -o ant - -buzzard.1: buzzard.1.c - $(CC) $(CFLAGS) buzzard.1.c -o buzzard.1 - -babble.cppcb: buzzard.1.c - $(NOINCLUDE) buzzard.1.c | \ - $(CPP) $(CPPFLAGS) | \ - $(CPPCLEAN) | \ - $(CB) $(CBFLAGS) | \ - $(UNIQ) | \ - $(SPACECLEAN) > babble.cppcb 2>&1 - -buzzard.2: buzzard.2.c - $(CC) $(CFLAGS) buzzard.2.c -o buzzard.2 - -# NOTE: this is the original source that won +# https://github.com/ioccc-src/winner # -buzzard.2.orig: buzzard.2.orig.c - $(CC) $(CFLAGS) buzzard.2.orig.c -o buzzard.2.orig +################################################################################ -gson: gson.c - $(CC) $(CFLAGS) gson.c -o gson - -# NOTE: some systems may only need: +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: # -# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 +# Creative Commons Attribution-ShareAlike 3.0 Unported License. # -kivinen: kivinen.c - $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 -lsocket -lresolv -lnsl +# See: http://creativecommons.org/licenses/by-sa/3.0/ -# NOTE: this is the original program that won + +############################# +# shell used by this Makefile +############################# # -# NOTE: some systems may only need: +SHELL= bash + +####################### +# common tool locations +####################### # -# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 +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 + +# Set X11_LIBDIR to the directory where the X11 library resides # -kivinen.orig: kivinen.orig.c - $(CC) $(CFLAGS) kivinen.orig.c -o kivinen.orig -lX11 \ - -lsocket -lresolv -lnsl +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib -imc: imc.c - $(CC) $(CFLAGS) imc.c -o imc - -# NOTE: this is the original program that won +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -imc.orig: imc.orig.c - $(CC) $(CFLAGS) imc.orig.c -o imc.orig +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include -lush: lush.c - $(CC) $(CFLAGS) lush.c -o lush - -lush.again: lush.c - $(CC) $(CFLAGS) lush.c -o lush.again - $(RM) -f lush.again - -# NOTE: this is the original program that won +# Common C compiler warnings to silence # -lush.orig: lush.orig.c - $(CC) $(CFLAGS) lush.orig.c -o lush.orig +#CSILENCE= +CSILENCE= -Wno-bitwise-op-parentheses -Wno-char-subscripts \ + -Wno-deprecated-declarations -Wno-empty-body -Wno-error \ + -Wno-implicit-function-declaration -Wno-parentheses -Wno-pedantic \ + -Wno-return-type -Wno-unused-parameter -Wno-unused-value -# NOTE: some systems may need: +# Common C compiler warning flags # -# $(CC) $(CFLAGS) marangon.c -o marangon -lcurses -ltermcap +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +# Compiler standard # -marangon: marangon.c - $(CC) $(CFLAGS) marangon.c -o marangon -lcurses +#CSTD= +#CSTD= -ansi +CSTD= -std=gnu90 -# NOTE: this is the original program that won +# Compiler bit architecture # -# NOTE: some systems may need: +# Some entries require 32-bitness: +# ARCH= -m32 # -# $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses -ltermcap +# Some entries require 64-bitness: +# ARCH= -m64 # -marangon.orig: marangon.orig.c - $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses - -nathan: nathan.c - $(CC) $(CFLAGS) nathan.c -o nathan - -# NOTE: this is the original program that won +# By default we assume nothing: # -nathan.orig: nathan.orig.c - $(CC) $(CFLAGS) nathan.orig.c -o nathan.orig +ARCH= -vern: vern.tmp.c - $(CC) $(CFLAGS) vern.tmp.c -o vern - -vern.tmp.c: vern.c - $(RM) -f vern.tmp.c - $(SED) vern.tmp.c - -# NOTE: this is the original program that won +# Defines that are needed to compile # -vern.orig: vern.orig.tmp.c - $(CC) $(CFLAGS) vern.orig.tmp.c -o vern.orig +CDEFINE= +#CDEFINE= -DIOCCC -vern.orig.tmp.c: vern.orig.c - $(RM) -f vern.orig.tmp.c - $(SED) vern.orig.tmp.c - -westley: westley.c - $(CC) $(CFLAGS) westley.c -o westley - -# alternate names for selected entries +# Include files that are needed to compile # -adgrep: adrian - $(RM) -f adgrep - $(LN) adrian adgrep -am: ant - $(RM) -f am - $(LN) ant am -babble: buzzard.1 - $(RM) -f babble - $(LN) buzzard.1 babble -first: buzzard.2 - $(RM) -f first - $(LN) buzzard.2 first -ag: gson - $(RM) -f ag - $(LN) gson ag -whereami: westley - $(RM) -f whereami - $(LN) westley whereami +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-implicit-int-conversion -Wno-missing-prototypes \ + -Wno-missing-variable-declarations -Wno-poison-system-directories \ + -Wno-shorten-64-to-32 -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= gson +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} og +# +ALT_OBJ= +ALT_TARGET= + + +################# +# build the entry +################# +# +all: data ${TARGET} + @${TRUE} + +.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} + +og: ${PROG} + ${RM} -f $@ + ${LN} $< $@ + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# clean: - $(RM) -f *.o a.out core - $(RM) -f vern.tmp.c lush.again babble.cppcb vern.orig.tmp.c - $(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi clobber: clean - $(RM) -f $(WINNERS) a.out - $(RM) -f $(ALT_NAMES) - $(RM) -f adwc adbasename adecho adhead adsleep - $(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig - $(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig + ${RM} -f ${TARGET} ${ALT_TARGET} + ${RM} -f og + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi -am_clobber: clean am - $(RM) -f am.safe - $(CP) am am.safe - $(RM) -f $(WINNERS) a.out - $(RM) -f $(ALT_NAMES) - $(RM) -f adwc adbasename adecho adhead adsleep - $(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig - $(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig - $(CP) am.safe am - $(RM) -f am.safe +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} -nuke: clobber - @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 -install: all - cat $(WINNERS) > /dev/null + +################## +# 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/1992/gson/README.md b/1992/gson/README.md index 5063e39c8..5a4084b41 100644 --- a/1992/gson/README.md +++ b/1992/gson/README.md @@ -1,4 +1,4 @@ -Most Humorous Output: +# Most Humorous Output: Andreas Gustafsson Helsinki University of Technology @@ -6,36 +6,39 @@ Most Humorous Output: 00410 Helsinki FINLAND +## To build: -Judges' comments: + make all + +### To run + + ./og word word2 word3 < /path/to/dictionary + +## Judges' comment - To make: - make ag - Determine where your system dictionary is located. You may find it located in one of the following places: - /usr/dict/words - /usr/share/lib/spell/words - /usr/ucblib/dict/words - /dev/null <-- for machines with nothing to say + /usr/share/dict/words + /usr/share/lib/spell/words + /usr/ucblib/dict/words + /dev/null # <-- for machines with nothing to say Then using the proper dictionary: - ag free software foundation < /usr/dict/words - ag obfuscated c contest < /usr/dict/words - ag unix international < /usr/dict/words - ag george bush < /usr/dict/words - ag bill clinton < /usr/dict/words - ag ross perot < /usr/dict/words - ag paul e tsongas < /usr/dict/words + ./ag free software foundation < /usr/share/dict/words + ./ag obfuscated c contest < /usr/share/dict/words + ./ag unix international < /usr/share/dict/words + ./ag george bush < /usr/share/dict/words + ./ag bill clinton < /usr/share/dict/words + ./ag ross perot < /usr/share/dict/words + ./ag paul e tsongas < /usr/share/dict/words Recently some newspapers printed amusing anagrams of one of the names listed above. Run this program to find the anagrams they weren't allowed to print! - -Selected notes from the author: +## Author's comments The name of the game: diff --git a/1992/imc/Makefile b/1992/imc/Makefile index 2eb115d13..050e42f06 100644 --- a/1992/imc/Makefile +++ b/1992/imc/Makefile @@ -1,244 +1,595 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1992 makefile +# IOCCC 1992 winning entry - imc + +################################################################################ # -# Copyright (c) 1992, 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 -CHMOD=chmod -CP=cp -RM=rm -SED=sed -LN=ln -UNIQ=uniq -CB=cb -GREP=grep -# set this to where your C Processor resides +# An Historical Makefile NOTE: # -# On some systems: -# CPP=/lib/cpp +# 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. # -CPP=/usr/ccs/lib/acpp - -# flags for ansi compiles +# 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. # -# 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. +# Regarding individual entries: # -# 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. +# 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. # -#CFLAGS=-O -Xa -CFLAGS=-Xa -CC=cc - -# misc shell babble +# Corrections on winning author and fixing typos in remarks are VERY WELCOME. # -NOINCLUDE=$(SED) -e 's/^.\([ ]*\)include/%include/' -SPACECLEAN=$(SED) -e 's/\([^ ]\)\([ ]\)[ ][ ]*/\1\2/g' -CPPCLEAN=$(GREP) -v '^. [0-9][0-9]*' - -# winners that compile under ANSI C +# GitHub pull requests are welcome: # -WINNERS= adrian albert ant buzzard.1 buzzard.2 gson kivinen imc \ - lush marangon nathan vern westley -ALT_NAMES= adgrep am babble first ag whereami - -all: $(WINNERS) $(ALT_NAMES) - -adrian: adrian.c - $(CC) $(CFLAGS) adrian.c -o adrian - $(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c - $(SED) '1s/\..*\./. wc ./' adrian.c > ad.temp - -./adrian ad.temp adwc.c - $(CC) -o adwc adwc.c - $(SED) '1s/\..*\./. basename ./' adrian.c > ad.temp - -./adrian ad.temp adbasename.c - $(CC) -o adbasename adbasename.c - $(SED) '1s/\..*\./. echo| ./' adrian.c > ad.temp - -./adrian ad.temp adecho.c - $(CC) -o adecho adecho.c - $(SED) '1s/\..*\./. head; ./' adrian.c > ad.temp - -./adrian ad.temp adhead.c - $(CC) -o adhead adhead.c - $(SED) '1s/\..*\./. sleep ./' adrian.c > ad.temp - -./adrian ad.temp adsleep.c - $(CC) -o adsleep adsleep.c - $(RM) -f ad.temp - -# NOTE: this is the original source that won +# 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. # -adrian.orig: adrian.orig.c - $(CC) $(CFLAGS) adrian.orig.c -o adrian.orig - -albert: albert.c - $(CC) $(CFLAGS) albert.c -o albert - -# NOTE: this is the original source 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: # -albert.orig: albert.orig.c - $(CC) $(CFLAGS) albert.orig.c -o albert.orig - -ant: ant.c - $(CC) $(CFLAGS) ant.c -o ant - -buzzard.1: buzzard.1.c - $(CC) $(CFLAGS) buzzard.1.c -o buzzard.1 - -babble.cppcb: buzzard.1.c - $(NOINCLUDE) buzzard.1.c | \ - $(CPP) $(CPPFLAGS) | \ - $(CPPCLEAN) | \ - $(CB) $(CBFLAGS) | \ - $(UNIQ) | \ - $(SPACECLEAN) > babble.cppcb 2>&1 - -buzzard.2: buzzard.2.c - $(CC) $(CFLAGS) buzzard.2.c -o buzzard.2 - -# NOTE: this is the original source that won +# https://github.com/ioccc-src/winner # -buzzard.2.orig: buzzard.2.orig.c - $(CC) $(CFLAGS) buzzard.2.orig.c -o buzzard.2.orig +################################################################################ -gson: gson.c - $(CC) $(CFLAGS) gson.c -o gson - -# NOTE: some systems may only need: +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: # -# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 +# Creative Commons Attribution-ShareAlike 3.0 Unported License. # -kivinen: kivinen.c - $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 -lsocket -lresolv -lnsl +# See: http://creativecommons.org/licenses/by-sa/3.0/ -# NOTE: this is the original program that won + +############################# +# shell used by this Makefile +############################# # -# NOTE: some systems may only need: +SHELL= bash + +####################### +# common tool locations +####################### # -# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 +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 + +# Set X11_LIBDIR to the directory where the X11 library resides # -kivinen.orig: kivinen.orig.c - $(CC) $(CFLAGS) kivinen.orig.c -o kivinen.orig -lX11 \ - -lsocket -lresolv -lnsl +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib -imc: imc.c - $(CC) $(CFLAGS) imc.c -o imc - -# NOTE: this is the original program that won +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -imc.orig: imc.orig.c - $(CC) $(CFLAGS) imc.orig.c -o imc.orig +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include -lush: lush.c - $(CC) $(CFLAGS) lush.c -o lush - -lush.again: lush.c - $(CC) $(CFLAGS) lush.c -o lush.again - $(RM) -f lush.again - -# NOTE: this is the original program that won +# Common C compiler warnings to silence # -lush.orig: lush.orig.c - $(CC) $(CFLAGS) lush.orig.c -o lush.orig +#CSILENCE= +CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-format -# NOTE: some systems may need: +# Common C compiler warning flags # -# $(CC) $(CFLAGS) marangon.c -o marangon -lcurses -ltermcap +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +# Compiler standard # -marangon: marangon.c - $(CC) $(CFLAGS) marangon.c -o marangon -lcurses +#CSTD= +#CSTD= -ansi +CSTD= -std=gnu90 -# NOTE: this is the original program that won +# Compiler bit architecture # -# NOTE: some systems may need: +# Some entries require 32-bitness: +# ARCH= -m32 # -# $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses -ltermcap +# Some entries require 64-bitness: +# ARCH= -m64 # -marangon.orig: marangon.orig.c - $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses - -nathan: nathan.c - $(CC) $(CFLAGS) nathan.c -o nathan - -# NOTE: this is the original program that won +# By default we assume nothing: # -nathan.orig: nathan.orig.c - $(CC) $(CFLAGS) nathan.orig.c -o nathan.orig +ARCH= -vern: vern.tmp.c - $(CC) $(CFLAGS) vern.tmp.c -o vern - -vern.tmp.c: vern.c - $(RM) -f vern.tmp.c - $(SED) vern.tmp.c - -# NOTE: this is the original program that won +# Defines that are needed to compile # -vern.orig: vern.orig.tmp.c - $(CC) $(CFLAGS) vern.orig.tmp.c -o vern.orig +CDEFINE= +#CDEFINE= -DIOCCC -vern.orig.tmp.c: vern.orig.c - $(RM) -f vern.orig.tmp.c - $(SED) vern.orig.tmp.c - -westley: westley.c - $(CC) $(CFLAGS) westley.c -o westley - -# alternate names for selected entries +# Include files that are needed to compile # -adgrep: adrian - $(RM) -f adgrep - $(LN) adrian adgrep -am: ant - $(RM) -f am - $(LN) ant am -babble: buzzard.1 - $(RM) -f babble - $(LN) buzzard.1 babble -first: buzzard.2 - $(RM) -f first - $(LN) buzzard.2 first -ag: gson - $(RM) -f ag - $(LN) gson ag -whereami: westley - $(RM) -f whereami - $(LN) westley whereami +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-error -Wno-implicit-function-declaration -Wno-format \ + -Wno-missing-variable-declarations -Wno-poison-system-directorie \ + -Wno-poison-system-directories -Wno-unknown-warning-option +# +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} + +.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 *.o a.out core - $(RM) -f vern.tmp.c lush.again babble.cppcb vern.orig.tmp.c - $(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi clobber: clean - $(RM) -f $(WINNERS) a.out - $(RM) -f $(ALT_NAMES) - $(RM) -f adwc adbasename adecho adhead adsleep - $(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig - $(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi -am_clobber: clean am - $(RM) -f am.safe - $(CP) am am.safe - $(RM) -f $(WINNERS) a.out - $(RM) -f $(ALT_NAMES) - $(RM) -f adwc adbasename adecho adhead adsleep - $(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig - $(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig - $(CP) am.safe am - $(RM) -f am.safe +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} -nuke: clobber - @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 -install: all - cat $(WINNERS) > /dev/null + +################## +# 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/1992/imc/README.md b/1992/imc/README.md index 23f5b4ab7..c4a534ccd 100644 --- a/1992/imc/README.md +++ b/1992/imc/README.md @@ -1,4 +1,4 @@ -Best Output: +$ Best Output: Ian Collier Oxford University @@ -8,10 +8,13 @@ Best Output: OX1 4AW ENGLAND +## To build: -Judges' comments: + make all - Make and run. +### To run + +## Judges' comments The program is more interesting to run on workstations that can make use of a Sun raster file. Others can make use of the -text @@ -19,13 +22,12 @@ Judges' comments: Of course, the source (layout) is self-documenting! :-) - NOTE: The original winning source imc.orig.c assumed that + NOTE: The original winning source assumed that exit returned a value which cause problems for some systems where exit returned a void. The file imc.c - avoids this problem. + has been modified to avoid this problem. - -Selected notes from the author: +## Author's comments Portability diff --git a/1992/imc/imc.c b/1992/imc/imc.c index b049f2c5a..078c3416e 100644 --- a/1992/imc/imc.c +++ b/1992/imc/imc.c @@ -1,5 +1,4 @@ #include -#include #define ext(a) (exit(a),0) #define I " .:\';+0x074)?( fprintf(i,a,v[q]),r):_>0152?(_/4>27?(_&1?( diff --git a/1992/kivinen/Makefile b/1992/kivinen/Makefile index 2eb115d13..d625c0708 100644 --- a/1992/kivinen/Makefile +++ b/1992/kivinen/Makefile @@ -1,244 +1,595 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1992 makefile +# IOCCC 1992 winning entry - kivinen + +################################################################################ # -# Copyright (c) 1992, 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 -CHMOD=chmod -CP=cp -RM=rm -SED=sed -LN=ln -UNIQ=uniq -CB=cb -GREP=grep -# set this to where your C Processor resides +# An Historical Makefile NOTE: # -# On some systems: -# CPP=/lib/cpp +# 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. # -CPP=/usr/ccs/lib/acpp - -# flags for ansi compiles +# 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. # -# 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. +# Regarding individual entries: # -# 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. +# 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. # -#CFLAGS=-O -Xa -CFLAGS=-Xa -CC=cc - -# misc shell babble +# Corrections on winning author and fixing typos in remarks are VERY WELCOME. # -NOINCLUDE=$(SED) -e 's/^.\([ ]*\)include/%include/' -SPACECLEAN=$(SED) -e 's/\([^ ]\)\([ ]\)[ ][ ]*/\1\2/g' -CPPCLEAN=$(GREP) -v '^. [0-9][0-9]*' - -# winners that compile under ANSI C +# GitHub pull requests are welcome: # -WINNERS= adrian albert ant buzzard.1 buzzard.2 gson kivinen imc \ - lush marangon nathan vern westley -ALT_NAMES= adgrep am babble first ag whereami - -all: $(WINNERS) $(ALT_NAMES) - -adrian: adrian.c - $(CC) $(CFLAGS) adrian.c -o adrian - $(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c - $(SED) '1s/\..*\./. wc ./' adrian.c > ad.temp - -./adrian ad.temp adwc.c - $(CC) -o adwc adwc.c - $(SED) '1s/\..*\./. basename ./' adrian.c > ad.temp - -./adrian ad.temp adbasename.c - $(CC) -o adbasename adbasename.c - $(SED) '1s/\..*\./. echo| ./' adrian.c > ad.temp - -./adrian ad.temp adecho.c - $(CC) -o adecho adecho.c - $(SED) '1s/\..*\./. head; ./' adrian.c > ad.temp - -./adrian ad.temp adhead.c - $(CC) -o adhead adhead.c - $(SED) '1s/\..*\./. sleep ./' adrian.c > ad.temp - -./adrian ad.temp adsleep.c - $(CC) -o adsleep adsleep.c - $(RM) -f ad.temp - -# NOTE: this is the original source that won +# 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. # -adrian.orig: adrian.orig.c - $(CC) $(CFLAGS) adrian.orig.c -o adrian.orig - -albert: albert.c - $(CC) $(CFLAGS) albert.c -o albert - -# NOTE: this is the original source 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: # -albert.orig: albert.orig.c - $(CC) $(CFLAGS) albert.orig.c -o albert.orig - -ant: ant.c - $(CC) $(CFLAGS) ant.c -o ant - -buzzard.1: buzzard.1.c - $(CC) $(CFLAGS) buzzard.1.c -o buzzard.1 - -babble.cppcb: buzzard.1.c - $(NOINCLUDE) buzzard.1.c | \ - $(CPP) $(CPPFLAGS) | \ - $(CPPCLEAN) | \ - $(CB) $(CBFLAGS) | \ - $(UNIQ) | \ - $(SPACECLEAN) > babble.cppcb 2>&1 - -buzzard.2: buzzard.2.c - $(CC) $(CFLAGS) buzzard.2.c -o buzzard.2 - -# NOTE: this is the original source that won +# https://github.com/ioccc-src/winner # -buzzard.2.orig: buzzard.2.orig.c - $(CC) $(CFLAGS) buzzard.2.orig.c -o buzzard.2.orig +################################################################################ -gson: gson.c - $(CC) $(CFLAGS) gson.c -o gson - -# NOTE: some systems may only need: +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: # -# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 +# Creative Commons Attribution-ShareAlike 3.0 Unported License. # -kivinen: kivinen.c - $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 -lsocket -lresolv -lnsl +# See: http://creativecommons.org/licenses/by-sa/3.0/ -# NOTE: this is the original program that won + +############################# +# shell used by this Makefile +############################# # -# NOTE: some systems may only need: +SHELL= bash + +####################### +# common tool locations +####################### # -# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 +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 + +# Set X11_LIBDIR to the directory where the X11 library resides # -kivinen.orig: kivinen.orig.c - $(CC) $(CFLAGS) kivinen.orig.c -o kivinen.orig -lX11 \ - -lsocket -lresolv -lnsl +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib -imc: imc.c - $(CC) $(CFLAGS) imc.c -o imc - -# NOTE: this is the original program that won +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -imc.orig: imc.orig.c - $(CC) $(CFLAGS) imc.orig.c -o imc.orig +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include -lush: lush.c - $(CC) $(CFLAGS) lush.c -o lush - -lush.again: lush.c - $(CC) $(CFLAGS) lush.c -o lush.again - $(RM) -f lush.again - -# NOTE: this is the original program that won +# Common C compiler warnings to silence # -lush.orig: lush.orig.c - $(CC) $(CFLAGS) lush.orig.c -o lush.orig +#CSILENCE= +CSILENCE= -Wno-bitwise-op-parentheses -Wno-error -Wno-implicit-function-declaration \ + -Wno-logical-op-parentheses -Wno-main -Wno-variadic-macros -# NOTE: some systems may need: +# Common C compiler warning flags # -# $(CC) $(CFLAGS) marangon.c -o marangon -lcurses -ltermcap +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +# Compiler standard # -marangon: marangon.c - $(CC) $(CFLAGS) marangon.c -o marangon -lcurses +#CSTD= +#CSTD= -ansi +CSTD= -std=gnu90 -# NOTE: this is the original program that won +# Compiler bit architecture # -# NOTE: some systems may need: +# Some entries require 32-bitness: +# ARCH= -m32 # -# $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses -ltermcap +# Some entries require 64-bitness: +# ARCH= -m64 # -marangon.orig: marangon.orig.c - $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses - -nathan: nathan.c - $(CC) $(CFLAGS) nathan.c -o nathan - -# NOTE: this is the original program that won +# By default we assume nothing: # -nathan.orig: nathan.orig.c - $(CC) $(CFLAGS) nathan.orig.c -o nathan.orig +ARCH= -vern: vern.tmp.c - $(CC) $(CFLAGS) vern.tmp.c -o vern - -vern.tmp.c: vern.c - $(RM) -f vern.tmp.c - $(SED) vern.tmp.c - -# NOTE: this is the original program that won +# Defines that are needed to compile # -vern.orig: vern.orig.tmp.c - $(CC) $(CFLAGS) vern.orig.tmp.c -o vern.orig +CDEFINE= +#CDEFINE= -DIOCCC -vern.orig.tmp.c: vern.orig.c - $(RM) -f vern.orig.tmp.c - $(SED) vern.orig.tmp.c - -westley: westley.c - $(CC) $(CFLAGS) westley.c -o westley - -# alternate names for selected entries +# Include files that are needed to compile # -adgrep: adrian - $(RM) -f adgrep - $(LN) adrian adgrep -am: ant - $(RM) -f am - $(LN) ant am -babble: buzzard.1 - $(RM) -f babble - $(LN) buzzard.1 babble -first: buzzard.2 - $(RM) -f first - $(LN) buzzard.2 first -ag: gson - $(RM) -f ag - $(LN) gson ag -whereami: westley - $(RM) -f whereami - $(LN) westley whereami +#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 +# 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 -lresolv +LIBS= -L ${HOMEBREW_PREFIX}/lib -lX11 -lresolv + +# C compiler to use +# +CC= cc +#CC=clang +#CC=gcc + +# Compiler add-ons or replacements for clang only +# +ifeq ($(CC),clang) +# +CSILENCE+= -Wno-poison-system-directories -Wno-comma \ + -Wno-conditional-uninitialized -Wno-sign-conversion +# +CWARN+= -Weverything +# +endif + +# Specific add-ons or replacements for gcc only +# +ifeq ($(CC),gcc) +# +#CSILENCE+= +# +#CWARN+= +# +endif + + +############################## +# Special flags for this entry +############################## +# +ENTRY= kivinen +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= + + +################# +# build the entry +################# +# +all: data ${TARGET} + @${TRUE} + +.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 *.o a.out core - $(RM) -f vern.tmp.c lush.again babble.cppcb vern.orig.tmp.c - $(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi clobber: clean - $(RM) -f $(WINNERS) a.out - $(RM) -f $(ALT_NAMES) - $(RM) -f adwc adbasename adecho adhead adsleep - $(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig - $(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi -am_clobber: clean am - $(RM) -f am.safe - $(CP) am am.safe - $(RM) -f $(WINNERS) a.out - $(RM) -f $(ALT_NAMES) - $(RM) -f adwc adbasename adecho adhead adsleep - $(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig - $(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig - $(CP) am.safe am - $(RM) -f am.safe +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} -nuke: clobber - @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 -install: all - cat $(WINNERS) > /dev/null + +################## +# 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/1992/lush/Makefile b/1992/lush/Makefile index 2eb115d13..500572ff5 100644 --- a/1992/lush/Makefile +++ b/1992/lush/Makefile @@ -1,244 +1,600 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1992 makefile +# IOCCC 1992 winning entry - lush + +################################################################################ # -# Copyright (c) 1992, 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 -CHMOD=chmod -CP=cp -RM=rm -SED=sed -LN=ln -UNIQ=uniq -CB=cb -GREP=grep -# set this to where your C Processor resides +# An Historical Makefile NOTE: # -# On some systems: -# CPP=/lib/cpp +# 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. # -CPP=/usr/ccs/lib/acpp - -# flags for ansi compiles +# 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. # -# 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. +# Regarding individual entries: # -# 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. +# 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. # -#CFLAGS=-O -Xa -CFLAGS=-Xa -CC=cc - -# misc shell babble +# Corrections on winning author and fixing typos in remarks are VERY WELCOME. # -NOINCLUDE=$(SED) -e 's/^.\([ ]*\)include/%include/' -SPACECLEAN=$(SED) -e 's/\([^ ]\)\([ ]\)[ ][ ]*/\1\2/g' -CPPCLEAN=$(GREP) -v '^. [0-9][0-9]*' - -# winners that compile under ANSI C +# GitHub pull requests are welcome: # -WINNERS= adrian albert ant buzzard.1 buzzard.2 gson kivinen imc \ - lush marangon nathan vern westley -ALT_NAMES= adgrep am babble first ag whereami - -all: $(WINNERS) $(ALT_NAMES) - -adrian: adrian.c - $(CC) $(CFLAGS) adrian.c -o adrian - $(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c - $(SED) '1s/\..*\./. wc ./' adrian.c > ad.temp - -./adrian ad.temp adwc.c - $(CC) -o adwc adwc.c - $(SED) '1s/\..*\./. basename ./' adrian.c > ad.temp - -./adrian ad.temp adbasename.c - $(CC) -o adbasename adbasename.c - $(SED) '1s/\..*\./. echo| ./' adrian.c > ad.temp - -./adrian ad.temp adecho.c - $(CC) -o adecho adecho.c - $(SED) '1s/\..*\./. head; ./' adrian.c > ad.temp - -./adrian ad.temp adhead.c - $(CC) -o adhead adhead.c - $(SED) '1s/\..*\./. sleep ./' adrian.c > ad.temp - -./adrian ad.temp adsleep.c - $(CC) -o adsleep adsleep.c - $(RM) -f ad.temp - -# NOTE: this is the original source that won +# 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. # -adrian.orig: adrian.orig.c - $(CC) $(CFLAGS) adrian.orig.c -o adrian.orig - -albert: albert.c - $(CC) $(CFLAGS) albert.c -o albert - -# NOTE: this is the original source 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: # -albert.orig: albert.orig.c - $(CC) $(CFLAGS) albert.orig.c -o albert.orig - -ant: ant.c - $(CC) $(CFLAGS) ant.c -o ant - -buzzard.1: buzzard.1.c - $(CC) $(CFLAGS) buzzard.1.c -o buzzard.1 - -babble.cppcb: buzzard.1.c - $(NOINCLUDE) buzzard.1.c | \ - $(CPP) $(CPPFLAGS) | \ - $(CPPCLEAN) | \ - $(CB) $(CBFLAGS) | \ - $(UNIQ) | \ - $(SPACECLEAN) > babble.cppcb 2>&1 - -buzzard.2: buzzard.2.c - $(CC) $(CFLAGS) buzzard.2.c -o buzzard.2 - -# NOTE: this is the original source that won +# https://github.com/ioccc-src/winner # -buzzard.2.orig: buzzard.2.orig.c - $(CC) $(CFLAGS) buzzard.2.orig.c -o buzzard.2.orig +################################################################################ -gson: gson.c - $(CC) $(CFLAGS) gson.c -o gson - -# NOTE: some systems may only need: +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: # -# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 +# Creative Commons Attribution-ShareAlike 3.0 Unported License. # -kivinen: kivinen.c - $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 -lsocket -lresolv -lnsl +# See: http://creativecommons.org/licenses/by-sa/3.0/ -# NOTE: this is the original program that won + +############################# +# shell used by this Makefile +############################# # -# NOTE: some systems may only need: +SHELL= bash + +####################### +# common tool locations +####################### # -# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 +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 + +# Set X11_LIBDIR to the directory where the X11 library resides # -kivinen.orig: kivinen.orig.c - $(CC) $(CFLAGS) kivinen.orig.c -o kivinen.orig -lX11 \ - -lsocket -lresolv -lnsl +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib -imc: imc.c - $(CC) $(CFLAGS) imc.c -o imc - -# NOTE: this is the original program that won +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -imc.orig: imc.orig.c - $(CC) $(CFLAGS) imc.orig.c -o imc.orig +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include -lush: lush.c - $(CC) $(CFLAGS) lush.c -o lush - -lush.again: lush.c - $(CC) $(CFLAGS) lush.c -o lush.again - $(RM) -f lush.again - -# NOTE: this is the original program that won +# Common C compiler warnings to silence # -lush.orig: lush.orig.c - $(CC) $(CFLAGS) lush.orig.c -o lush.orig +#CSILENCE= +CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-macro-redefined -# NOTE: some systems may need: +# Common C compiler warning flags # -# $(CC) $(CFLAGS) marangon.c -o marangon -lcurses -ltermcap +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +# Compiler standard # -marangon: marangon.c - $(CC) $(CFLAGS) marangon.c -o marangon -lcurses +#CSTD= +#CSTD= -ansi +CSTD= -std=gnu90 -# NOTE: this is the original program that won +# Compiler bit architecture # -# NOTE: some systems may need: +# Some entries require 32-bitness: +# ARCH= -m32 # -# $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses -ltermcap +# Some entries require 64-bitness: +# ARCH= -m64 # -marangon.orig: marangon.orig.c - $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses - -nathan: nathan.c - $(CC) $(CFLAGS) nathan.c -o nathan - -# NOTE: this is the original program that won +# By default we assume nothing: # -nathan.orig: nathan.orig.c - $(CC) $(CFLAGS) nathan.orig.c -o nathan.orig +ARCH= -vern: vern.tmp.c - $(CC) $(CFLAGS) vern.tmp.c -o vern - -vern.tmp.c: vern.c - $(RM) -f vern.tmp.c - $(SED) vern.tmp.c - -# NOTE: this is the original program that won +# Defines that are needed to compile # -vern.orig: vern.orig.tmp.c - $(CC) $(CFLAGS) vern.orig.tmp.c -o vern.orig +CDEFINE= +#CDEFINE= -DIOCCC -vern.orig.tmp.c: vern.orig.c - $(RM) -f vern.orig.tmp.c - $(SED) vern.orig.tmp.c - -westley: westley.c - $(CC) $(CFLAGS) westley.c -o westley - -# alternate names for selected entries +# Include files that are needed to compile # -adgrep: adrian - $(RM) -f adgrep - $(LN) adrian adgrep -am: ant - $(RM) -f am - $(LN) ant am -babble: buzzard.1 - $(RM) -f babble - $(LN) buzzard.1 babble -first: buzzard.2 - $(RM) -f first - $(LN) buzzard.2 first -ag: gson - $(RM) -f ag - $(LN) gson ag -whereami: westley - $(RM) -f whereami - $(LN) westley whereami +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-missing-variable-declarations \ + -Wno-poison-system-directories -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= lush +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= + + +################# +# build the entry +################# +# +all: data ${TARGET} + @${TRUE} + +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + @echo "NOTE: This entry requires a non-standard K&R C compiler to compile." + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +lush.again: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + ${RM} -f $@ + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# clean: - $(RM) -f *.o a.out core - $(RM) -f vern.tmp.c lush.again babble.cppcb vern.orig.tmp.c - $(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c + ${RM} -f ${OBJ} ${ALT_OBJ} + ${RM} -f lush.again + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi clobber: clean - $(RM) -f $(WINNERS) a.out - $(RM) -f $(ALT_NAMES) - $(RM) -f adwc adbasename adecho adhead adsleep - $(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig - $(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi -am_clobber: clean am - $(RM) -f am.safe - $(CP) am am.safe - $(RM) -f $(WINNERS) a.out - $(RM) -f $(ALT_NAMES) - $(RM) -f adwc adbasename adecho adhead adsleep - $(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig - $(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig - $(CP) am.safe am - $(RM) -f am.safe +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} -nuke: clobber - @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 -install: all - cat $(WINNERS) > /dev/null + +################## +# 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/1992/lush/README.md b/1992/lush/README.md index e85fcb723..f31d7d20c 100644 --- a/1992/lush/README.md +++ b/1992/lush/README.md @@ -1,27 +1,27 @@ -Worst Abuse of the C Preprocessor: +# Worst Abuse of the C Preprocessor: Ed Luke Mississippi State University P.O. Box 6176 Mississippi State, MS 39762, USA +## To build: -Judges' comments: + make all - To setup: - make lush - - Try: - make lush.again 2>&1 | lush (sh or ksh users) - or: - make lush.again |& lush (csh users) +### To run + + make lush.again 2>&1 | ./lush + + NOTE: This entry requires a non-standard K&R C compiler to compile. + +## Judges' comments The program uses error messages issued by the C Proproessor to generate its message to the world. One program's error is another program's data! - -Selected notes from the author: +## Author's comments This program is yet another "Hello World." program with a twist. The string Hello World has been encoded in the error messages the compiler diff --git a/1992/marangon/Makefile b/1992/marangon/Makefile index 2eb115d13..3b66bba1e 100644 --- a/1992/marangon/Makefile +++ b/1992/marangon/Makefile @@ -1,244 +1,597 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1992 makefile +# IOCCC 1992 winning entry - marangon + +################################################################################ # -# Copyright (c) 1992, 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 -CHMOD=chmod -CP=cp -RM=rm -SED=sed -LN=ln -UNIQ=uniq -CB=cb -GREP=grep -# set this to where your C Processor resides +# An Historical Makefile NOTE: # -# On some systems: -# CPP=/lib/cpp +# 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. # -CPP=/usr/ccs/lib/acpp - -# flags for ansi compiles +# 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. # -# 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. +# Regarding individual entries: # -# 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. +# 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. # -#CFLAGS=-O -Xa -CFLAGS=-Xa -CC=cc - -# misc shell babble +# Corrections on winning author and fixing typos in remarks are VERY WELCOME. # -NOINCLUDE=$(SED) -e 's/^.\([ ]*\)include/%include/' -SPACECLEAN=$(SED) -e 's/\([^ ]\)\([ ]\)[ ][ ]*/\1\2/g' -CPPCLEAN=$(GREP) -v '^. [0-9][0-9]*' - -# winners that compile under ANSI C +# GitHub pull requests are welcome: # -WINNERS= adrian albert ant buzzard.1 buzzard.2 gson kivinen imc \ - lush marangon nathan vern westley -ALT_NAMES= adgrep am babble first ag whereami - -all: $(WINNERS) $(ALT_NAMES) - -adrian: adrian.c - $(CC) $(CFLAGS) adrian.c -o adrian - $(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c - $(SED) '1s/\..*\./. wc ./' adrian.c > ad.temp - -./adrian ad.temp adwc.c - $(CC) -o adwc adwc.c - $(SED) '1s/\..*\./. basename ./' adrian.c > ad.temp - -./adrian ad.temp adbasename.c - $(CC) -o adbasename adbasename.c - $(SED) '1s/\..*\./. echo| ./' adrian.c > ad.temp - -./adrian ad.temp adecho.c - $(CC) -o adecho adecho.c - $(SED) '1s/\..*\./. head; ./' adrian.c > ad.temp - -./adrian ad.temp adhead.c - $(CC) -o adhead adhead.c - $(SED) '1s/\..*\./. sleep ./' adrian.c > ad.temp - -./adrian ad.temp adsleep.c - $(CC) -o adsleep adsleep.c - $(RM) -f ad.temp - -# NOTE: this is the original source that won +# 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. # -adrian.orig: adrian.orig.c - $(CC) $(CFLAGS) adrian.orig.c -o adrian.orig - -albert: albert.c - $(CC) $(CFLAGS) albert.c -o albert - -# NOTE: this is the original source 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: # -albert.orig: albert.orig.c - $(CC) $(CFLAGS) albert.orig.c -o albert.orig - -ant: ant.c - $(CC) $(CFLAGS) ant.c -o ant - -buzzard.1: buzzard.1.c - $(CC) $(CFLAGS) buzzard.1.c -o buzzard.1 - -babble.cppcb: buzzard.1.c - $(NOINCLUDE) buzzard.1.c | \ - $(CPP) $(CPPFLAGS) | \ - $(CPPCLEAN) | \ - $(CB) $(CBFLAGS) | \ - $(UNIQ) | \ - $(SPACECLEAN) > babble.cppcb 2>&1 - -buzzard.2: buzzard.2.c - $(CC) $(CFLAGS) buzzard.2.c -o buzzard.2 - -# NOTE: this is the original source that won +# https://github.com/ioccc-src/winner # -buzzard.2.orig: buzzard.2.orig.c - $(CC) $(CFLAGS) buzzard.2.orig.c -o buzzard.2.orig +################################################################################ -gson: gson.c - $(CC) $(CFLAGS) gson.c -o gson - -# NOTE: some systems may only need: +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: # -# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 +# Creative Commons Attribution-ShareAlike 3.0 Unported License. # -kivinen: kivinen.c - $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 -lsocket -lresolv -lnsl +# See: http://creativecommons.org/licenses/by-sa/3.0/ -# NOTE: this is the original program that won + +############################# +# shell used by this Makefile +############################# # -# NOTE: some systems may only need: +SHELL= bash + +####################### +# common tool locations +####################### # -# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 +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 + +# Set X11_LIBDIR to the directory where the X11 library resides # -kivinen.orig: kivinen.orig.c - $(CC) $(CFLAGS) kivinen.orig.c -o kivinen.orig -lX11 \ - -lsocket -lresolv -lnsl +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib -imc: imc.c - $(CC) $(CFLAGS) imc.c -o imc - -# NOTE: this is the original program that won +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -imc.orig: imc.orig.c - $(CC) $(CFLAGS) imc.orig.c -o imc.orig +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include -lush: lush.c - $(CC) $(CFLAGS) lush.c -o lush - -lush.again: lush.c - $(CC) $(CFLAGS) lush.c -o lush.again - $(RM) -f lush.again - -# NOTE: this is the original program that won +# Common C compiler warnings to silence # -lush.orig: lush.orig.c - $(CC) $(CFLAGS) lush.orig.c -o lush.orig +#CSILENCE= +CSILENCE= -Wno-bitwise-op-parentheses -Wno-error -Wno-implicit-function-declaration \ + -Wno-logical-op-parentheses -Wno-main-return-type -Wno-missing-braces \ + -Wno-parentheses -Wno-return-type -Wno-tautological-bitwise-compare \ + -Wno-unsequenced -# NOTE: some systems may need: +# Common C compiler warning flags # -# $(CC) $(CFLAGS) marangon.c -o marangon -lcurses -ltermcap +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +# Compiler standard # -marangon: marangon.c - $(CC) $(CFLAGS) marangon.c -o marangon -lcurses +#CSTD= +#CSTD= -ansi +CSTD= -std=gnu90 -# NOTE: this is the original program that won +# Compiler bit architecture # -# NOTE: some systems may need: +# Some entries require 32-bitness: +# ARCH= -m32 # -# $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses -ltermcap +# Some entries require 64-bitness: +# ARCH= -m64 # -marangon.orig: marangon.orig.c - $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses - -nathan: nathan.c - $(CC) $(CFLAGS) nathan.c -o nathan - -# NOTE: this is the original program that won +# By default we assume nothing: # -nathan.orig: nathan.orig.c - $(CC) $(CFLAGS) nathan.orig.c -o nathan.orig +ARCH= -vern: vern.tmp.c - $(CC) $(CFLAGS) vern.tmp.c -o vern - -vern.tmp.c: vern.c - $(RM) -f vern.tmp.c - $(SED) vern.tmp.c - -# NOTE: this is the original program that won +# Defines that are needed to compile # -vern.orig: vern.orig.tmp.c - $(CC) $(CFLAGS) vern.orig.tmp.c -o vern.orig +CDEFINE= +#CDEFINE= -DIOCCC -vern.orig.tmp.c: vern.orig.c - $(RM) -f vern.orig.tmp.c - $(SED) vern.orig.tmp.c - -westley: westley.c - $(CC) $(CFLAGS) westley.c -o westley - -# alternate names for selected entries +# Include files that are needed to compile # -adgrep: adrian - $(RM) -f adgrep - $(LN) adrian adgrep -am: ant - $(RM) -f am - $(LN) ant am -babble: buzzard.1 - $(RM) -f babble - $(LN) buzzard.1 babble -first: buzzard.2 - $(RM) -f first - $(LN) buzzard.2 first -ag: gson - $(RM) -f ag - $(LN) gson ag -whereami: westley - $(RM) -f whereami - $(LN) westley whereami +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= -lcurses +#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-missing-prototypes -Wno-missing-variable-declarations \ + -Wno-poison-system-directories -Wno-strict-prototypes -Wno-unreachable-code +# +CWARN+= -Weverything +# +endif + +# Specific add-ons or replacements for gcc only +# +ifeq ($(CC),gcc) +# +#CSILENCE+= +# +#CWARN+= +# +endif + + +############################## +# Special flags for this entry +############################## +# +ENTRY= marangon +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= + + +################# +# build the entry +################# +# +all: data ${TARGET} + @${TRUE} + +.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 *.o a.out core - $(RM) -f vern.tmp.c lush.again babble.cppcb vern.orig.tmp.c - $(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi clobber: clean - $(RM) -f $(WINNERS) a.out - $(RM) -f $(ALT_NAMES) - $(RM) -f adwc adbasename adecho adhead adsleep - $(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig - $(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi -am_clobber: clean am - $(RM) -f am.safe - $(CP) am am.safe - $(RM) -f $(WINNERS) a.out - $(RM) -f $(ALT_NAMES) - $(RM) -f adwc adbasename adecho adhead adsleep - $(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig - $(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig - $(CP) am.safe am - $(RM) -f am.safe +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} -nuke: clobber - @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 -install: all - cat $(WINNERS) > /dev/null + +################## +# 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/1992/marangon/README.md b/1992/marangon/README.md index edd3cab06..b3a39ed4e 100644 --- a/1992/marangon/README.md +++ b/1992/marangon/README.md @@ -1,4 +1,4 @@ -Best Game: +# Best Game: Marangoni Andrea Department of Computer Science at Milano @@ -6,10 +6,15 @@ Best Game: 62014 Corridonia (MC) Italy +## To build: -Judges' comments: + make all - Make and run. +### To run + + ./marangon + +## Judges' comments The object is to refill the table with 5's, by incrementing or decrementing numbers as needed. It is the side effects @@ -25,8 +30,7 @@ Judges' comments: systems where exit returned a void. The file marangon.c avoids this problem. - -Selected notes from the author: +## Author's comments It starts off by creating a table with number 5 in all places. The CPU melts the numbers and you must return them in original state. diff --git a/1992/nathan/Makefile b/1992/nathan/Makefile index 2eb115d13..cca692254 100644 --- a/1992/nathan/Makefile +++ b/1992/nathan/Makefile @@ -1,244 +1,593 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1992 makefile +# IOCCC 1992 winning entry - nathan + +################################################################################ # -# Copyright (c) 1992, 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 -CHMOD=chmod -CP=cp -RM=rm -SED=sed -LN=ln -UNIQ=uniq -CB=cb -GREP=grep -# set this to where your C Processor resides +# An Historical Makefile NOTE: # -# On some systems: -# CPP=/lib/cpp +# 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. # -CPP=/usr/ccs/lib/acpp - -# flags for ansi compiles +# 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. # -# 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. +# Regarding individual entries: # -# 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. +# 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. # -#CFLAGS=-O -Xa -CFLAGS=-Xa -CC=cc - -# misc shell babble +# Corrections on winning author and fixing typos in remarks are VERY WELCOME. # -NOINCLUDE=$(SED) -e 's/^.\([ ]*\)include/%include/' -SPACECLEAN=$(SED) -e 's/\([^ ]\)\([ ]\)[ ][ ]*/\1\2/g' -CPPCLEAN=$(GREP) -v '^. [0-9][0-9]*' - -# winners that compile under ANSI C +# GitHub pull requests are welcome: # -WINNERS= adrian albert ant buzzard.1 buzzard.2 gson kivinen imc \ - lush marangon nathan vern westley -ALT_NAMES= adgrep am babble first ag whereami - -all: $(WINNERS) $(ALT_NAMES) - -adrian: adrian.c - $(CC) $(CFLAGS) adrian.c -o adrian - $(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c - $(SED) '1s/\..*\./. wc ./' adrian.c > ad.temp - -./adrian ad.temp adwc.c - $(CC) -o adwc adwc.c - $(SED) '1s/\..*\./. basename ./' adrian.c > ad.temp - -./adrian ad.temp adbasename.c - $(CC) -o adbasename adbasename.c - $(SED) '1s/\..*\./. echo| ./' adrian.c > ad.temp - -./adrian ad.temp adecho.c - $(CC) -o adecho adecho.c - $(SED) '1s/\..*\./. head; ./' adrian.c > ad.temp - -./adrian ad.temp adhead.c - $(CC) -o adhead adhead.c - $(SED) '1s/\..*\./. sleep ./' adrian.c > ad.temp - -./adrian ad.temp adsleep.c - $(CC) -o adsleep adsleep.c - $(RM) -f ad.temp - -# NOTE: this is the original source that won +# 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. # -adrian.orig: adrian.orig.c - $(CC) $(CFLAGS) adrian.orig.c -o adrian.orig - -albert: albert.c - $(CC) $(CFLAGS) albert.c -o albert - -# NOTE: this is the original source 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: # -albert.orig: albert.orig.c - $(CC) $(CFLAGS) albert.orig.c -o albert.orig - -ant: ant.c - $(CC) $(CFLAGS) ant.c -o ant - -buzzard.1: buzzard.1.c - $(CC) $(CFLAGS) buzzard.1.c -o buzzard.1 - -babble.cppcb: buzzard.1.c - $(NOINCLUDE) buzzard.1.c | \ - $(CPP) $(CPPFLAGS) | \ - $(CPPCLEAN) | \ - $(CB) $(CBFLAGS) | \ - $(UNIQ) | \ - $(SPACECLEAN) > babble.cppcb 2>&1 - -buzzard.2: buzzard.2.c - $(CC) $(CFLAGS) buzzard.2.c -o buzzard.2 - -# NOTE: this is the original source that won +# https://github.com/ioccc-src/winner # -buzzard.2.orig: buzzard.2.orig.c - $(CC) $(CFLAGS) buzzard.2.orig.c -o buzzard.2.orig +################################################################################ -gson: gson.c - $(CC) $(CFLAGS) gson.c -o gson - -# NOTE: some systems may only need: +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: # -# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 +# Creative Commons Attribution-ShareAlike 3.0 Unported License. # -kivinen: kivinen.c - $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 -lsocket -lresolv -lnsl +# See: http://creativecommons.org/licenses/by-sa/3.0/ -# NOTE: this is the original program that won + +############################# +# shell used by this Makefile +############################# # -# NOTE: some systems may only need: +SHELL= bash + +####################### +# common tool locations +####################### # -# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 +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 + +# Set X11_LIBDIR to the directory where the X11 library resides # -kivinen.orig: kivinen.orig.c - $(CC) $(CFLAGS) kivinen.orig.c -o kivinen.orig -lX11 \ - -lsocket -lresolv -lnsl +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib -imc: imc.c - $(CC) $(CFLAGS) imc.c -o imc - -# NOTE: this is the original program that won +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -imc.orig: imc.orig.c - $(CC) $(CFLAGS) imc.orig.c -o imc.orig +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include -lush: lush.c - $(CC) $(CFLAGS) lush.c -o lush - -lush.again: lush.c - $(CC) $(CFLAGS) lush.c -o lush.again - $(RM) -f lush.again - -# NOTE: this is the original program that won +# Common C compiler warnings to silence # -lush.orig: lush.orig.c - $(CC) $(CFLAGS) lush.orig.c -o lush.orig +CSILENCE= +#CSILENCE= -Wno-implicit-int -# NOTE: some systems may need: +# Common C compiler warning flags # -# $(CC) $(CFLAGS) marangon.c -o marangon -lcurses -ltermcap +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +# Compiler standard # -marangon: marangon.c - $(CC) $(CFLAGS) marangon.c -o marangon -lcurses +#CSTD= +#CSTD= -ansi +CSTD= -std=gnu90 -# NOTE: this is the original program that won +# Compiler bit architecture # -# NOTE: some systems may need: +# Some entries require 32-bitness: +# ARCH= -m32 # -# $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses -ltermcap +# Some entries require 64-bitness: +# ARCH= -m64 # -marangon.orig: marangon.orig.c - $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses - -nathan: nathan.c - $(CC) $(CFLAGS) nathan.c -o nathan - -# NOTE: this is the original program that won +# By default we assume nothing: # -nathan.orig: nathan.orig.c - $(CC) $(CFLAGS) nathan.orig.c -o nathan.orig +ARCH= -vern: vern.tmp.c - $(CC) $(CFLAGS) vern.tmp.c -o vern - -vern.tmp.c: vern.c - $(RM) -f vern.tmp.c - $(SED) vern.tmp.c - -# NOTE: this is the original program that won +# Defines that are needed to compile # -vern.orig: vern.orig.tmp.c - $(CC) $(CFLAGS) vern.orig.tmp.c -o vern.orig +CDEFINE= +#CDEFINE= -DIOCCC -vern.orig.tmp.c: vern.orig.c - $(RM) -f vern.orig.tmp.c - $(SED) vern.orig.tmp.c - -westley: westley.c - $(CC) $(CFLAGS) westley.c -o westley - -# alternate names for selected entries +# Include files that are needed to compile # -adgrep: adrian - $(RM) -f adgrep - $(LN) adrian adgrep -am: ant - $(RM) -f am - $(LN) ant am -babble: buzzard.1 - $(RM) -f babble - $(LN) buzzard.1 babble -first: buzzard.2 - $(RM) -f first - $(LN) buzzard.2 first -ag: gson - $(RM) -f ag - $(LN) gson ag -whereami: westley - $(RM) -f whereami - $(LN) westley whereami +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-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= nathan +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= + + +################# +# build the entry +################# +# +all: data ${TARGET} + @${TRUE} + +.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 *.o a.out core - $(RM) -f vern.tmp.c lush.again babble.cppcb vern.orig.tmp.c - $(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi clobber: clean - $(RM) -f $(WINNERS) a.out - $(RM) -f $(ALT_NAMES) - $(RM) -f adwc adbasename adecho adhead adsleep - $(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig - $(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi -am_clobber: clean am - $(RM) -f am.safe - $(CP) am am.safe - $(RM) -f $(WINNERS) a.out - $(RM) -f $(ALT_NAMES) - $(RM) -f adwc adbasename adecho adhead adsleep - $(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig - $(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig - $(CP) am.safe am - $(RM) -f am.safe +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} -nuke: clobber - @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 -install: all - cat $(WINNERS) > /dev/null + +################## +# 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/1992/nathan/README.md b/1992/nathan/README.md index 350180c85..af1545e92 100644 --- a/1992/nathan/README.md +++ b/1992/nathan/README.md @@ -1,4 +1,4 @@ -Worst Abuse of the Rules: +# Worst Abuse of the Rules: Nathan Sidwell Inmos UK @@ -7,8 +7,15 @@ Worst Abuse of the Rules: Bristol UK BS12 4SQ +## To build: -Judges' comments: + make all + +### To run + + ./nathan + +## Judges' comments The US International Traffic in Arms Regulations controls certain exportations going out of the United States. The U.S. Munitions @@ -54,8 +61,7 @@ Judges' comments: rules entries are ones that tend to 'streach' the limits and take the contest into unexpected territory. - -Personal note from chongo: +### Personal note from chongo: I think this situation shows just how ridiculous US crypto regulations really are. Certain US federal officials can get away @@ -63,8 +69,7 @@ Personal note from chongo: laws, but I personally can't re-distribute a program contest winner to the network! - -Selected notes from the author: +## Author's comments PROGRAM USE diff --git a/1992/vern/.gitignore b/1992/vern/.gitignore index 420cacfdf..b287f41f9 100644 --- a/1992/vern/.gitignore +++ b/1992/vern/.gitignore @@ -1 +1,2 @@ vern +vern.tmp.c diff --git a/1992/vern/Makefile b/1992/vern/Makefile index 2eb115d13..e13c36320 100644 --- a/1992/vern/Makefile +++ b/1992/vern/Makefile @@ -1,244 +1,603 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1992 makefile +# IOCCC 1992 winning entry - vern + +################################################################################ # -# Copyright (c) 1992, 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 -CHMOD=chmod -CP=cp -RM=rm -SED=sed -LN=ln -UNIQ=uniq -CB=cb -GREP=grep -# set this to where your C Processor resides +# An Historical Makefile NOTE: # -# On some systems: -# CPP=/lib/cpp +# 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. # -CPP=/usr/ccs/lib/acpp - -# flags for ansi compiles +# 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. # -# 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. +# Regarding individual entries: # -# 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. +# 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. # -#CFLAGS=-O -Xa -CFLAGS=-Xa -CC=cc - -# misc shell babble +# Corrections on winning author and fixing typos in remarks are VERY WELCOME. # -NOINCLUDE=$(SED) -e 's/^.\([ ]*\)include/%include/' -SPACECLEAN=$(SED) -e 's/\([^ ]\)\([ ]\)[ ][ ]*/\1\2/g' -CPPCLEAN=$(GREP) -v '^. [0-9][0-9]*' - -# winners that compile under ANSI C +# GitHub pull requests are welcome: # -WINNERS= adrian albert ant buzzard.1 buzzard.2 gson kivinen imc \ - lush marangon nathan vern westley -ALT_NAMES= adgrep am babble first ag whereami - -all: $(WINNERS) $(ALT_NAMES) - -adrian: adrian.c - $(CC) $(CFLAGS) adrian.c -o adrian - $(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c - $(SED) '1s/\..*\./. wc ./' adrian.c > ad.temp - -./adrian ad.temp adwc.c - $(CC) -o adwc adwc.c - $(SED) '1s/\..*\./. basename ./' adrian.c > ad.temp - -./adrian ad.temp adbasename.c - $(CC) -o adbasename adbasename.c - $(SED) '1s/\..*\./. echo| ./' adrian.c > ad.temp - -./adrian ad.temp adecho.c - $(CC) -o adecho adecho.c - $(SED) '1s/\..*\./. head; ./' adrian.c > ad.temp - -./adrian ad.temp adhead.c - $(CC) -o adhead adhead.c - $(SED) '1s/\..*\./. sleep ./' adrian.c > ad.temp - -./adrian ad.temp adsleep.c - $(CC) -o adsleep adsleep.c - $(RM) -f ad.temp - -# NOTE: this is the original source that won +# 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. # -adrian.orig: adrian.orig.c - $(CC) $(CFLAGS) adrian.orig.c -o adrian.orig - -albert: albert.c - $(CC) $(CFLAGS) albert.c -o albert - -# NOTE: this is the original source 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: # -albert.orig: albert.orig.c - $(CC) $(CFLAGS) albert.orig.c -o albert.orig - -ant: ant.c - $(CC) $(CFLAGS) ant.c -o ant - -buzzard.1: buzzard.1.c - $(CC) $(CFLAGS) buzzard.1.c -o buzzard.1 - -babble.cppcb: buzzard.1.c - $(NOINCLUDE) buzzard.1.c | \ - $(CPP) $(CPPFLAGS) | \ - $(CPPCLEAN) | \ - $(CB) $(CBFLAGS) | \ - $(UNIQ) | \ - $(SPACECLEAN) > babble.cppcb 2>&1 - -buzzard.2: buzzard.2.c - $(CC) $(CFLAGS) buzzard.2.c -o buzzard.2 - -# NOTE: this is the original source that won +# https://github.com/ioccc-src/winner # -buzzard.2.orig: buzzard.2.orig.c - $(CC) $(CFLAGS) buzzard.2.orig.c -o buzzard.2.orig +################################################################################ -gson: gson.c - $(CC) $(CFLAGS) gson.c -o gson - -# NOTE: some systems may only need: +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: # -# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 +# Creative Commons Attribution-ShareAlike 3.0 Unported License. # -kivinen: kivinen.c - $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 -lsocket -lresolv -lnsl +# See: http://creativecommons.org/licenses/by-sa/3.0/ -# NOTE: this is the original program that won + +############################# +# shell used by this Makefile +############################# # -# NOTE: some systems may only need: +SHELL= bash + +####################### +# common tool locations +####################### # -# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 +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 + +# Set X11_LIBDIR to the directory where the X11 library resides # -kivinen.orig: kivinen.orig.c - $(CC) $(CFLAGS) kivinen.orig.c -o kivinen.orig -lX11 \ - -lsocket -lresolv -lnsl +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib -imc: imc.c - $(CC) $(CFLAGS) imc.c -o imc - -# NOTE: this is the original program that won +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -imc.orig: imc.orig.c - $(CC) $(CFLAGS) imc.orig.c -o imc.orig +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include -lush: lush.c - $(CC) $(CFLAGS) lush.c -o lush - -lush.again: lush.c - $(CC) $(CFLAGS) lush.c -o lush.again - $(RM) -f lush.again - -# NOTE: this is the original program that won +# Common C compiler warnings to silence # -lush.orig: lush.orig.c - $(CC) $(CFLAGS) lush.orig.c -o lush.orig +#CSILENCE= +CSILENCE= -Wno-bitwise-conditional-parentheses -Wno-dangling-else -Wno-error \ + -Wno-implicit-function-declaration -Wno-parentheses -Wno-pedantic \ + -Wno-return-type -Wno-shift-op-parentheses -# NOTE: some systems may need: +# Common C compiler warning flags # -# $(CC) $(CFLAGS) marangon.c -o marangon -lcurses -ltermcap +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +# Compiler standard # -marangon: marangon.c - $(CC) $(CFLAGS) marangon.c -o marangon -lcurses +#CSTD= +#CSTD= -ansi +CSTD= -std=gnu90 -# NOTE: this is the original program that won +# Compiler bit architecture # -# NOTE: some systems may need: +# Some entries require 32-bitness: +# ARCH= -m32 # -# $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses -ltermcap +# Some entries require 64-bitness: +# ARCH= -m64 # -marangon.orig: marangon.orig.c - $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses - -nathan: nathan.c - $(CC) $(CFLAGS) nathan.c -o nathan - -# NOTE: this is the original program that won +# By default we assume nothing: # -nathan.orig: nathan.orig.c - $(CC) $(CFLAGS) nathan.orig.c -o nathan.orig +ARCH= -vern: vern.tmp.c - $(CC) $(CFLAGS) vern.tmp.c -o vern - -vern.tmp.c: vern.c - $(RM) -f vern.tmp.c - $(SED) vern.tmp.c - -# NOTE: this is the original program that won +# Defines that are needed to compile # -vern.orig: vern.orig.tmp.c - $(CC) $(CFLAGS) vern.orig.tmp.c -o vern.orig +CDEFINE= +#CDEFINE= -DIOCCC -vern.orig.tmp.c: vern.orig.c - $(RM) -f vern.orig.tmp.c - $(SED) vern.orig.tmp.c - -westley: westley.c - $(CC) $(CFLAGS) westley.c -o westley - -# alternate names for selected entries +# Include files that are needed to compile # -adgrep: adrian - $(RM) -f adgrep - $(LN) adrian adgrep -am: ant - $(RM) -f am - $(LN) ant am -babble: buzzard.1 - $(RM) -f babble - $(LN) buzzard.1 babble -first: buzzard.2 - $(RM) -f first - $(LN) buzzard.2 first -ag: gson - $(RM) -f ag - $(LN) gson ag -whereami: westley - $(RM) -f whereami - $(LN) westley whereami +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-float-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= vern +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= + + +################# +# build the entry +################# +# +all: data ${TARGET} + @${TRUE} + +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.tmp.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +${PROG}.tmp.c: ${PROG}.c + ${RM} -f $@ + ${SED} <${PROG}.c 's/{ /(/g;s/} /)/g;s/; /#define /' | \ + ${SED} 's/} /=/g;s/{ /i/g' >$@ + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# clean: - $(RM) -f *.o a.out core - $(RM) -f vern.tmp.c lush.again babble.cppcb vern.orig.tmp.c - $(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi clobber: clean - $(RM) -f $(WINNERS) a.out - $(RM) -f $(ALT_NAMES) - $(RM) -f adwc adbasename adecho adhead adsleep - $(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig - $(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig + ${RM} -f ${TARGET} ${ALT_TARGET} + ${RM} -f ${PROG}.tmp.c + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi -am_clobber: clean am - $(RM) -f am.safe - $(CP) am am.safe - $(RM) -f $(WINNERS) a.out - $(RM) -f $(ALT_NAMES) - $(RM) -f adwc adbasename adecho adhead adsleep - $(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig - $(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig - $(CP) am.safe am - $(RM) -f am.safe +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} -nuke: clobber - @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 -install: all - cat $(WINNERS) > /dev/null + +################## +# 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/1992/vern/README.md b/1992/vern/README.md index 5c81883d4..3bbfe1e45 100644 --- a/1992/vern/README.md +++ b/1992/vern/README.md @@ -1,4 +1,4 @@ -Best of Show: +# Best of Show: Vern Paxson Lawrence Berkeley Laboratory @@ -8,24 +8,29 @@ Best of Show: 1 Cyclotron Rd. Berkeley, CA 94720 USA +## To build: -Judges' comments: + make all - Try: - make vern - vern 3 <-- default is 2 +### To run + + ./vern 3 # <-- default is 2 + +## Judges' comments You might start off by giving the following input: + 63 43 76 55 71 52 67 57 (this may take a while) - + The judges assume no responsibility for the obfuscated opening suggested above. :-) For a real quick game try: - vern + + ./vern 65 55 66 46 @@ -35,8 +40,7 @@ Judges' comments: NOTE: Because some mailers have problems with the original winning source, a slightly modified version with shorter lines has been provided. - -Selected notes from the author: +## Author's comments This program plays chess. You play the white pieces and the program the black pieces. Moves are entered as a two-digit number specifying diff --git a/1992/westley/Makefile b/1992/westley/Makefile index 2eb115d13..2bfbfbb2b 100644 --- a/1992/westley/Makefile +++ b/1992/westley/Makefile @@ -1,244 +1,600 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1992 makefile +# IOCCC 1992 winning entry - westley + +################################################################################ # -# Copyright (c) 1992, 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 -CHMOD=chmod -CP=cp -RM=rm -SED=sed -LN=ln -UNIQ=uniq -CB=cb -GREP=grep -# set this to where your C Processor resides +# An Historical Makefile NOTE: # -# On some systems: -# CPP=/lib/cpp +# 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. # -CPP=/usr/ccs/lib/acpp - -# flags for ansi compiles +# 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. # -# 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. +# Regarding individual entries: # -# 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. +# 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. # -#CFLAGS=-O -Xa -CFLAGS=-Xa -CC=cc - -# misc shell babble +# Corrections on winning author and fixing typos in remarks are VERY WELCOME. # -NOINCLUDE=$(SED) -e 's/^.\([ ]*\)include/%include/' -SPACECLEAN=$(SED) -e 's/\([^ ]\)\([ ]\)[ ][ ]*/\1\2/g' -CPPCLEAN=$(GREP) -v '^. [0-9][0-9]*' - -# winners that compile under ANSI C +# GitHub pull requests are welcome: # -WINNERS= adrian albert ant buzzard.1 buzzard.2 gson kivinen imc \ - lush marangon nathan vern westley -ALT_NAMES= adgrep am babble first ag whereami - -all: $(WINNERS) $(ALT_NAMES) - -adrian: adrian.c - $(CC) $(CFLAGS) adrian.c -o adrian - $(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c - $(SED) '1s/\..*\./. wc ./' adrian.c > ad.temp - -./adrian ad.temp adwc.c - $(CC) -o adwc adwc.c - $(SED) '1s/\..*\./. basename ./' adrian.c > ad.temp - -./adrian ad.temp adbasename.c - $(CC) -o adbasename adbasename.c - $(SED) '1s/\..*\./. echo| ./' adrian.c > ad.temp - -./adrian ad.temp adecho.c - $(CC) -o adecho adecho.c - $(SED) '1s/\..*\./. head; ./' adrian.c > ad.temp - -./adrian ad.temp adhead.c - $(CC) -o adhead adhead.c - $(SED) '1s/\..*\./. sleep ./' adrian.c > ad.temp - -./adrian ad.temp adsleep.c - $(CC) -o adsleep adsleep.c - $(RM) -f ad.temp - -# NOTE: this is the original source that won +# 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. # -adrian.orig: adrian.orig.c - $(CC) $(CFLAGS) adrian.orig.c -o adrian.orig - -albert: albert.c - $(CC) $(CFLAGS) albert.c -o albert - -# NOTE: this is the original source 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: # -albert.orig: albert.orig.c - $(CC) $(CFLAGS) albert.orig.c -o albert.orig - -ant: ant.c - $(CC) $(CFLAGS) ant.c -o ant - -buzzard.1: buzzard.1.c - $(CC) $(CFLAGS) buzzard.1.c -o buzzard.1 - -babble.cppcb: buzzard.1.c - $(NOINCLUDE) buzzard.1.c | \ - $(CPP) $(CPPFLAGS) | \ - $(CPPCLEAN) | \ - $(CB) $(CBFLAGS) | \ - $(UNIQ) | \ - $(SPACECLEAN) > babble.cppcb 2>&1 - -buzzard.2: buzzard.2.c - $(CC) $(CFLAGS) buzzard.2.c -o buzzard.2 - -# NOTE: this is the original source that won +# https://github.com/ioccc-src/winner # -buzzard.2.orig: buzzard.2.orig.c - $(CC) $(CFLAGS) buzzard.2.orig.c -o buzzard.2.orig +################################################################################ -gson: gson.c - $(CC) $(CFLAGS) gson.c -o gson - -# NOTE: some systems may only need: +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: # -# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 +# Creative Commons Attribution-ShareAlike 3.0 Unported License. # -kivinen: kivinen.c - $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 -lsocket -lresolv -lnsl +# See: http://creativecommons.org/licenses/by-sa/3.0/ -# NOTE: this is the original program that won + +############################# +# shell used by this Makefile +############################# # -# NOTE: some systems may only need: +SHELL= bash + +####################### +# common tool locations +####################### # -# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 +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 + +# Set X11_LIBDIR to the directory where the X11 library resides # -kivinen.orig: kivinen.orig.c - $(CC) $(CFLAGS) kivinen.orig.c -o kivinen.orig -lX11 \ - -lsocket -lresolv -lnsl +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib -imc: imc.c - $(CC) $(CFLAGS) imc.c -o imc - -# NOTE: this is the original program that won +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -imc.orig: imc.orig.c - $(CC) $(CFLAGS) imc.orig.c -o imc.orig +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include -lush: lush.c - $(CC) $(CFLAGS) lush.c -o lush - -lush.again: lush.c - $(CC) $(CFLAGS) lush.c -o lush.again - $(RM) -f lush.again - -# NOTE: this is the original program that won +# Common C compiler warnings to silence # -lush.orig: lush.orig.c - $(CC) $(CFLAGS) lush.orig.c -o lush.orig +#CSILENCE= +CSILENCE= -Wno-bitwise-op-parentheses -Wno-error -Wno-implicit-function-declaration \ + -Wno-parentheses -Wno-pedantic -# NOTE: some systems may need: +# Common C compiler warning flags # -# $(CC) $(CFLAGS) marangon.c -o marangon -lcurses -ltermcap +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +# Compiler standard # -marangon: marangon.c - $(CC) $(CFLAGS) marangon.c -o marangon -lcurses +#CSTD= +#CSTD= -ansi +CSTD= -std=gnu90 -# NOTE: this is the original program that won +# Compiler bit architecture # -# NOTE: some systems may need: +# Some entries require 32-bitness: +# ARCH= -m32 # -# $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses -ltermcap +# Some entries require 64-bitness: +# ARCH= -m64 # -marangon.orig: marangon.orig.c - $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses - -nathan: nathan.c - $(CC) $(CFLAGS) nathan.c -o nathan - -# NOTE: this is the original program that won +# By default we assume nothing: # -nathan.orig: nathan.orig.c - $(CC) $(CFLAGS) nathan.orig.c -o nathan.orig +ARCH= -vern: vern.tmp.c - $(CC) $(CFLAGS) vern.tmp.c -o vern - -vern.tmp.c: vern.c - $(RM) -f vern.tmp.c - $(SED) vern.tmp.c - -# NOTE: this is the original program that won +# Defines that are needed to compile # -vern.orig: vern.orig.tmp.c - $(CC) $(CFLAGS) vern.orig.tmp.c -o vern.orig +CDEFINE= +#CDEFINE= -DIOCCC -vern.orig.tmp.c: vern.orig.c - $(RM) -f vern.orig.tmp.c - $(SED) vern.orig.tmp.c - -westley: westley.c - $(CC) $(CFLAGS) westley.c -o westley - -# alternate names for selected entries +# Include files that are needed to compile # -adgrep: adrian - $(RM) -f adgrep - $(LN) adrian adgrep -am: ant - $(RM) -f am - $(LN) ant am -babble: buzzard.1 - $(RM) -f babble - $(LN) buzzard.1 babble -first: buzzard.2 - $(RM) -f first - $(LN) buzzard.2 first -ag: gson - $(RM) -f ag - $(LN) gson ag -whereami: westley - $(RM) -f whereami - $(LN) westley whereami +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-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= westley +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= + + +################# +# build the entry +################# +# +all: data ${TARGET} + @${TRUE} + +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + @echo "NOTE: This entry may not compile when using modern compilers." + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +whereami: ${PROG} + ${RM} -f $@ + ${LN} $< $@ + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# clean: - $(RM) -f *.o a.out core - $(RM) -f vern.tmp.c lush.again babble.cppcb vern.orig.tmp.c - $(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi clobber: clean - $(RM) -f $(WINNERS) a.out - $(RM) -f $(ALT_NAMES) - $(RM) -f adwc adbasename adecho adhead adsleep - $(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig - $(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig + ${RM} -f ${TARGET} ${ALT_TARGET} + ${RM} -f whereami + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi -am_clobber: clean am - $(RM) -f am.safe - $(CP) am am.safe - $(RM) -f $(WINNERS) a.out - $(RM) -f $(ALT_NAMES) - $(RM) -f adwc adbasename adecho adhead adsleep - $(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig - $(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig - $(CP) am.safe am - $(RM) -f am.safe +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} -nuke: clobber - @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 -install: all - cat $(WINNERS) > /dev/null + +################## +# 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/1992/westley/README.md b/1992/westley/README.md index 1ad95e5c3..675b778d1 100644 --- a/1992/westley/README.md +++ b/1992/westley/README.md @@ -1,4 +1,4 @@ -Best Small Program: +# Best Small Program: Brian Westley (aka Merlyn LeRoy) Digi International @@ -6,23 +6,31 @@ Best Small Program: St. Paul, MN 55104 USA +## To build: -Judges' comments: + make all + + NOTE: This entry may not compile when using modern compilers. + +### To run If lost: + make whereami Then run: - whereami lat long + + ./whereami lat long + +## Judges' comments Where lat and long correspond to your latitude and longitude. To find the approximate place where this entry was judged, type: - whereami 37 -122 (- means west of meridian) + ./whereami 37 -122 (- means west of meridian) - -Selected notes from the author: +## Author's comments Run the program with your latitude & longitude as integer arguments; it will produce a map made up of '!' with the given