From 223b1a3f9443c2a950357d17821b1fff74366c0f Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Sun, 26 Feb 2023 17:05:50 -0800 Subject: [PATCH] update 1992 Makefile variable set --- 1992/adrian/Makefile | 4 +- 1992/albert/Makefile | 4 +- 1992/ant/Makefile | 4 +- 1992/buzzard.1/Makefile | 4 +- 1992/buzzard.2/Makefile | 4 +- 1992/gson/Makefile | 4 +- 1992/imc/Makefile | 4 +- 1992/kivinen/Makefile | 4 +- 1992/lush/Makefile | 4 +- 1992/marangon/Makefile | 4 +- 1992/nathan/Makefile | 4 +- 1992/vern/Makefile | 4 +- 1992/westley/Makefile | 4 +- 1994/Makefile | 2 +- 1994/dodsond1/Makefile | 717 +++++++++++++++++++++++++++------- 1994/dodsond1/README.md | 18 +- 1994/dodsond2/Makefile | 716 +++++++++++++++++++++++++++------- 1994/dodsond2/README.md | 16 +- 1994/horton/.gitignore | 2 + 1994/horton/Makefile | 725 +++++++++++++++++++++++++++------- 1994/horton/README.md | 16 +- 1994/imc/Makefile | 716 +++++++++++++++++++++++++++------- 1994/imc/README.md | 13 +- 1994/ldb/Makefile | 714 +++++++++++++++++++++++++++------- 1994/ldb/README.md | 14 +- 1994/schnitzi/Makefile | 728 +++++++++++++++++++++++++++------- 1994/shapiro/Makefile | 728 +++++++++++++++++++++++++++------- 1994/smr/Makefile | 728 +++++++++++++++++++++++++++------- 1994/tvr/Makefile | 728 +++++++++++++++++++++++++++------- 1994/weisberg/Makefile | 728 +++++++++++++++++++++++++++------- 1994/westley/Makefile | 728 +++++++++++++++++++++++++++------- 1995/Makefile | 2 +- 1995/cdua/Makefile | 691 ++++++++++++++++++++++++++++----- 1995/dodsond1/Makefile | 691 ++++++++++++++++++++++++++++----- 1995/dodsond2/Makefile | 691 ++++++++++++++++++++++++++++----- 1995/esde/Makefile | 691 ++++++++++++++++++++++++++++----- 1995/garry/Makefile | 691 ++++++++++++++++++++++++++++----- 1995/heathbar/Makefile | 691 ++++++++++++++++++++++++++++----- 1995/leo/Makefile | 691 ++++++++++++++++++++++++++++----- 1995/makarios/Makefile | 691 ++++++++++++++++++++++++++++----- 1995/savastio/Makefile | 691 ++++++++++++++++++++++++++++----- 1995/schnitzi/Makefile | 691 ++++++++++++++++++++++++++++----- 1995/spinellis/Makefile | 691 ++++++++++++++++++++++++++++----- 1995/vanschnitz/Makefile | 691 ++++++++++++++++++++++++++++----- 1996/Makefile | 2 +- 1996/august/Makefile | 727 +++++++++++++++++++++++++++------- 1996/dalbec/Makefile | 727 +++++++++++++++++++++++++++------- 1996/eldby/Makefile | 727 +++++++++++++++++++++++++++------- 1996/gandalf/Makefile | 727 +++++++++++++++++++++++++++------- 1996/huffman/Makefile | 727 +++++++++++++++++++++++++++------- 1996/jonth/Makefile | 727 +++++++++++++++++++++++++++------- 1996/rcm/Makefile | 727 +++++++++++++++++++++++++++------- 1996/schweikh1/Makefile | 727 +++++++++++++++++++++++++++------- 1996/schweikh2/Makefile | 727 +++++++++++++++++++++++++++------- 1996/schweikh3/Makefile | 727 +++++++++++++++++++++++++++------- 1996/westley/Makefile | 727 +++++++++++++++++++++++++++------- 1998/Makefile | 2 +- 1998/banks/Makefile | 731 ++++++++++++++++++++++++++++------- 1998/bas1/Makefile | 731 ++++++++++++++++++++++++++++------- 1998/bas2/Makefile | 731 ++++++++++++++++++++++++++++------- 1998/chaos/Makefile | 731 ++++++++++++++++++++++++++++------- 1998/df/Makefile | 731 ++++++++++++++++++++++++++++------- 1998/dlowe/Makefile | 731 ++++++++++++++++++++++++++++------- 1998/dloweneil/Makefile | 731 ++++++++++++++++++++++++++++------- 1998/dorssel/Makefile | 731 ++++++++++++++++++++++++++++------- 1998/fanf/Makefile | 731 ++++++++++++++++++++++++++++------- 1998/schnitzi/Makefile | 731 ++++++++++++++++++++++++++++------- 1998/schweikh1/Makefile | 731 ++++++++++++++++++++++++++++------- 1998/schweikh2/Makefile | 731 ++++++++++++++++++++++++++++------- 1998/schweikh3/Makefile | 731 ++++++++++++++++++++++++++++------- 1998/tomtorfs/Makefile | 731 ++++++++++++++++++++++++++++------- 2000/Makefile | 2 +- 2000/anderson/Makefile | 4 +- 2000/bellard/Makefile | 4 +- 2000/bmeyer/Makefile | 4 +- 2000/briddlebane/Makefile | 4 +- 2000/dhyang/Makefile | 4 +- 2000/dlowe/Makefile | 4 +- 2000/jarijyrki/Makefile | 4 +- 2000/natori/Makefile | 4 +- 2000/primenum/Makefile | 4 +- 2000/rince/Makefile | 4 +- 2000/robison/Makefile | 4 +- 2000/schneiderwent/Makefile | 4 +- 2000/thadgavin/Makefile | 4 +- 2000/tomx/Makefile | 4 +- 2001/Makefile | 2 +- 2001/anonymous/Makefile | 4 +- 2001/bellard/Makefile | 4 +- 2001/cheong/Makefile | 4 +- 2001/coupard/Makefile | 4 +- 2001/ctk/Makefile | 4 +- 2001/dgbeards/Makefile | 4 +- 2001/herrmann1/Makefile | 4 +- 2001/herrmann2/Makefile | 4 +- 2001/jason/Makefile | 4 +- 2001/kev/Makefile | 4 +- 2001/ollinger/Makefile | 4 +- 2001/rosten/Makefile | 4 +- 2001/schweikh/Makefile | 4 +- 2001/westley/Makefile | 4 +- 2001/williams/Makefile | 4 +- 2004/Makefile | 2 +- 2004/anonymous/Makefile | 4 +- 2004/arachnid/Makefile | 4 +- 2004/burley/Makefile | 4 +- 2004/gavare/Makefile | 4 +- 2004/gavin/Makefile | 4 +- 2004/hibachi/Makefile | 4 +- 2004/hoyle/Makefile | 4 +- 2004/jdalbec/Makefile | 4 +- 2004/kopczynski/Makefile | 4 +- 2004/newbern/Makefile | 4 +- 2004/omoikane/Makefile | 4 +- 2004/schnitzi/Makefile | 4 +- 2004/sds/Makefile | 4 +- 2004/vik1/Makefile | 4 +- 2004/vik2/Makefile | 4 +- 2005/Makefile | 4 +- 2006/Makefile | 4 +- 2011/Makefile | 2 +- 2011/akari/Makefile | 6 +- 2011/blakely/Makefile | 2 +- 2011/borsanyi/Makefile | 2 +- 2011/dlowe/Makefile | 6 +- 2011/eastman/Makefile | 2 +- 2011/fredriksson/Makefile | 2 +- 2011/goren/Makefile | 6 +- 2011/hamaji/Makefile | 6 +- 2011/hou/Makefile | 2 +- 2011/konno/Makefile | 6 +- 2011/richards/Makefile | 2 +- 2011/toledo/Makefile | 2 +- 2011/vik/Makefile | 2 +- 2011/zucker/Makefile | 2 +- 2012/Makefile | 2 +- 2012/blakely/Makefile | 6 +- 2012/deckmyn/Makefile | 6 +- 2012/dlowe/Makefile | 6 +- 2012/endoh1/Makefile | 6 +- 2012/endoh2/Makefile | 6 +- 2012/grothe/Makefile | 6 +- 2012/hamano/Makefile | 6 +- 2012/hou/Makefile | 6 +- 2012/kang/Makefile | 6 +- 2012/konno/Makefile | 6 +- 2012/omoikane/Makefile | 6 +- 2012/tromp/Makefile | 6 +- 2012/vik/Makefile | 6 +- 2012/zeitak/Makefile | 6 +- 2013/Makefile | 2 +- 2013/birken/Makefile | 6 +- 2013/cable1/Makefile | 6 +- 2013/cable2/Makefile | 6 +- 2013/cable3/Makefile | 6 +- 2013/dlowe/Makefile | 6 +- 2013/endoh1/Makefile | 6 +- 2013/endoh2/Makefile | 6 +- 2013/endoh3/Makefile | 6 +- 2013/endoh4/Makefile | 6 +- 2013/hou/Makefile | 6 +- 2013/mills/Makefile | 6 +- 2013/misaka/Makefile | 6 +- 2013/morgan1/Makefile | 6 +- 2013/morgan2/Makefile | 6 +- 2013/robison/Makefile | 6 +- 2014/Makefile | 2 +- 2014/birken/Makefile | 6 +- 2014/deak/Makefile | 6 +- 2014/endoh1/Makefile | 6 +- 2014/endoh2/Makefile | 6 +- 2014/maffiodo1/Makefile | 6 +- 2014/maffiodo2/Makefile | 6 +- 2014/morgan/Makefile | 6 +- 2014/sinon/Makefile | 6 +- 2014/skeggs/Makefile | 6 +- 2014/vik/Makefile | 6 +- 2014/wiedijk/Makefile | 6 +- 2015/Makefile | 2 +- 2015/burton/Makefile | 10 +- 2015/dogon/Makefile | 10 +- 2015/duble/Makefile | 10 +- 2015/endoh1/Makefile | 10 +- 2015/endoh2/Makefile | 10 +- 2015/endoh3/Makefile | 10 +- 2015/endoh4/Makefile | 10 +- 2015/hou/Makefile | 10 +- 2015/howe/Makefile | 12 +- 2015/mills1/Makefile | 10 +- 2015/mills2/Makefile | 10 +- 2015/muth/Makefile | 10 +- 2015/schweikhardt/Makefile | 10 +- 2015/yang/Makefile | 10 +- 2018/Makefile | 2 +- 2018/algmyr/Makefile | 10 +- 2018/anderson/Makefile | 10 +- 2018/bellard/Makefile | 10 +- 2018/burton1/Makefile | 10 +- 2018/burton2/Makefile | 10 +- 2018/ciura/Makefile | 10 +- 2018/endoh1/Makefile | 10 +- 2018/endoh2/Makefile | 10 +- 2018/ferguson/Makefile | 10 +- 2018/giles/Makefile | 10 +- 2018/hou/Makefile | 10 +- 2018/mills/Makefile | 10 +- 2018/poikola/Makefile | 10 +- 2018/vokes/Makefile | 10 +- 2018/yang/Makefile | 10 +- 2019/Makefile | 2 +- 2019/adamovsky/Makefile | 10 +- 2019/burton/Makefile | 10 +- 2019/ciura/Makefile | 10 +- 2019/diels-grabsch1/Makefile | 10 +- 2019/diels-grabsch2/Makefile | 10 +- 2019/dogon/Makefile | 10 +- 2019/duble/Makefile | 10 +- 2019/endoh/Makefile | 10 +- 2019/giles/Makefile | 10 +- 2019/karns/Makefile | 10 +- 2019/lynn/Makefile | 10 +- 2019/mills/Makefile | 10 +- 2019/poikola/Makefile | 10 +- 2019/yang/Makefile | 10 +- 2020/Makefile | 2 +- 2020/burton/Makefile | 10 +- 2020/carlini/Makefile | 10 +- 2020/endoh1/Makefile | 10 +- 2020/endoh2/Makefile | 10 +- 2020/endoh3/Makefile | 10 +- 2020/ferguson1/Makefile | 10 +- 2020/ferguson2/Makefile | 10 +- 2020/giles/Makefile | 10 +- 2020/kurdyukov1/Makefile | 10 +- 2020/kurdyukov2/Makefile | 10 +- 2020/kurdyukov3/Makefile | 10 +- 2020/kurdyukov4/Makefile | 10 +- 2020/otterness/Makefile | 10 +- 2020/tsoj/Makefile | 10 +- 2020/yang/Makefile | 10 +- 240 files changed, 28963 insertions(+), 6731 deletions(-) diff --git a/1992/adrian/Makefile b/1992/adrian/Makefile index 32e4c820f..3bc8644bc 100644 --- a/1992/adrian/Makefile +++ b/1992/adrian/Makefile @@ -306,8 +306,8 @@ ZFORCE= zforce ZGREP= zgrep ZIP= zip ZIPCLOAK= zipcloak -ZIPGREp= zipgrep -ZIPINFo= zipinfo +ZIPGREP= zipgrep +ZIPINFO= zipinfo ZIPNOTE= zipnote ZIPSPLIT= zipsplit ZLESS= zless diff --git a/1992/albert/Makefile b/1992/albert/Makefile index 391713ff9..be325fda5 100644 --- a/1992/albert/Makefile +++ b/1992/albert/Makefile @@ -306,8 +306,8 @@ ZFORCE= zforce ZGREP= zgrep ZIP= zip ZIPCLOAK= zipcloak -ZIPGREp= zipgrep -ZIPINFo= zipinfo +ZIPGREP= zipgrep +ZIPINFO= zipinfo ZIPNOTE= zipnote ZIPSPLIT= zipsplit ZLESS= zless diff --git a/1992/ant/Makefile b/1992/ant/Makefile index 395157b4e..af02878a9 100644 --- a/1992/ant/Makefile +++ b/1992/ant/Makefile @@ -306,8 +306,8 @@ ZFORCE= zforce ZGREP= zgrep ZIP= zip ZIPCLOAK= zipcloak -ZIPGREp= zipgrep -ZIPINFo= zipinfo +ZIPGREP= zipgrep +ZIPINFO= zipinfo ZIPNOTE= zipnote ZIPSPLIT= zipsplit ZLESS= zless diff --git a/1992/buzzard.1/Makefile b/1992/buzzard.1/Makefile index 3a0072612..64285246a 100644 --- a/1992/buzzard.1/Makefile +++ b/1992/buzzard.1/Makefile @@ -306,8 +306,8 @@ ZFORCE= zforce ZGREP= zgrep ZIP= zip ZIPCLOAK= zipcloak -ZIPGREp= zipgrep -ZIPINFo= zipinfo +ZIPGREP= zipgrep +ZIPINFO= zipinfo ZIPNOTE= zipnote ZIPSPLIT= zipsplit ZLESS= zless diff --git a/1992/buzzard.2/Makefile b/1992/buzzard.2/Makefile index a56f27b6b..3540319ef 100644 --- a/1992/buzzard.2/Makefile +++ b/1992/buzzard.2/Makefile @@ -306,8 +306,8 @@ ZFORCE= zforce ZGREP= zgrep ZIP= zip ZIPCLOAK= zipcloak -ZIPGREp= zipgrep -ZIPINFo= zipinfo +ZIPGREP= zipgrep +ZIPINFO= zipinfo ZIPNOTE= zipnote ZIPSPLIT= zipsplit ZLESS= zless diff --git a/1992/gson/Makefile b/1992/gson/Makefile index 794e49dbc..2fbd53ffd 100644 --- a/1992/gson/Makefile +++ b/1992/gson/Makefile @@ -306,8 +306,8 @@ ZFORCE= zforce ZGREP= zgrep ZIP= zip ZIPCLOAK= zipcloak -ZIPGREp= zipgrep -ZIPINFo= zipinfo +ZIPGREP= zipgrep +ZIPINFO= zipinfo ZIPNOTE= zipnote ZIPSPLIT= zipsplit ZLESS= zless diff --git a/1992/imc/Makefile b/1992/imc/Makefile index 050e42f06..61f8ed65f 100644 --- a/1992/imc/Makefile +++ b/1992/imc/Makefile @@ -306,8 +306,8 @@ ZFORCE= zforce ZGREP= zgrep ZIP= zip ZIPCLOAK= zipcloak -ZIPGREp= zipgrep -ZIPINFo= zipinfo +ZIPGREP= zipgrep +ZIPINFO= zipinfo ZIPNOTE= zipnote ZIPSPLIT= zipsplit ZLESS= zless diff --git a/1992/kivinen/Makefile b/1992/kivinen/Makefile index d625c0708..0c0a2926a 100644 --- a/1992/kivinen/Makefile +++ b/1992/kivinen/Makefile @@ -306,8 +306,8 @@ ZFORCE= zforce ZGREP= zgrep ZIP= zip ZIPCLOAK= zipcloak -ZIPGREp= zipgrep -ZIPINFo= zipinfo +ZIPGREP= zipgrep +ZIPINFO= zipinfo ZIPNOTE= zipnote ZIPSPLIT= zipsplit ZLESS= zless diff --git a/1992/lush/Makefile b/1992/lush/Makefile index 500572ff5..ea1515f5d 100644 --- a/1992/lush/Makefile +++ b/1992/lush/Makefile @@ -306,8 +306,8 @@ ZFORCE= zforce ZGREP= zgrep ZIP= zip ZIPCLOAK= zipcloak -ZIPGREp= zipgrep -ZIPINFo= zipinfo +ZIPGREP= zipgrep +ZIPINFO= zipinfo ZIPNOTE= zipnote ZIPSPLIT= zipsplit ZLESS= zless diff --git a/1992/marangon/Makefile b/1992/marangon/Makefile index 3b66bba1e..06b5b027b 100644 --- a/1992/marangon/Makefile +++ b/1992/marangon/Makefile @@ -306,8 +306,8 @@ ZFORCE= zforce ZGREP= zgrep ZIP= zip ZIPCLOAK= zipcloak -ZIPGREp= zipgrep -ZIPINFo= zipinfo +ZIPGREP= zipgrep +ZIPINFO= zipinfo ZIPNOTE= zipnote ZIPSPLIT= zipsplit ZLESS= zless diff --git a/1992/nathan/Makefile b/1992/nathan/Makefile index cca692254..0373fd77e 100644 --- a/1992/nathan/Makefile +++ b/1992/nathan/Makefile @@ -306,8 +306,8 @@ ZFORCE= zforce ZGREP= zgrep ZIP= zip ZIPCLOAK= zipcloak -ZIPGREp= zipgrep -ZIPINFo= zipinfo +ZIPGREP= zipgrep +ZIPINFO= zipinfo ZIPNOTE= zipnote ZIPSPLIT= zipsplit ZLESS= zless diff --git a/1992/vern/Makefile b/1992/vern/Makefile index e13c36320..a463041a4 100644 --- a/1992/vern/Makefile +++ b/1992/vern/Makefile @@ -306,8 +306,8 @@ ZFORCE= zforce ZGREP= zgrep ZIP= zip ZIPCLOAK= zipcloak -ZIPGREp= zipgrep -ZIPINFo= zipinfo +ZIPGREP= zipgrep +ZIPINFO= zipinfo ZIPNOTE= zipnote ZIPSPLIT= zipsplit ZLESS= zless diff --git a/1992/westley/Makefile b/1992/westley/Makefile index 2bfbfbb2b..7c58392cf 100644 --- a/1992/westley/Makefile +++ b/1992/westley/Makefile @@ -306,8 +306,8 @@ ZFORCE= zforce ZGREP= zgrep ZIP= zip ZIPCLOAK= zipcloak -ZIPGREp= zipgrep -ZIPINFo= zipinfo +ZIPGREP= zipgrep +ZIPINFO= zipinfo ZIPNOTE= zipnote ZIPSPLIT= zipsplit ZLESS= zless diff --git a/1994/Makefile b/1994/Makefile index 9b61f398f..8ec81b66b 100644 --- a/1994/Makefile +++ b/1994/Makefile @@ -50,7 +50,7 @@ # tool locations ################ # -SHELL= /bin/bash +SHELL= bash MAKE= make diff --git a/1994/dodsond1/Makefile b/1994/dodsond1/Makefile index 964287422..62954b310 100644 --- a/1994/dodsond1/Makefile +++ b/1994/dodsond1/Makefile @@ -1,157 +1,596 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1994 makefile +# IOCCC 1994 winning entry - dodsond1 + +################################################################################ # -# Copyright (c) 1994, Landon Curt Noll & Larry Bassel. -# All Rights Reserved. Permission for personal, educational or non-profit -# use is granted provided this this copyright and notice are included in its -# entirety and remains unaltered. All other uses must receive prior permission -# from Landon Curt Noll and Larry Bassel. - - -SHELL=/bin/sh -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true - -# flags for ANSI compiles +# An Historical Makefile NOTE: # -# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode, -# others such as gcc may want -ansi, others may want nothing -# at all. Adjust the CFLAGS line as needed. +# The orig.Makefile, if it exits, is the original Makefile before this IOCCC +# year directory was reworked so that entries are in separate directories. +# This also applies to any orig.ansi.mk and orig.common.mk files. # -# NOTE: Some compilers cannot optimize, or optimize some entries -# entries incorrectly. You might want need to turn on -O -# to see if your compiler can handle them. +# Several Makefiles were modified / formed in 2022, and as such it may have +# elements that are not historically compatible with way entries were built. +# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile. # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= - -# ANSI compiler +# Regarding individual entries: # -# Set CC to the name of your ANSI compiler. -#CC=cc -CC=gcc - -# winners that compile under ANSI C +# IOCCC winning entry code may not work on your system. Even with standards, +# conditions and build environments change, especially when it comes to more +# extreme code such you might find in an IOCCC winner. Moreover, what was +# allowed and liked in one IOCCC contest may no longer be liked/allowed in +# later IOCCC years. # -WINNERS= dodsond1 dodsond2 horton imc ldb schnitzi shapiro smr tvr weisberg \ - westley -ALT_NAMES= dodsond2.orig shapiro.alt horton.alt gtface weisberg.alt tvr.alt - -all: $(WINNERS) $(ALT_NAMES) - -westley: westley.c - ${CC} ${CFLAGS} westley.c -DO -o westley - -weisberg: weisberg.c - ${CC} ${CFLAGS} -Dc='n*n>x?p:((m=*(b+1)),N))' \ - -De='(2<<6*sizeof(int))' \ - -Do='(8<<5*sizeof(int))' \ - -DN='((b=t+1),x+=2,x>e?exit():o' \ - -Dp='(a-t shapiro_t2.c - -shapiro_t1: shapiro.c - ${CC} ${CFLAGS} shapiro.c -o shapiro_t1 - -shapiro.alt: shapiro.alt.c - ${CC} ${CFLAGS} shapiro.alt.c -o shapiro.alt - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -horton: horton.c - ${CC} ${CFLAGS} horton.c -o horton - -# Here are some programs related to the horton entry. See horton.hint -# for details. +# If you have a patch that might make running an entry work in modern Unix-like +# environments, please create a GitHub pull request for the IOCCC judges to +# consider. # -horton.alt: horton.alt.c - ${CC} ${CFLAGS} horton.alt.c -o horton.alt -gtface: gtface.c - ${CC} ${CFLAGS} gtface.c -o gtface - -ldb: ldb.c - ${CC} ${CFLAGS} ldb.c -o ldb - -imc: imc.c - ${CC} ${CFLAGS} imc.c -o imc - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 - -# NOTE: this is the original (gziped) file that won +# Suggestions and corrections regarding Makefiles, winning author information, +# fixing typos in remarks, and code patches are welcome via opening a GitHub +# issue or better yet, by creating a GitHub pull request for the IOCCC judges +# to consider. To form a GitHub issue or GitHub pull, please visit: # -dodsond2.orig: dodsond2.gz - @${RM} -f dodsond2.orig.c - -${GUNZIP} < dodsond2.gz > dodsond2.orig.c - -@if [ -s dodsond2.orig.c ]; then \ - echo "${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig"; \ - ${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig; \ - else \ - ${RM} -f dodsond2.orig.c; \ - echo "sorry, we could not gunzip dodsond2.gz"; \ - fi +# https://github.com/ioccc-src/winner +# +################################################################################ -dodsond2.gz: dodsond2.gz.uu - @${RM} -f dodsond2.gz - ${UUDECODE} dodsond2.gz.uu +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: +# +# Creative Commons Attribution-ShareAlike 3.0 Unported License. +# +# See: http://creativecommons.org/licenses/by-sa/3.0/ -dodsond1: dodsond1.c - ${CC} ${CFLAGS} dodsond1.c -o dodsond1 -clean: - $(RM) -f *.o a.out core +############################# +# shell used by this Makefile +############################# +# +SHELL= bash -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - ${RM} -f dodsond2.orig.c dodsond2.gz shapiro_t2.c shapiro_t1 +####################### +# common tool locations +####################### +# +A2P= a2p +AR= ar +ASA= asa +AT= at +ATQ= atq +ATRM= atrm +AWK= awk +BANNER= banner +BASE64= base64 +BASENAME= basename +BATCH= batch +BC= bc +BINHEX= binhex +BISON= bison +BUNZIP2= bunzip2 +BZCAT= bzcat +BZCMP= bzcmp +BZDIFF= bzdiff +BZEGREP= bzegrep +BZFGREP= bzfgrep +BZGREP= bzgrep +BZIP2= bzip2 +BZLESS= bzless +BZMORE= bzmore +C2PH= c2ph +C89= c89 +C99= c99 +CAL= cal +CALC= calc +CAT= cat +CD= cd +CHFLAGS= chflags +CHGRP= chgrp +CHMOD= chmod +CKSUM= cksum +CLANG= clang +CLANG_PLUSPLUS= clang++ +CLEAR= clear +CMP= cmp +COL= col +COLLDEF= colldef +COLRM= colrm +COLUMN= column +COMPRESS= compress +CP= cp +CPIO= cpio +CPP= cpp +CRC32= crc32 +CSH= csh +CSPLIT= csplit +CURL= curl +CUT= cut +C_PLUSPLUS= c++ +C_PLUSPLUS_FILT= c++filt +DATE= date +DC= dc +DD= dd +DF= df +DIFF3= diff3 +DIFF= diff +DIG= dig +DIRNAME= dirname +ED= ed +EGREP= egrep +ENV= env +EQN= eqn +ETAGS= etags +EXPECT= expect +EXPR= expr +FALSE= false +FGREP= fgrep +FILE= file +FIND2PERL= find2perl +FIND= find +FLEX= flex +FLEX_PLUSPLUS= flex++ +FMT= fmt +FOLD= fold +FS_USAGE= fs_usage +FUNZIP= funzip +FUSER= fuser +GCC= gcc +GDIFFMK= gdiffmk +GENCAT= gencat +GENSTRINGS= genstrings +GETOPT= getopt +GETOPTS= getopts +GINDENT= gindent +GNUMAKE= gnumake +GREP= grep +GROFF= groff +GROFFER= groffer +GROG= grog +GROPS= grops +GROTTY= grotty +GUNZIP= gunzip +GVIM= gvim +GZCAT= gzcat +GZEXE= gzexe +GZIP_PROG= gzip +G_PLUSPLUS= g++ +H2PH= h2ph +H2XS= h2xs +HASH= hash +HEAD= head +HOSTNAME_PROG= hostname +ICONV= iconv +ID= id +INDENT= indent +INFO= info +JOT= jot +KILL= kill +KSH= ksh +LAST= last +LD= ld +LESSECHO= lessecho +LEX= len +LINK= link +LN= ln +LS= ls +M4= m4 +MAKE= make +MAN= man +MKDIR= mkdir +MKFIFO= mkfifo +MKTEMP= mktemp +MV= mv +NANO= nano +NASM= nasm +NEQN= neqn +NICE= nice +NL= nl +NM= nm +NOHUP= nohup +NROFF= nroff +NSLOOKUP= nslookup +OD= od +OPENSSL= openssl +PASTE= paste +PATCH= patch +PATHCHK= pathchk +PAX= pax +PERL= perl +PICO= pico +PR= pr +PRINTENV= printenv +PS= ps +PTAR= ptar +PTARDIFF= ptardiff +PTARGREP= ptargrep +PWD= pwd +PYDOC= pydoc +PYTHON= python +PYTHONW= pythonw +READLINK= readlink +RENICE= renice +RESET= reset +REV= rev +RI= ri +RM= rm +RMDIR= rmdir +RSYNC= rsync +RUBY= ruby +RVIM= rvim +SAY= say +SCP= scp +SCREEN= screen +SCRIPT= script +SDIFF= sdiff +SED= sed +SEQ= seq +SFTP= sftp +SH= sh +SHA1= sha1 +SHA= sha +SHAR= shar +SHASUM5_18= shasum5.18 +SHASUM= shasum +SIZE= size +SLEEP= sleep +SORT= sort +SSH= ssh +STAT= stat +STRIP= strip +STTY= stty +SUM= sum +SYNC= sync +TABS= tabs +TAIL= tail +TAR= tar +TEE= tee +TEST= test +TFTP= tftp +TIDY= tidy +TIME= time +TOP= top +TOUCH= touch +TPUT= tout +TPUT= tput +TR= tr +TROFF= troff +TRUE= true +TSET= tset +TSORT= tsort +UL= ul +UNAME= uname +UNCOMPRESS= uncompress +UNEXPAND= unexpand +UNIFDEF= unifdef +UNIFDEFALL= unifdefall +UNIQ= uniq +UNITS= units +UNLINK= unlink +UNZIP= unzip +UNZIPSFX= unzipsfx +UPTIME= uptime +UUDECODE= uudecode +UUENCODE= uuencode +UUIDGEN= uuidgen +VI= vi +VIEW= view +VIM= vim +VIMDIFF= vimdiff +W= w +WAIT4PATH= wait4path +WAIT= wait +WC= wc +WGET= wget +WHAT= what +WHATIS= whatis +WHICH= which +WHO= who +WHOAMI= whoami +WHOIS= whois +1WRTIE= write +XAR= xar +XARGS= xargs +XATTR= xattr +XXD= xxd +YACC= yacc +YES= yes +ZCAT= zcat +ZCMP= zcmp +ZDIFF= zdiff +ZEGREP= zegrep +ZFGREP= zfgrep +ZFORCE= zforce +ZGREP= zgrep +ZIP= zip +ZIPCLOAK= zipcloak +ZIPGREp= zipgrep +ZIPINFo= zipinfo +ZIPNOTE= zipnote +ZIPSPLIT= zipsplit +ZLESS= zless +ZMORE= zmore +ZNEW= znew +ZPRINT= zprint +ZSH= zsh -nuke: clobber +# Set X11_LIBDIR to the directory where the X11 library resides +# +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside +# +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# Common C compiler warnings to silence +# +#CSILENCE= +CSILENCE= -Wno-empty-body -Wno-error -Wno-implicit-function-declaration \ + -Wno-missing-braces -Wno-return-type + +# Common C compiler warning flags +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +# Compiler standard +# +#CSTD= +#CSTD= -ansi +CSTD= -std=gnu90 + +# Compiler bit architecture +# +# Some entries require 32-bitness: +# ARCH= -m32 +# +# Some entries require 64-bitness: +# ARCH= -m64 +# +# By default we assume nothing: +# +ARCH= + +# Defines that are needed to compile +# +CDEFINE= +#CDEFINE= -DIOCCC + +# Include files that are needed to compile +# +CINCLUDE= +#CINCLUDE= -include stdlib.h +#CINCLUDE= -include stdio.h +#CINCLUDE= -include stdlib.h -include stdio.h +#CINCLUDE= -I ${X11_INCDIR} +#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 + +# Optimization +# +# Most compiles will safely use -O2. Some can use only -O1 or -O. +# A few compilers have broken optimizers or this entry make break +# under those buggy optimizers and thus you may not want anything. +# Reasonable compilers will allow for -O3. +# +#OPT= +#OPT= -O +#OPT= -O1 +#OPT= -O2 +OPT= -O3 + +# Default flags for ANSI C compilation +# +CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT} + +# Libraries needed to build +# +LIBS= +#LIBS= -lm +#LIBS= -L ${X11_LIBDIR} -lX11 +#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL + +# C compiler to use +# +CC= cc +#CC=clang +#CC=gcc + +# Compiler add-ons or replacements for clang only +# +ifeq ($(CC),clang) +# +CSILENCE+= -Wno-conditional-uninitialized -Wno-missing-prototypes \ + -Wno-missing-variable-declarations -Wno-poison-system-directories \ + -Wno-strict-prototypes +# +CWARN+= -Weverything +# +endif + +# Specific add-ons or replacements for gcc only +# +ifeq ($(CC),gcc) +# +#CSILENCE+= +# +#CWARN+= +# +endif + + +############################## +# Special flags for this entry +############################## +# +ENTRY= dodsond1 +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= + + +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1994/dodsond1/README.md b/1994/dodsond1/README.md index 3eccb306e..386e6b965 100644 --- a/1994/dodsond1/README.md +++ b/1994/dodsond1/README.md @@ -1,4 +1,4 @@ -Best Game: +# Best Game: Don Dodson AG Communication Systems @@ -6,21 +6,23 @@ Best Game: Phoenix, AZ 85023 USA +## To build: -Judges' comments: + make all - To use: - make dodsond1 - dodsond1 +### To run + + ./dodsond1 - At the prompt, try entering E3. + NOTE: At the prompt, try entering E3. + +## Judges' comments The program plays the game that the layout of the source implies. The source, on the other hand, implies a language along the lines of Lisp. :-) - -Selected notes from the author: +## Author's comments For each turn, the board is displayed and the player is prompted for a move. Enter your move as an upper-case character followed by a number. diff --git a/1994/dodsond2/Makefile b/1994/dodsond2/Makefile index 964287422..a93a79fc8 100644 --- a/1994/dodsond2/Makefile +++ b/1994/dodsond2/Makefile @@ -1,157 +1,595 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1994 makefile +# IOCCC 1994 winning entry - dodsond2 + +################################################################################ # -# Copyright (c) 1994, Landon Curt Noll & Larry Bassel. -# All Rights Reserved. Permission for personal, educational or non-profit -# use is granted provided this this copyright and notice are included in its -# entirety and remains unaltered. All other uses must receive prior permission -# from Landon Curt Noll and Larry Bassel. - - -SHELL=/bin/sh -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true - -# flags for ANSI compiles +# An Historical Makefile NOTE: # -# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode, -# others such as gcc may want -ansi, others may want nothing -# at all. Adjust the CFLAGS line as needed. +# The orig.Makefile, if it exits, is the original Makefile before this IOCCC +# year directory was reworked so that entries are in separate directories. +# This also applies to any orig.ansi.mk and orig.common.mk files. # -# NOTE: Some compilers cannot optimize, or optimize some entries -# entries incorrectly. You might want need to turn on -O -# to see if your compiler can handle them. +# Several Makefiles were modified / formed in 2022, and as such it may have +# elements that are not historically compatible with way entries were built. +# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile. # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= - -# ANSI compiler +# Regarding individual entries: # -# Set CC to the name of your ANSI compiler. -#CC=cc -CC=gcc - -# winners that compile under ANSI C +# IOCCC winning entry code may not work on your system. Even with standards, +# conditions and build environments change, especially when it comes to more +# extreme code such you might find in an IOCCC winner. Moreover, what was +# allowed and liked in one IOCCC contest may no longer be liked/allowed in +# later IOCCC years. # -WINNERS= dodsond1 dodsond2 horton imc ldb schnitzi shapiro smr tvr weisberg \ - westley -ALT_NAMES= dodsond2.orig shapiro.alt horton.alt gtface weisberg.alt tvr.alt - -all: $(WINNERS) $(ALT_NAMES) - -westley: westley.c - ${CC} ${CFLAGS} westley.c -DO -o westley - -weisberg: weisberg.c - ${CC} ${CFLAGS} -Dc='n*n>x?p:((m=*(b+1)),N))' \ - -De='(2<<6*sizeof(int))' \ - -Do='(8<<5*sizeof(int))' \ - -DN='((b=t+1),x+=2,x>e?exit():o' \ - -Dp='(a-t shapiro_t2.c - -shapiro_t1: shapiro.c - ${CC} ${CFLAGS} shapiro.c -o shapiro_t1 - -shapiro.alt: shapiro.alt.c - ${CC} ${CFLAGS} shapiro.alt.c -o shapiro.alt - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -horton: horton.c - ${CC} ${CFLAGS} horton.c -o horton - -# Here are some programs related to the horton entry. See horton.hint -# for details. +# If you have a patch that might make running an entry work in modern Unix-like +# environments, please create a GitHub pull request for the IOCCC judges to +# consider. # -horton.alt: horton.alt.c - ${CC} ${CFLAGS} horton.alt.c -o horton.alt -gtface: gtface.c - ${CC} ${CFLAGS} gtface.c -o gtface - -ldb: ldb.c - ${CC} ${CFLAGS} ldb.c -o ldb - -imc: imc.c - ${CC} ${CFLAGS} imc.c -o imc - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 - -# NOTE: this is the original (gziped) file that won +# Suggestions and corrections regarding Makefiles, winning author information, +# fixing typos in remarks, and code patches are welcome via opening a GitHub +# issue or better yet, by creating a GitHub pull request for the IOCCC judges +# to consider. To form a GitHub issue or GitHub pull, please visit: # -dodsond2.orig: dodsond2.gz - @${RM} -f dodsond2.orig.c - -${GUNZIP} < dodsond2.gz > dodsond2.orig.c - -@if [ -s dodsond2.orig.c ]; then \ - echo "${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig"; \ - ${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig; \ - else \ - ${RM} -f dodsond2.orig.c; \ - echo "sorry, we could not gunzip dodsond2.gz"; \ - fi +# https://github.com/ioccc-src/winner +# +################################################################################ -dodsond2.gz: dodsond2.gz.uu - @${RM} -f dodsond2.gz - ${UUDECODE} dodsond2.gz.uu +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: +# +# Creative Commons Attribution-ShareAlike 3.0 Unported License. +# +# See: http://creativecommons.org/licenses/by-sa/3.0/ -dodsond1: dodsond1.c - ${CC} ${CFLAGS} dodsond1.c -o dodsond1 -clean: - $(RM) -f *.o a.out core +############################# +# shell used by this Makefile +############################# +# +SHELL= bash -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - ${RM} -f dodsond2.orig.c dodsond2.gz shapiro_t2.c shapiro_t1 +####################### +# common tool locations +####################### +# +A2P= a2p +AR= ar +ASA= asa +AT= at +ATQ= atq +ATRM= atrm +AWK= awk +BANNER= banner +BASE64= base64 +BASENAME= basename +BATCH= batch +BC= bc +BINHEX= binhex +BISON= bison +BUNZIP2= bunzip2 +BZCAT= bzcat +BZCMP= bzcmp +BZDIFF= bzdiff +BZEGREP= bzegrep +BZFGREP= bzfgrep +BZGREP= bzgrep +BZIP2= bzip2 +BZLESS= bzless +BZMORE= bzmore +C2PH= c2ph +C89= c89 +C99= c99 +CAL= cal +CALC= calc +CAT= cat +CD= cd +CHFLAGS= chflags +CHGRP= chgrp +CHMOD= chmod +CKSUM= cksum +CLANG= clang +CLANG_PLUSPLUS= clang++ +CLEAR= clear +CMP= cmp +COL= col +COLLDEF= colldef +COLRM= colrm +COLUMN= column +COMPRESS= compress +CP= cp +CPIO= cpio +CPP= cpp +CRC32= crc32 +CSH= csh +CSPLIT= csplit +CURL= curl +CUT= cut +C_PLUSPLUS= c++ +C_PLUSPLUS_FILT= c++filt +DATE= date +DC= dc +DD= dd +DF= df +DIFF3= diff3 +DIFF= diff +DIG= dig +DIRNAME= dirname +ED= ed +EGREP= egrep +ENV= env +EQN= eqn +ETAGS= etags +EXPECT= expect +EXPR= expr +FALSE= false +FGREP= fgrep +FILE= file +FIND2PERL= find2perl +FIND= find +FLEX= flex +FLEX_PLUSPLUS= flex++ +FMT= fmt +FOLD= fold +FS_USAGE= fs_usage +FUNZIP= funzip +FUSER= fuser +GCC= gcc +GDIFFMK= gdiffmk +GENCAT= gencat +GENSTRINGS= genstrings +GETOPT= getopt +GETOPTS= getopts +GINDENT= gindent +GNUMAKE= gnumake +GREP= grep +GROFF= groff +GROFFER= groffer +GROG= grog +GROPS= grops +GROTTY= grotty +GUNZIP= gunzip +GVIM= gvim +GZCAT= gzcat +GZEXE= gzexe +GZIP_PROG= gzip +G_PLUSPLUS= g++ +H2PH= h2ph +H2XS= h2xs +HASH= hash +HEAD= head +HOSTNAME_PROG= hostname +ICONV= iconv +ID= id +INDENT= indent +INFO= info +JOT= jot +KILL= kill +KSH= ksh +LAST= last +LD= ld +LESSECHO= lessecho +LEX= len +LINK= link +LN= ln +LS= ls +M4= m4 +MAKE= make +MAN= man +MKDIR= mkdir +MKFIFO= mkfifo +MKTEMP= mktemp +MV= mv +NANO= nano +NASM= nasm +NEQN= neqn +NICE= nice +NL= nl +NM= nm +NOHUP= nohup +NROFF= nroff +NSLOOKUP= nslookup +OD= od +OPENSSL= openssl +PASTE= paste +PATCH= patch +PATHCHK= pathchk +PAX= pax +PERL= perl +PICO= pico +PR= pr +PRINTENV= printenv +PS= ps +PTAR= ptar +PTARDIFF= ptardiff +PTARGREP= ptargrep +PWD= pwd +PYDOC= pydoc +PYTHON= python +PYTHONW= pythonw +READLINK= readlink +RENICE= renice +RESET= reset +REV= rev +RI= ri +RM= rm +RMDIR= rmdir +RSYNC= rsync +RUBY= ruby +RVIM= rvim +SAY= say +SCP= scp +SCREEN= screen +SCRIPT= script +SDIFF= sdiff +SED= sed +SEQ= seq +SFTP= sftp +SH= sh +SHA1= sha1 +SHA= sha +SHAR= shar +SHASUM5_18= shasum5.18 +SHASUM= shasum +SIZE= size +SLEEP= sleep +SORT= sort +SSH= ssh +STAT= stat +STRIP= strip +STTY= stty +SUM= sum +SYNC= sync +TABS= tabs +TAIL= tail +TAR= tar +TEE= tee +TEST= test +TFTP= tftp +TIDY= tidy +TIME= time +TOP= top +TOUCH= touch +TPUT= tout +TPUT= tput +TR= tr +TROFF= troff +TRUE= true +TSET= tset +TSORT= tsort +UL= ul +UNAME= uname +UNCOMPRESS= uncompress +UNEXPAND= unexpand +UNIFDEF= unifdef +UNIFDEFALL= unifdefall +UNIQ= uniq +UNITS= units +UNLINK= unlink +UNZIP= unzip +UNZIPSFX= unzipsfx +UPTIME= uptime +UUDECODE= uudecode +UUENCODE= uuencode +UUIDGEN= uuidgen +VI= vi +VIEW= view +VIM= vim +VIMDIFF= vimdiff +W= w +WAIT4PATH= wait4path +WAIT= wait +WC= wc +WGET= wget +WHAT= what +WHATIS= whatis +WHICH= which +WHO= who +WHOAMI= whoami +WHOIS= whois +1WRTIE= write +XAR= xar +XARGS= xargs +XATTR= xattr +XXD= xxd +YACC= yacc +YES= yes +ZCAT= zcat +ZCMP= zcmp +ZDIFF= zdiff +ZEGREP= zegrep +ZFGREP= zfgrep +ZFORCE= zforce +ZGREP= zgrep +ZIP= zip +ZIPCLOAK= zipcloak +ZIPGREp= zipgrep +ZIPINFo= zipinfo +ZIPNOTE= zipnote +ZIPSPLIT= zipsplit +ZLESS= zless +ZMORE= zmore +ZNEW= znew +ZPRINT= zprint +ZSH= zsh -nuke: clobber +# Set X11_LIBDIR to the directory where the X11 library resides +# +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside +# +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# Common C compiler warnings to silence +# +#CSILENCE= +CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-return-type + +# Common C compiler warning flags +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +# Compiler standard +# +#CSTD= +#CSTD= -ansi +CSTD= -std=gnu90 + +# Compiler bit architecture +# +# Some entries require 32-bitness: +# ARCH= -m32 +# +# Some entries require 64-bitness: +# ARCH= -m64 +# +# By default we assume nothing: +# +ARCH= + +# Defines that are needed to compile +# +CDEFINE= +#CDEFINE= -DIOCCC + +# Include files that are needed to compile +# +CINCLUDE= +#CINCLUDE= -include stdlib.h +#CINCLUDE= -include stdio.h +#CINCLUDE= -include stdlib.h -include stdio.h +#CINCLUDE= -I ${X11_INCDIR} +#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 + +# Optimization +# +# Most compiles will safely use -O2. Some can use only -O1 or -O. +# A few compilers have broken optimizers or this entry make break +# under those buggy optimizers and thus you may not want anything. +# Reasonable compilers will allow for -O3. +# +#OPT= +#OPT= -O +#OPT= -O1 +#OPT= -O2 +OPT= -O3 + +# Default flags for ANSI C compilation +# +CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT} + +# Libraries needed to build +# +LIBS= +#LIBS= -lm +#LIBS= -L ${X11_LIBDIR} -lX11 +#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL + +# C compiler to use +# +CC= cc +#CC=clang +#CC=gcc + +# Compiler add-ons or replacements for clang only +# +ifeq ($(CC),clang) +# +CSILENCE+= -Wno-implicit-int-conversion -Wno-missing-prototypes \ + -Wno-missing-variable-declarations -Wno-poison-system-directories \ + -Wno-shadow -Wno-strict-prototypes +# +CWARN+= -Weverything +# +endif + +# Specific add-ons or replacements for gcc only +# +ifeq ($(CC),gcc) +# +#CSILENCE+= +# +#CWARN+= +# +endif + + +############################## +# Special flags for this entry +############################## +# +ENTRY= dodsond2 +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= + + +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1994/dodsond2/README.md b/1994/dodsond2/README.md index 6d28dd4a2..789d7cf85 100644 --- a/1994/dodsond2/README.md +++ b/1994/dodsond2/README.md @@ -1,4 +1,4 @@ -Most Obfuscated Packaging: +# Most Obfuscated Packaging: Don Dodson AG Communication Systems @@ -6,12 +6,15 @@ Most Obfuscated Packaging: Phoenix, AZ 85023 USA +## To build: -Judges' comments: + make all - To use: - make dodsond2 - dodsond2 +### To run + + ./dodsond2 + +## Judges' comments The original source file may be found in dodsond2.gz. For people who don't have gunzip, an un-zipped version is provided as dodsond2.c. @@ -21,8 +24,7 @@ Judges' comments: to get around the size limit will find themselves squeezed out of the contest! - -Selected notes from the author: +## Author's comments Go searching for the Wumpus in the Caverns of Doom! But be careful... There are pits and bats waiting to seal your fate, as well as a diff --git a/1994/horton/.gitignore b/1994/horton/.gitignore index bb28a6992..685074b78 100644 --- a/1994/horton/.gitignore +++ b/1994/horton/.gitignore @@ -1 +1,3 @@ +gtface horton +horton.alt diff --git a/1994/horton/Makefile b/1994/horton/Makefile index 964287422..26187567b 100644 --- a/1994/horton/Makefile +++ b/1994/horton/Makefile @@ -1,157 +1,604 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1994 makefile +# IOCCC 1994 winning entry - horton + +################################################################################ # -# Copyright (c) 1994, Landon Curt Noll & Larry Bassel. -# All Rights Reserved. Permission for personal, educational or non-profit -# use is granted provided this this copyright and notice are included in its -# entirety and remains unaltered. All other uses must receive prior permission -# from Landon Curt Noll and Larry Bassel. - - -SHELL=/bin/sh -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true - -# flags for ANSI compiles +# An Historical Makefile NOTE: # -# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode, -# others such as gcc may want -ansi, others may want nothing -# at all. Adjust the CFLAGS line as needed. +# The orig.Makefile, if it exits, is the original Makefile before this IOCCC +# year directory was reworked so that entries are in separate directories. +# This also applies to any orig.ansi.mk and orig.common.mk files. # -# NOTE: Some compilers cannot optimize, or optimize some entries -# entries incorrectly. You might want need to turn on -O -# to see if your compiler can handle them. +# Several Makefiles were modified / formed in 2022, and as such it may have +# elements that are not historically compatible with way entries were built. +# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile. # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= - -# ANSI compiler +# Regarding individual entries: # -# Set CC to the name of your ANSI compiler. -#CC=cc -CC=gcc - -# winners that compile under ANSI C +# IOCCC winning entry code may not work on your system. Even with standards, +# conditions and build environments change, especially when it comes to more +# extreme code such you might find in an IOCCC winner. Moreover, what was +# allowed and liked in one IOCCC contest may no longer be liked/allowed in +# later IOCCC years. # -WINNERS= dodsond1 dodsond2 horton imc ldb schnitzi shapiro smr tvr weisberg \ - westley -ALT_NAMES= dodsond2.orig shapiro.alt horton.alt gtface weisberg.alt tvr.alt - -all: $(WINNERS) $(ALT_NAMES) - -westley: westley.c - ${CC} ${CFLAGS} westley.c -DO -o westley - -weisberg: weisberg.c - ${CC} ${CFLAGS} -Dc='n*n>x?p:((m=*(b+1)),N))' \ - -De='(2<<6*sizeof(int))' \ - -Do='(8<<5*sizeof(int))' \ - -DN='((b=t+1),x+=2,x>e?exit():o' \ - -Dp='(a-t shapiro_t2.c - -shapiro_t1: shapiro.c - ${CC} ${CFLAGS} shapiro.c -o shapiro_t1 - -shapiro.alt: shapiro.alt.c - ${CC} ${CFLAGS} shapiro.alt.c -o shapiro.alt - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -horton: horton.c - ${CC} ${CFLAGS} horton.c -o horton - -# Here are some programs related to the horton entry. See horton.hint -# for details. +# If you have a patch that might make running an entry work in modern Unix-like +# environments, please create a GitHub pull request for the IOCCC judges to +# consider. # -horton.alt: horton.alt.c - ${CC} ${CFLAGS} horton.alt.c -o horton.alt -gtface: gtface.c - ${CC} ${CFLAGS} gtface.c -o gtface - -ldb: ldb.c - ${CC} ${CFLAGS} ldb.c -o ldb - -imc: imc.c - ${CC} ${CFLAGS} imc.c -o imc - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 - -# NOTE: this is the original (gziped) file that won +# Suggestions and corrections regarding Makefiles, winning author information, +# fixing typos in remarks, and code patches are welcome via opening a GitHub +# issue or better yet, by creating a GitHub pull request for the IOCCC judges +# to consider. To form a GitHub issue or GitHub pull, please visit: # -dodsond2.orig: dodsond2.gz - @${RM} -f dodsond2.orig.c - -${GUNZIP} < dodsond2.gz > dodsond2.orig.c - -@if [ -s dodsond2.orig.c ]; then \ - echo "${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig"; \ - ${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig; \ - else \ - ${RM} -f dodsond2.orig.c; \ - echo "sorry, we could not gunzip dodsond2.gz"; \ - fi +# https://github.com/ioccc-src/winner +# +################################################################################ -dodsond2.gz: dodsond2.gz.uu - @${RM} -f dodsond2.gz - ${UUDECODE} dodsond2.gz.uu +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: +# +# Creative Commons Attribution-ShareAlike 3.0 Unported License. +# +# See: http://creativecommons.org/licenses/by-sa/3.0/ -dodsond1: dodsond1.c - ${CC} ${CFLAGS} dodsond1.c -o dodsond1 -clean: - $(RM) -f *.o a.out core +############################# +# shell used by this Makefile +############################# +# +SHELL= bash -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - ${RM} -f dodsond2.orig.c dodsond2.gz shapiro_t2.c shapiro_t1 +####################### +# common tool locations +####################### +# +A2P= a2p +AR= ar +ASA= asa +AT= at +ATQ= atq +ATRM= atrm +AWK= awk +BANNER= banner +BASE64= base64 +BASENAME= basename +BATCH= batch +BC= bc +BINHEX= binhex +BISON= bison +BUNZIP2= bunzip2 +BZCAT= bzcat +BZCMP= bzcmp +BZDIFF= bzdiff +BZEGREP= bzegrep +BZFGREP= bzfgrep +BZGREP= bzgrep +BZIP2= bzip2 +BZLESS= bzless +BZMORE= bzmore +C2PH= c2ph +C89= c89 +C99= c99 +CAL= cal +CALC= calc +CAT= cat +CD= cd +CHFLAGS= chflags +CHGRP= chgrp +CHMOD= chmod +CKSUM= cksum +CLANG= clang +CLANG_PLUSPLUS= clang++ +CLEAR= clear +CMP= cmp +COL= col +COLLDEF= colldef +COLRM= colrm +COLUMN= column +COMPRESS= compress +CP= cp +CPIO= cpio +CPP= cpp +CRC32= crc32 +CSH= csh +CSPLIT= csplit +CURL= curl +CUT= cut +C_PLUSPLUS= c++ +C_PLUSPLUS_FILT= c++filt +DATE= date +DC= dc +DD= dd +DF= df +DIFF3= diff3 +DIFF= diff +DIG= dig +DIRNAME= dirname +ED= ed +EGREP= egrep +ENV= env +EQN= eqn +ETAGS= etags +EXPECT= expect +EXPR= expr +FALSE= false +FGREP= fgrep +FILE= file +FIND2PERL= find2perl +FIND= find +FLEX= flex +FLEX_PLUSPLUS= flex++ +FMT= fmt +FOLD= fold +FS_USAGE= fs_usage +FUNZIP= funzip +FUSER= fuser +GCC= gcc +GDIFFMK= gdiffmk +GENCAT= gencat +GENSTRINGS= genstrings +GETOPT= getopt +GETOPTS= getopts +GINDENT= gindent +GNUMAKE= gnumake +GREP= grep +GROFF= groff +GROFFER= groffer +GROG= grog +GROPS= grops +GROTTY= grotty +GUNZIP= gunzip +GVIM= gvim +GZCAT= gzcat +GZEXE= gzexe +GZIP_PROG= gzip +G_PLUSPLUS= g++ +H2PH= h2ph +H2XS= h2xs +HASH= hash +HEAD= head +HOSTNAME_PROG= hostname +ICONV= iconv +ID= id +INDENT= indent +INFO= info +JOT= jot +KILL= kill +KSH= ksh +LAST= last +LD= ld +LESSECHO= lessecho +LEX= len +LINK= link +LN= ln +LS= ls +M4= m4 +MAKE= make +MAN= man +MKDIR= mkdir +MKFIFO= mkfifo +MKTEMP= mktemp +MV= mv +NANO= nano +NASM= nasm +NEQN= neqn +NICE= nice +NL= nl +NM= nm +NOHUP= nohup +NROFF= nroff +NSLOOKUP= nslookup +OD= od +OPENSSL= openssl +PASTE= paste +PATCH= patch +PATHCHK= pathchk +PAX= pax +PERL= perl +PICO= pico +PR= pr +PRINTENV= printenv +PS= ps +PTAR= ptar +PTARDIFF= ptardiff +PTARGREP= ptargrep +PWD= pwd +PYDOC= pydoc +PYTHON= python +PYTHONW= pythonw +READLINK= readlink +RENICE= renice +RESET= reset +REV= rev +RI= ri +RM= rm +RMDIR= rmdir +RSYNC= rsync +RUBY= ruby +RVIM= rvim +SAY= say +SCP= scp +SCREEN= screen +SCRIPT= script +SDIFF= sdiff +SED= sed +SEQ= seq +SFTP= sftp +SH= sh +SHA1= sha1 +SHA= sha +SHAR= shar +SHASUM5_18= shasum5.18 +SHASUM= shasum +SIZE= size +SLEEP= sleep +SORT= sort +SSH= ssh +STAT= stat +STRIP= strip +STTY= stty +SUM= sum +SYNC= sync +TABS= tabs +TAIL= tail +TAR= tar +TEE= tee +TEST= test +TFTP= tftp +TIDY= tidy +TIME= time +TOP= top +TOUCH= touch +TPUT= tout +TPUT= tput +TR= tr +TROFF= troff +TRUE= true +TSET= tset +TSORT= tsort +UL= ul +UNAME= uname +UNCOMPRESS= uncompress +UNEXPAND= unexpand +UNIFDEF= unifdef +UNIFDEFALL= unifdefall +UNIQ= uniq +UNITS= units +UNLINK= unlink +UNZIP= unzip +UNZIPSFX= unzipsfx +UPTIME= uptime +UUDECODE= uudecode +UUENCODE= uuencode +UUIDGEN= uuidgen +VI= vi +VIEW= view +VIM= vim +VIMDIFF= vimdiff +W= w +WAIT4PATH= wait4path +WAIT= wait +WC= wc +WGET= wget +WHAT= what +WHATIS= whatis +WHICH= which +WHO= who +WHOAMI= whoami +WHOIS= whois +1WRTIE= write +XAR= xar +XARGS= xargs +XATTR= xattr +XXD= xxd +YACC= yacc +YES= yes +ZCAT= zcat +ZCMP= zcmp +ZDIFF= zdiff +ZEGREP= zegrep +ZFGREP= zfgrep +ZFORCE= zforce +ZGREP= zgrep +ZIP= zip +ZIPCLOAK= zipcloak +ZIPGREp= zipgrep +ZIPINFo= zipinfo +ZIPNOTE= zipnote +ZIPSPLIT= zipsplit +ZLESS= zless +ZMORE= zmore +ZNEW= znew +ZPRINT= zprint +ZSH= zsh -nuke: clobber +# Set X11_LIBDIR to the directory where the X11 library resides +# +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside +# +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# Common C compiler warnings to silence +# +#CSILENCE= +CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-unused-parameter \ + -Wno-missing-braces -Wno-return-type -Wno-unused-but-set-variable \ + -Wno-unused-variable + +# Common C compiler warning flags +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +# Compiler standard +# +#CSTD= +#CSTD= -ansi +CSTD= -std=gnu90 + +# Compiler bit architecture +# +# Some entries require 32-bitness: +# ARCH= -m32 +# +# Some entries require 64-bitness: +# ARCH= -m64 +# +# By default we assume nothing: +# +ARCH= + +# Defines that are needed to compile +# +CDEFINE= +#CDEFINE= -DIOCCC + +# Include files that are needed to compile +# +CINCLUDE= +#CINCLUDE= -include stdlib.h +#CINCLUDE= -include stdio.h +#CINCLUDE= -include stdlib.h -include stdio.h +#CINCLUDE= -I ${X11_INCDIR} +#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 + +# Optimization +# +# Most compiles will safely use -O2. Some can use only -O1 or -O. +# A few compilers have broken optimizers or this entry make break +# under those buggy optimizers and thus you may not want anything. +# Reasonable compilers will allow for -O3. +# +#OPT= +#OPT= -O +#OPT= -O1 +#OPT= -O2 +OPT= -O3 + +# Default flags for ANSI C compilation +# +CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT} + +# Libraries needed to build +# +LIBS= +#LIBS= -lm +#LIBS= -L ${X11_LIBDIR} -lX11 +#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL + +# C compiler to use +# +CC= cc +#CC=clang +#CC=gcc + +# Compiler add-ons or replacements for clang only +# +ifeq ($(CC),clang) +# +CSILENCE+= -Wno-float-conversion -Wno-missing-prototypes \ + -Wno-missing-variable-declarations -Wno-pedantic \ + -Wno-poison-system-directories -Wno-sign-conversion -Wno-strict-prototypes \ + -Wno-unused-macros +# +CWARN+= -Weverything +# +endif + +# Specific add-ons or replacements for gcc only +# +ifeq ($(CC),gcc) +# +#CSILENCE+= +# +#CWARN+= +# +endif + + +############################## +# Special flags for this entry +############################## +# +ENTRY= horton +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= gtface.data +TARGET= ${PROG} gtface ${PROG}.alt +# +ALT_OBJ= ${PROG}.alt.o +ALT_TARGET= ${PROG}.alt + + +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +gtface: gtface.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +${PROG}.alt: ${PROG}.alt.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1994/horton/README.md b/1994/horton/README.md index 0e6f9e7ca..49c349287 100644 --- a/1994/horton/README.md +++ b/1994/horton/README.md @@ -1,4 +1,4 @@ -Best Utility: +# Best Utility: Mark Horton AT&T Bell Labs @@ -7,29 +7,31 @@ Best Utility: Columbus OH 43213 USA +## To build: -Judges' comments: + make all + +### To run - To use: - make horton ./horton A B C D A, B, C, D are numeric arguments (try 3 2 1 0). +## Judges' comments + Try to figure out how this program prints, for a given slope, the right character. And for extra credit, try to figure out which character is at the bottom on this hint file. :-) This confuses cb greatly. See gtplot.c for an unobfuscated/enhanced - version. To compile it: + version. To run this alternate version: make horton.alt ./horton.alt A B C D A, B, C, D are numeric arguments (try 3 2 1 0). - -Selected notes from the author: +## Author's comments Run it with any 4 numeric arguments, e.g. prog 3 2 1 0. Play with the numbers to get a pleasing result, or use it for your high school algebra diff --git a/1994/imc/Makefile b/1994/imc/Makefile index 964287422..5fedaf5bb 100644 --- a/1994/imc/Makefile +++ b/1994/imc/Makefile @@ -1,157 +1,595 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1994 makefile +# IOCCC 1994 winning entry - imc + +################################################################################ # -# Copyright (c) 1994, Landon Curt Noll & Larry Bassel. -# All Rights Reserved. Permission for personal, educational or non-profit -# use is granted provided this this copyright and notice are included in its -# entirety and remains unaltered. All other uses must receive prior permission -# from Landon Curt Noll and Larry Bassel. - - -SHELL=/bin/sh -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true - -# flags for ANSI compiles +# An Historical Makefile NOTE: # -# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode, -# others such as gcc may want -ansi, others may want nothing -# at all. Adjust the CFLAGS line as needed. +# The orig.Makefile, if it exits, is the original Makefile before this IOCCC +# year directory was reworked so that entries are in separate directories. +# This also applies to any orig.ansi.mk and orig.common.mk files. # -# NOTE: Some compilers cannot optimize, or optimize some entries -# entries incorrectly. You might want need to turn on -O -# to see if your compiler can handle them. +# Several Makefiles were modified / formed in 2022, and as such it may have +# elements that are not historically compatible with way entries were built. +# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile. # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= - -# ANSI compiler +# Regarding individual entries: # -# Set CC to the name of your ANSI compiler. -#CC=cc -CC=gcc - -# winners that compile under ANSI C +# IOCCC winning entry code may not work on your system. Even with standards, +# conditions and build environments change, especially when it comes to more +# extreme code such you might find in an IOCCC winner. Moreover, what was +# allowed and liked in one IOCCC contest may no longer be liked/allowed in +# later IOCCC years. # -WINNERS= dodsond1 dodsond2 horton imc ldb schnitzi shapiro smr tvr weisberg \ - westley -ALT_NAMES= dodsond2.orig shapiro.alt horton.alt gtface weisberg.alt tvr.alt - -all: $(WINNERS) $(ALT_NAMES) - -westley: westley.c - ${CC} ${CFLAGS} westley.c -DO -o westley - -weisberg: weisberg.c - ${CC} ${CFLAGS} -Dc='n*n>x?p:((m=*(b+1)),N))' \ - -De='(2<<6*sizeof(int))' \ - -Do='(8<<5*sizeof(int))' \ - -DN='((b=t+1),x+=2,x>e?exit():o' \ - -Dp='(a-t shapiro_t2.c - -shapiro_t1: shapiro.c - ${CC} ${CFLAGS} shapiro.c -o shapiro_t1 - -shapiro.alt: shapiro.alt.c - ${CC} ${CFLAGS} shapiro.alt.c -o shapiro.alt - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -horton: horton.c - ${CC} ${CFLAGS} horton.c -o horton - -# Here are some programs related to the horton entry. See horton.hint -# for details. +# If you have a patch that might make running an entry work in modern Unix-like +# environments, please create a GitHub pull request for the IOCCC judges to +# consider. # -horton.alt: horton.alt.c - ${CC} ${CFLAGS} horton.alt.c -o horton.alt -gtface: gtface.c - ${CC} ${CFLAGS} gtface.c -o gtface - -ldb: ldb.c - ${CC} ${CFLAGS} ldb.c -o ldb - -imc: imc.c - ${CC} ${CFLAGS} imc.c -o imc - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 - -# NOTE: this is the original (gziped) file that won +# Suggestions and corrections regarding Makefiles, winning author information, +# fixing typos in remarks, and code patches are welcome via opening a GitHub +# issue or better yet, by creating a GitHub pull request for the IOCCC judges +# to consider. To form a GitHub issue or GitHub pull, please visit: # -dodsond2.orig: dodsond2.gz - @${RM} -f dodsond2.orig.c - -${GUNZIP} < dodsond2.gz > dodsond2.orig.c - -@if [ -s dodsond2.orig.c ]; then \ - echo "${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig"; \ - ${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig; \ - else \ - ${RM} -f dodsond2.orig.c; \ - echo "sorry, we could not gunzip dodsond2.gz"; \ - fi +# https://github.com/ioccc-src/winner +# +################################################################################ -dodsond2.gz: dodsond2.gz.uu - @${RM} -f dodsond2.gz - ${UUDECODE} dodsond2.gz.uu +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: +# +# Creative Commons Attribution-ShareAlike 3.0 Unported License. +# +# See: http://creativecommons.org/licenses/by-sa/3.0/ -dodsond1: dodsond1.c - ${CC} ${CFLAGS} dodsond1.c -o dodsond1 -clean: - $(RM) -f *.o a.out core +############################# +# shell used by this Makefile +############################# +# +SHELL= bash -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - ${RM} -f dodsond2.orig.c dodsond2.gz shapiro_t2.c shapiro_t1 +####################### +# common tool locations +####################### +# +A2P= a2p +AR= ar +ASA= asa +AT= at +ATQ= atq +ATRM= atrm +AWK= awk +BANNER= banner +BASE64= base64 +BASENAME= basename +BATCH= batch +BC= bc +BINHEX= binhex +BISON= bison +BUNZIP2= bunzip2 +BZCAT= bzcat +BZCMP= bzcmp +BZDIFF= bzdiff +BZEGREP= bzegrep +BZFGREP= bzfgrep +BZGREP= bzgrep +BZIP2= bzip2 +BZLESS= bzless +BZMORE= bzmore +C2PH= c2ph +C89= c89 +C99= c99 +CAL= cal +CALC= calc +CAT= cat +CD= cd +CHFLAGS= chflags +CHGRP= chgrp +CHMOD= chmod +CKSUM= cksum +CLANG= clang +CLANG_PLUSPLUS= clang++ +CLEAR= clear +CMP= cmp +COL= col +COLLDEF= colldef +COLRM= colrm +COLUMN= column +COMPRESS= compress +CP= cp +CPIO= cpio +CPP= cpp +CRC32= crc32 +CSH= csh +CSPLIT= csplit +CURL= curl +CUT= cut +C_PLUSPLUS= c++ +C_PLUSPLUS_FILT= c++filt +DATE= date +DC= dc +DD= dd +DF= df +DIFF3= diff3 +DIFF= diff +DIG= dig +DIRNAME= dirname +ED= ed +EGREP= egrep +ENV= env +EQN= eqn +ETAGS= etags +EXPECT= expect +EXPR= expr +FALSE= false +FGREP= fgrep +FILE= file +FIND2PERL= find2perl +FIND= find +FLEX= flex +FLEX_PLUSPLUS= flex++ +FMT= fmt +FOLD= fold +FS_USAGE= fs_usage +FUNZIP= funzip +FUSER= fuser +GCC= gcc +GDIFFMK= gdiffmk +GENCAT= gencat +GENSTRINGS= genstrings +GETOPT= getopt +GETOPTS= getopts +GINDENT= gindent +GNUMAKE= gnumake +GREP= grep +GROFF= groff +GROFFER= groffer +GROG= grog +GROPS= grops +GROTTY= grotty +GUNZIP= gunzip +GVIM= gvim +GZCAT= gzcat +GZEXE= gzexe +GZIP_PROG= gzip +G_PLUSPLUS= g++ +H2PH= h2ph +H2XS= h2xs +HASH= hash +HEAD= head +HOSTNAME_PROG= hostname +ICONV= iconv +ID= id +INDENT= indent +INFO= info +JOT= jot +KILL= kill +KSH= ksh +LAST= last +LD= ld +LESSECHO= lessecho +LEX= len +LINK= link +LN= ln +LS= ls +M4= m4 +MAKE= make +MAN= man +MKDIR= mkdir +MKFIFO= mkfifo +MKTEMP= mktemp +MV= mv +NANO= nano +NASM= nasm +NEQN= neqn +NICE= nice +NL= nl +NM= nm +NOHUP= nohup +NROFF= nroff +NSLOOKUP= nslookup +OD= od +OPENSSL= openssl +PASTE= paste +PATCH= patch +PATHCHK= pathchk +PAX= pax +PERL= perl +PICO= pico +PR= pr +PRINTENV= printenv +PS= ps +PTAR= ptar +PTARDIFF= ptardiff +PTARGREP= ptargrep +PWD= pwd +PYDOC= pydoc +PYTHON= python +PYTHONW= pythonw +READLINK= readlink +RENICE= renice +RESET= reset +REV= rev +RI= ri +RM= rm +RMDIR= rmdir +RSYNC= rsync +RUBY= ruby +RVIM= rvim +SAY= say +SCP= scp +SCREEN= screen +SCRIPT= script +SDIFF= sdiff +SED= sed +SEQ= seq +SFTP= sftp +SH= sh +SHA1= sha1 +SHA= sha +SHAR= shar +SHASUM5_18= shasum5.18 +SHASUM= shasum +SIZE= size +SLEEP= sleep +SORT= sort +SSH= ssh +STAT= stat +STRIP= strip +STTY= stty +SUM= sum +SYNC= sync +TABS= tabs +TAIL= tail +TAR= tar +TEE= tee +TEST= test +TFTP= tftp +TIDY= tidy +TIME= time +TOP= top +TOUCH= touch +TPUT= tout +TPUT= tput +TR= tr +TROFF= troff +TRUE= true +TSET= tset +TSORT= tsort +UL= ul +UNAME= uname +UNCOMPRESS= uncompress +UNEXPAND= unexpand +UNIFDEF= unifdef +UNIFDEFALL= unifdefall +UNIQ= uniq +UNITS= units +UNLINK= unlink +UNZIP= unzip +UNZIPSFX= unzipsfx +UPTIME= uptime +UUDECODE= uudecode +UUENCODE= uuencode +UUIDGEN= uuidgen +VI= vi +VIEW= view +VIM= vim +VIMDIFF= vimdiff +W= w +WAIT4PATH= wait4path +WAIT= wait +WC= wc +WGET= wget +WHAT= what +WHATIS= whatis +WHICH= which +WHO= who +WHOAMI= whoami +WHOIS= whois +1WRTIE= write +XAR= xar +XARGS= xargs +XATTR= xattr +XXD= xxd +YACC= yacc +YES= yes +ZCAT= zcat +ZCMP= zcmp +ZDIFF= zdiff +ZEGREP= zegrep +ZFGREP= zfgrep +ZFORCE= zforce +ZGREP= zgrep +ZIP= zip +ZIPCLOAK= zipcloak +ZIPGREp= zipgrep +ZIPINFo= zipinfo +ZIPNOTE= zipnote +ZIPSPLIT= zipsplit +ZLESS= zless +ZMORE= zmore +ZNEW= znew +ZPRINT= zprint +ZSH= zsh -nuke: clobber +# Set X11_LIBDIR to the directory where the X11 library resides +# +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside +# +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# Common C compiler warnings to silence +# +#CSILENCE= +CSILENCE= -Wno-error -Wno-implicit-function-declaration + +# Common C compiler warning flags +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +# Compiler standard +# +#CSTD= +#CSTD= -ansi +CSTD= -std=gnu90 + +# Compiler bit architecture +# +# Some entries require 32-bitness: +# ARCH= -m32 +# +# Some entries require 64-bitness: +# ARCH= -m64 +# +# By default we assume nothing: +# +ARCH= + +# Defines that are needed to compile +# +CDEFINE= +#CDEFINE= -DIOCCC + +# Include files that are needed to compile +# +CINCLUDE= +#CINCLUDE= -include stdlib.h +#CINCLUDE= -include stdio.h +#CINCLUDE= -include stdlib.h -include stdio.h +#CINCLUDE= -I ${X11_INCDIR} +#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 + +# Optimization +# +# Most compiles will safely use -O2. Some can use only -O1 or -O. +# A few compilers have broken optimizers or this entry make break +# under those buggy optimizers and thus you may not want anything. +# Reasonable compilers will allow for -O3. +# +#OPT= +#OPT= -O +#OPT= -O1 +#OPT= -O2 +OPT= -O3 + +# Default flags for ANSI C compilation +# +CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT} + +# Libraries needed to build +# +LIBS= +#LIBS= -lm +#LIBS= -L ${X11_LIBDIR} -lX11 +#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL + +# C compiler to use +# +CC= cc +#CC=clang +#CC=gcc + +# Compiler add-ons or replacements for clang only +# +ifeq ($(CC),clang) +# +CSILENCE+= -Wno-comma -Wno-conditional-uninitialized -Wno-missing-prototypes \ + -Wno-missing-variable-declarations -Wno-poison-system-directories \ + -Wno-shadow -Wno-sign-conversion -Wno-strict-prototypes +# +CWARN+= -Weverything +# +endif + +# Specific add-ons or replacements for gcc only +# +ifeq ($(CC),gcc) +# +#CSILENCE+= +# +#CWARN+= +# +endif + + +############################## +# Special flags for this entry +############################## +# +ENTRY= imc +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= + + +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1994/imc/README.md b/1994/imc/README.md index 4679ff4d1..68f022b70 100644 --- a/1994/imc/README.md +++ b/1994/imc/README.md @@ -1,4 +1,4 @@ -Most Obfuscated Algorithm: +# Most Obfuscated Algorithm: Ian Collier Oxford University @@ -7,13 +7,17 @@ Most Obfuscated Algorithm: BL3 4LG England +## To build: -Judges' comments: + make all + +### To run To use: - make imc ./imc INTEGER +## Judges' comments + Try: ./imc 3 ./imc 3 @@ -23,8 +27,7 @@ Judges' comments: This entry's algorithm is as magic as its output! - -Selected notes from the author: +## Author's comments This program may be compiled with an ANSI or K&R compiler. A few harmless warnings are displayed only if "gcc -Wall" is used. diff --git a/1994/ldb/Makefile b/1994/ldb/Makefile index 964287422..775f09661 100644 --- a/1994/ldb/Makefile +++ b/1994/ldb/Makefile @@ -1,157 +1,593 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1994 makefile +# IOCCC 1994 winning entry - ldb + +################################################################################ # -# Copyright (c) 1994, Landon Curt Noll & Larry Bassel. -# All Rights Reserved. Permission for personal, educational or non-profit -# use is granted provided this this copyright and notice are included in its -# entirety and remains unaltered. All other uses must receive prior permission -# from Landon Curt Noll and Larry Bassel. - - -SHELL=/bin/sh -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true - -# flags for ANSI compiles +# An Historical Makefile NOTE: # -# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode, -# others such as gcc may want -ansi, others may want nothing -# at all. Adjust the CFLAGS line as needed. +# The orig.Makefile, if it exits, is the original Makefile before this IOCCC +# year directory was reworked so that entries are in separate directories. +# This also applies to any orig.ansi.mk and orig.common.mk files. # -# NOTE: Some compilers cannot optimize, or optimize some entries -# entries incorrectly. You might want need to turn on -O -# to see if your compiler can handle them. +# Several Makefiles were modified / formed in 2022, and as such it may have +# elements that are not historically compatible with way entries were built. +# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile. # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= - -# ANSI compiler +# Regarding individual entries: # -# Set CC to the name of your ANSI compiler. -#CC=cc -CC=gcc - -# winners that compile under ANSI C +# IOCCC winning entry code may not work on your system. Even with standards, +# conditions and build environments change, especially when it comes to more +# extreme code such you might find in an IOCCC winner. Moreover, what was +# allowed and liked in one IOCCC contest may no longer be liked/allowed in +# later IOCCC years. # -WINNERS= dodsond1 dodsond2 horton imc ldb schnitzi shapiro smr tvr weisberg \ - westley -ALT_NAMES= dodsond2.orig shapiro.alt horton.alt gtface weisberg.alt tvr.alt - -all: $(WINNERS) $(ALT_NAMES) - -westley: westley.c - ${CC} ${CFLAGS} westley.c -DO -o westley - -weisberg: weisberg.c - ${CC} ${CFLAGS} -Dc='n*n>x?p:((m=*(b+1)),N))' \ - -De='(2<<6*sizeof(int))' \ - -Do='(8<<5*sizeof(int))' \ - -DN='((b=t+1),x+=2,x>e?exit():o' \ - -Dp='(a-t shapiro_t2.c - -shapiro_t1: shapiro.c - ${CC} ${CFLAGS} shapiro.c -o shapiro_t1 - -shapiro.alt: shapiro.alt.c - ${CC} ${CFLAGS} shapiro.alt.c -o shapiro.alt - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -horton: horton.c - ${CC} ${CFLAGS} horton.c -o horton - -# Here are some programs related to the horton entry. See horton.hint -# for details. +# If you have a patch that might make running an entry work in modern Unix-like +# environments, please create a GitHub pull request for the IOCCC judges to +# consider. # -horton.alt: horton.alt.c - ${CC} ${CFLAGS} horton.alt.c -o horton.alt -gtface: gtface.c - ${CC} ${CFLAGS} gtface.c -o gtface - -ldb: ldb.c - ${CC} ${CFLAGS} ldb.c -o ldb - -imc: imc.c - ${CC} ${CFLAGS} imc.c -o imc - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 - -# NOTE: this is the original (gziped) file that won +# Suggestions and corrections regarding Makefiles, winning author information, +# fixing typos in remarks, and code patches are welcome via opening a GitHub +# issue or better yet, by creating a GitHub pull request for the IOCCC judges +# to consider. To form a GitHub issue or GitHub pull, please visit: # -dodsond2.orig: dodsond2.gz - @${RM} -f dodsond2.orig.c - -${GUNZIP} < dodsond2.gz > dodsond2.orig.c - -@if [ -s dodsond2.orig.c ]; then \ - echo "${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig"; \ - ${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig; \ - else \ - ${RM} -f dodsond2.orig.c; \ - echo "sorry, we could not gunzip dodsond2.gz"; \ - fi +# https://github.com/ioccc-src/winner +# +################################################################################ -dodsond2.gz: dodsond2.gz.uu - @${RM} -f dodsond2.gz - ${UUDECODE} dodsond2.gz.uu +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: +# +# Creative Commons Attribution-ShareAlike 3.0 Unported License. +# +# See: http://creativecommons.org/licenses/by-sa/3.0/ -dodsond1: dodsond1.c - ${CC} ${CFLAGS} dodsond1.c -o dodsond1 -clean: - $(RM) -f *.o a.out core +############################# +# shell used by this Makefile +############################# +# +SHELL= bash -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - ${RM} -f dodsond2.orig.c dodsond2.gz shapiro_t2.c shapiro_t1 +####################### +# common tool locations +####################### +# +A2P= a2p +AR= ar +ASA= asa +AT= at +ATQ= atq +ATRM= atrm +AWK= awk +BANNER= banner +BASE64= base64 +BASENAME= basename +BATCH= batch +BC= bc +BINHEX= binhex +BISON= bison +BUNZIP2= bunzip2 +BZCAT= bzcat +BZCMP= bzcmp +BZDIFF= bzdiff +BZEGREP= bzegrep +BZFGREP= bzfgrep +BZGREP= bzgrep +BZIP2= bzip2 +BZLESS= bzless +BZMORE= bzmore +C2PH= c2ph +C89= c89 +C99= c99 +CAL= cal +CALC= calc +CAT= cat +CD= cd +CHFLAGS= chflags +CHGRP= chgrp +CHMOD= chmod +CKSUM= cksum +CLANG= clang +CLANG_PLUSPLUS= clang++ +CLEAR= clear +CMP= cmp +COL= col +COLLDEF= colldef +COLRM= colrm +COLUMN= column +COMPRESS= compress +CP= cp +CPIO= cpio +CPP= cpp +CRC32= crc32 +CSH= csh +CSPLIT= csplit +CURL= curl +CUT= cut +C_PLUSPLUS= c++ +C_PLUSPLUS_FILT= c++filt +DATE= date +DC= dc +DD= dd +DF= df +DIFF3= diff3 +DIFF= diff +DIG= dig +DIRNAME= dirname +ED= ed +EGREP= egrep +ENV= env +EQN= eqn +ETAGS= etags +EXPECT= expect +EXPR= expr +FALSE= false +FGREP= fgrep +FILE= file +FIND2PERL= find2perl +FIND= find +FLEX= flex +FLEX_PLUSPLUS= flex++ +FMT= fmt +FOLD= fold +FS_USAGE= fs_usage +FUNZIP= funzip +FUSER= fuser +GCC= gcc +GDIFFMK= gdiffmk +GENCAT= gencat +GENSTRINGS= genstrings +GETOPT= getopt +GETOPTS= getopts +GINDENT= gindent +GNUMAKE= gnumake +GREP= grep +GROFF= groff +GROFFER= groffer +GROG= grog +GROPS= grops +GROTTY= grotty +GUNZIP= gunzip +GVIM= gvim +GZCAT= gzcat +GZEXE= gzexe +GZIP_PROG= gzip +G_PLUSPLUS= g++ +H2PH= h2ph +H2XS= h2xs +HASH= hash +HEAD= head +HOSTNAME_PROG= hostname +ICONV= iconv +ID= id +INDENT= indent +INFO= info +JOT= jot +KILL= kill +KSH= ksh +LAST= last +LD= ld +LESSECHO= lessecho +LEX= len +LINK= link +LN= ln +LS= ls +M4= m4 +MAKE= make +MAN= man +MKDIR= mkdir +MKFIFO= mkfifo +MKTEMP= mktemp +MV= mv +NANO= nano +NASM= nasm +NEQN= neqn +NICE= nice +NL= nl +NM= nm +NOHUP= nohup +NROFF= nroff +NSLOOKUP= nslookup +OD= od +OPENSSL= openssl +PASTE= paste +PATCH= patch +PATHCHK= pathchk +PAX= pax +PERL= perl +PICO= pico +PR= pr +PRINTENV= printenv +PS= ps +PTAR= ptar +PTARDIFF= ptardiff +PTARGREP= ptargrep +PWD= pwd +PYDOC= pydoc +PYTHON= python +PYTHONW= pythonw +READLINK= readlink +RENICE= renice +RESET= reset +REV= rev +RI= ri +RM= rm +RMDIR= rmdir +RSYNC= rsync +RUBY= ruby +RVIM= rvim +SAY= say +SCP= scp +SCREEN= screen +SCRIPT= script +SDIFF= sdiff +SED= sed +SEQ= seq +SFTP= sftp +SH= sh +SHA1= sha1 +SHA= sha +SHAR= shar +SHASUM5_18= shasum5.18 +SHASUM= shasum +SIZE= size +SLEEP= sleep +SORT= sort +SSH= ssh +STAT= stat +STRIP= strip +STTY= stty +SUM= sum +SYNC= sync +TABS= tabs +TAIL= tail +TAR= tar +TEE= tee +TEST= test +TFTP= tftp +TIDY= tidy +TIME= time +TOP= top +TOUCH= touch +TPUT= tout +TPUT= tput +TR= tr +TROFF= troff +TRUE= true +TSET= tset +TSORT= tsort +UL= ul +UNAME= uname +UNCOMPRESS= uncompress +UNEXPAND= unexpand +UNIFDEF= unifdef +UNIFDEFALL= unifdefall +UNIQ= uniq +UNITS= units +UNLINK= unlink +UNZIP= unzip +UNZIPSFX= unzipsfx +UPTIME= uptime +UUDECODE= uudecode +UUENCODE= uuencode +UUIDGEN= uuidgen +VI= vi +VIEW= view +VIM= vim +VIMDIFF= vimdiff +W= w +WAIT4PATH= wait4path +WAIT= wait +WC= wc +WGET= wget +WHAT= what +WHATIS= whatis +WHICH= which +WHO= who +WHOAMI= whoami +WHOIS= whois +1WRTIE= write +XAR= xar +XARGS= xargs +XATTR= xattr +XXD= xxd +YACC= yacc +YES= yes +ZCAT= zcat +ZCMP= zcmp +ZDIFF= zdiff +ZEGREP= zegrep +ZFGREP= zfgrep +ZFORCE= zforce +ZGREP= zgrep +ZIP= zip +ZIPCLOAK= zipcloak +ZIPGREp= zipgrep +ZIPINFo= zipinfo +ZIPNOTE= zipnote +ZIPSPLIT= zipsplit +ZLESS= zless +ZMORE= zmore +ZNEW= znew +ZPRINT= zprint +ZSH= zsh -nuke: clobber +# Set X11_LIBDIR to the directory where the X11 library resides +# +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside +# +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# Common C compiler warnings to silence +# +#CSILENCE= +CSILENCE= -Wno-trigraphs + +# Common C compiler warning flags +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +# Compiler standard +# +#CSTD= +#CSTD= -ansi +CSTD= -std=gnu90 + +# Compiler bit architecture +# +# Some entries require 32-bitness: +# ARCH= -m32 +# +# Some entries require 64-bitness: +# ARCH= -m64 +# +# By default we assume nothing: +# +ARCH= + +# Defines that are needed to compile +# +CDEFINE= +#CDEFINE= -DIOCCC + +# Include files that are needed to compile +# +CINCLUDE= +#CINCLUDE= -include stdlib.h +#CINCLUDE= -include stdio.h +#CINCLUDE= -include stdlib.h -include stdio.h +#CINCLUDE= -I ${X11_INCDIR} +#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 + +# Optimization +# +# Most compiles will safely use -O2. Some can use only -O1 or -O. +# A few compilers have broken optimizers or this entry make break +# under those buggy optimizers and thus you may not want anything. +# Reasonable compilers will allow for -O3. +# +#OPT= +#OPT= -O +#OPT= -O1 +#OPT= -O2 +OPT= -O3 + +# Default flags for ANSI C compilation +# +CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT} + +# Libraries needed to build +# +LIBS= +#LIBS= -lm +#LIBS= -L ${X11_LIBDIR} -lX11 +#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL + +# C compiler to use +# +CC= cc +#CC=clang +#CC=gcc + +# Compiler add-ons or replacements for clang only +# +ifeq ($(CC),clang) +# +CSILENCE+= -Wno-missing-variable-declarations -Wno-poison-system-directories +# +CWARN+= -Weverything +# +endif + +# Specific add-ons or replacements for gcc only +# +ifeq ($(CC),gcc) +# +#CSILENCE+= +# +#CWARN+= +# +endif + + +############################## +# Special flags for this entry +############################## +# +ENTRY= ldb +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= + + +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1994/ldb/README.md b/1994/ldb/README.md index ced51b55b..5df2ce072 100644 --- a/1994/ldb/README.md +++ b/1994/ldb/README.md @@ -1,4 +1,4 @@ -Best One-liner: +# Best One-liner: Laurion Burchall Brown University @@ -6,23 +6,25 @@ Best One-liner: Providence RI 02912-4641 USA +## To build: -Judges' comments: + make all + +### To run - To use: - make ldb ./ldb < file Try: ./ldb < /etc/passwd +## Judges' comments + Tri-graphs are natural obfuscators. Most C-beautifiers become C-uglifiers because they don't handle them correctly. Can you figure out how it prints a given random line from stdin? - -Selected notes from the author: +## Author's comments All input lines must be under 232 characters long. The compiling platform should be ASCII based. diff --git a/1994/schnitzi/Makefile b/1994/schnitzi/Makefile index 964287422..103bf0caa 100644 --- a/1994/schnitzi/Makefile +++ b/1994/schnitzi/Makefile @@ -1,157 +1,617 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1994 makefile +# IOCCC 1994 winning entry - schnitzi + +################################################################################ # -# Copyright (c) 1994, Landon Curt Noll & Larry Bassel. -# All Rights Reserved. Permission for personal, educational or non-profit -# use is granted provided this this copyright and notice are included in its -# entirety and remains unaltered. All other uses must receive prior permission -# from Landon Curt Noll and Larry Bassel. +# 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 -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true +############################# +# shell used by this Makefile +############################# +# +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. +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 # -# 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. +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # # Set CC to the name of your ANSI compiler. -#CC=cc -CC=gcc - -# winners that compile under ANSI C # -WINNERS= dodsond1 dodsond2 horton imc ldb schnitzi shapiro smr tvr weisberg \ - westley -ALT_NAMES= dodsond2.orig shapiro.alt horton.alt gtface weisberg.alt tvr.alt - -all: $(WINNERS) $(ALT_NAMES) - -westley: westley.c - ${CC} ${CFLAGS} westley.c -DO -o westley - -weisberg: weisberg.c - ${CC} ${CFLAGS} -Dc='n*n>x?p:((m=*(b+1)),N))' \ - -De='(2<<6*sizeof(int))' \ - -Do='(8<<5*sizeof(int))' \ - -DN='((b=t+1),x+=2,x>e?exit():o' \ - -Dp='(a-t shapiro_t2.c - -shapiro_t1: shapiro.c - ${CC} ${CFLAGS} shapiro.c -o shapiro_t1 - -shapiro.alt: shapiro.alt.c - ${CC} ${CFLAGS} shapiro.alt.c -o shapiro.alt - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -horton: horton.c - ${CC} ${CFLAGS} horton.c -o horton - -# Here are some programs related to the horton entry. See horton.hint -# for details. +############################## +# Special flags for this entry +############################## # -horton.alt: horton.alt.c - ${CC} ${CFLAGS} horton.alt.c -o horton.alt -gtface: gtface.c - ${CC} ${CFLAGS} gtface.c -o gtface - -ldb: ldb.c - ${CC} ${CFLAGS} ldb.c -o ldb - -imc: imc.c - ${CC} ${CFLAGS} imc.c -o imc - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 - -# NOTE: this is the original (gziped) file that won +ENTRY= schnitzi +PROG= ${ENTRY} # -dodsond2.orig: dodsond2.gz - @${RM} -f dodsond2.orig.c - -${GUNZIP} < dodsond2.gz > dodsond2.orig.c - -@if [ -s dodsond2.orig.c ]; then \ - echo "${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig"; \ - ${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig; \ - else \ - ${RM} -f dodsond2.orig.c; \ - echo "sorry, we could not gunzip dodsond2.gz"; \ - fi +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= -dodsond2.gz: dodsond2.gz.uu - @${RM} -f dodsond2.gz - ${UUDECODE} dodsond2.gz.uu -dodsond1: dodsond1.c - ${CC} ${CFLAGS} dodsond1.c -o dodsond1 - -clean: - $(RM) -f *.o a.out core - -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - ${RM} -f dodsond2.orig.c dodsond2.gz shapiro_t2.c shapiro_t1 - -nuke: clobber +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1994/shapiro/Makefile b/1994/shapiro/Makefile index 964287422..949c064e6 100644 --- a/1994/shapiro/Makefile +++ b/1994/shapiro/Makefile @@ -1,157 +1,617 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1994 makefile +# IOCCC 1994 winning entry - shapiro + +################################################################################ # -# Copyright (c) 1994, Landon Curt Noll & Larry Bassel. -# All Rights Reserved. Permission for personal, educational or non-profit -# use is granted provided this this copyright and notice are included in its -# entirety and remains unaltered. All other uses must receive prior permission -# from Landon Curt Noll and Larry Bassel. +# 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 -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true +############################# +# shell used by this Makefile +############################# +# +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. +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 # -# 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. +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # # Set CC to the name of your ANSI compiler. -#CC=cc -CC=gcc - -# winners that compile under ANSI C # -WINNERS= dodsond1 dodsond2 horton imc ldb schnitzi shapiro smr tvr weisberg \ - westley -ALT_NAMES= dodsond2.orig shapiro.alt horton.alt gtface weisberg.alt tvr.alt - -all: $(WINNERS) $(ALT_NAMES) - -westley: westley.c - ${CC} ${CFLAGS} westley.c -DO -o westley - -weisberg: weisberg.c - ${CC} ${CFLAGS} -Dc='n*n>x?p:((m=*(b+1)),N))' \ - -De='(2<<6*sizeof(int))' \ - -Do='(8<<5*sizeof(int))' \ - -DN='((b=t+1),x+=2,x>e?exit():o' \ - -Dp='(a-t shapiro_t2.c - -shapiro_t1: shapiro.c - ${CC} ${CFLAGS} shapiro.c -o shapiro_t1 - -shapiro.alt: shapiro.alt.c - ${CC} ${CFLAGS} shapiro.alt.c -o shapiro.alt - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -horton: horton.c - ${CC} ${CFLAGS} horton.c -o horton - -# Here are some programs related to the horton entry. See horton.hint -# for details. +############################## +# Special flags for this entry +############################## # -horton.alt: horton.alt.c - ${CC} ${CFLAGS} horton.alt.c -o horton.alt -gtface: gtface.c - ${CC} ${CFLAGS} gtface.c -o gtface - -ldb: ldb.c - ${CC} ${CFLAGS} ldb.c -o ldb - -imc: imc.c - ${CC} ${CFLAGS} imc.c -o imc - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 - -# NOTE: this is the original (gziped) file that won +ENTRY= shapiro +PROG= ${ENTRY} # -dodsond2.orig: dodsond2.gz - @${RM} -f dodsond2.orig.c - -${GUNZIP} < dodsond2.gz > dodsond2.orig.c - -@if [ -s dodsond2.orig.c ]; then \ - echo "${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig"; \ - ${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig; \ - else \ - ${RM} -f dodsond2.orig.c; \ - echo "sorry, we could not gunzip dodsond2.gz"; \ - fi +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= -dodsond2.gz: dodsond2.gz.uu - @${RM} -f dodsond2.gz - ${UUDECODE} dodsond2.gz.uu -dodsond1: dodsond1.c - ${CC} ${CFLAGS} dodsond1.c -o dodsond1 - -clean: - $(RM) -f *.o a.out core - -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - ${RM} -f dodsond2.orig.c dodsond2.gz shapiro_t2.c shapiro_t1 - -nuke: clobber +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1994/smr/Makefile b/1994/smr/Makefile index 964287422..0fa7ca16f 100644 --- a/1994/smr/Makefile +++ b/1994/smr/Makefile @@ -1,157 +1,617 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1994 makefile +# IOCCC 1994 winning entry - smr + +################################################################################ # -# Copyright (c) 1994, Landon Curt Noll & Larry Bassel. -# All Rights Reserved. Permission for personal, educational or non-profit -# use is granted provided this this copyright and notice are included in its -# entirety and remains unaltered. All other uses must receive prior permission -# from Landon Curt Noll and Larry Bassel. +# 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 -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true +############################# +# shell used by this Makefile +############################# +# +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. +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 # -# 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. +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # # Set CC to the name of your ANSI compiler. -#CC=cc -CC=gcc - -# winners that compile under ANSI C # -WINNERS= dodsond1 dodsond2 horton imc ldb schnitzi shapiro smr tvr weisberg \ - westley -ALT_NAMES= dodsond2.orig shapiro.alt horton.alt gtface weisberg.alt tvr.alt - -all: $(WINNERS) $(ALT_NAMES) - -westley: westley.c - ${CC} ${CFLAGS} westley.c -DO -o westley - -weisberg: weisberg.c - ${CC} ${CFLAGS} -Dc='n*n>x?p:((m=*(b+1)),N))' \ - -De='(2<<6*sizeof(int))' \ - -Do='(8<<5*sizeof(int))' \ - -DN='((b=t+1),x+=2,x>e?exit():o' \ - -Dp='(a-t shapiro_t2.c - -shapiro_t1: shapiro.c - ${CC} ${CFLAGS} shapiro.c -o shapiro_t1 - -shapiro.alt: shapiro.alt.c - ${CC} ${CFLAGS} shapiro.alt.c -o shapiro.alt - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -horton: horton.c - ${CC} ${CFLAGS} horton.c -o horton - -# Here are some programs related to the horton entry. See horton.hint -# for details. +############################## +# Special flags for this entry +############################## # -horton.alt: horton.alt.c - ${CC} ${CFLAGS} horton.alt.c -o horton.alt -gtface: gtface.c - ${CC} ${CFLAGS} gtface.c -o gtface - -ldb: ldb.c - ${CC} ${CFLAGS} ldb.c -o ldb - -imc: imc.c - ${CC} ${CFLAGS} imc.c -o imc - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 - -# NOTE: this is the original (gziped) file that won +ENTRY= smr +PROG= ${ENTRY} # -dodsond2.orig: dodsond2.gz - @${RM} -f dodsond2.orig.c - -${GUNZIP} < dodsond2.gz > dodsond2.orig.c - -@if [ -s dodsond2.orig.c ]; then \ - echo "${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig"; \ - ${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig; \ - else \ - ${RM} -f dodsond2.orig.c; \ - echo "sorry, we could not gunzip dodsond2.gz"; \ - fi +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= -dodsond2.gz: dodsond2.gz.uu - @${RM} -f dodsond2.gz - ${UUDECODE} dodsond2.gz.uu -dodsond1: dodsond1.c - ${CC} ${CFLAGS} dodsond1.c -o dodsond1 - -clean: - $(RM) -f *.o a.out core - -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - ${RM} -f dodsond2.orig.c dodsond2.gz shapiro_t2.c shapiro_t1 - -nuke: clobber +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1994/tvr/Makefile b/1994/tvr/Makefile index 964287422..49a191b71 100644 --- a/1994/tvr/Makefile +++ b/1994/tvr/Makefile @@ -1,157 +1,617 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1994 makefile +# IOCCC 1994 winning entry - tvr + +################################################################################ # -# Copyright (c) 1994, Landon Curt Noll & Larry Bassel. -# All Rights Reserved. Permission for personal, educational or non-profit -# use is granted provided this this copyright and notice are included in its -# entirety and remains unaltered. All other uses must receive prior permission -# from Landon Curt Noll and Larry Bassel. +# 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 -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true +############################# +# shell used by this Makefile +############################# +# +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. +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 # -# 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. +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # # Set CC to the name of your ANSI compiler. -#CC=cc -CC=gcc - -# winners that compile under ANSI C # -WINNERS= dodsond1 dodsond2 horton imc ldb schnitzi shapiro smr tvr weisberg \ - westley -ALT_NAMES= dodsond2.orig shapiro.alt horton.alt gtface weisberg.alt tvr.alt - -all: $(WINNERS) $(ALT_NAMES) - -westley: westley.c - ${CC} ${CFLAGS} westley.c -DO -o westley - -weisberg: weisberg.c - ${CC} ${CFLAGS} -Dc='n*n>x?p:((m=*(b+1)),N))' \ - -De='(2<<6*sizeof(int))' \ - -Do='(8<<5*sizeof(int))' \ - -DN='((b=t+1),x+=2,x>e?exit():o' \ - -Dp='(a-t shapiro_t2.c - -shapiro_t1: shapiro.c - ${CC} ${CFLAGS} shapiro.c -o shapiro_t1 - -shapiro.alt: shapiro.alt.c - ${CC} ${CFLAGS} shapiro.alt.c -o shapiro.alt - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -horton: horton.c - ${CC} ${CFLAGS} horton.c -o horton - -# Here are some programs related to the horton entry. See horton.hint -# for details. +############################## +# Special flags for this entry +############################## # -horton.alt: horton.alt.c - ${CC} ${CFLAGS} horton.alt.c -o horton.alt -gtface: gtface.c - ${CC} ${CFLAGS} gtface.c -o gtface - -ldb: ldb.c - ${CC} ${CFLAGS} ldb.c -o ldb - -imc: imc.c - ${CC} ${CFLAGS} imc.c -o imc - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 - -# NOTE: this is the original (gziped) file that won +ENTRY= tvr +PROG= ${ENTRY} # -dodsond2.orig: dodsond2.gz - @${RM} -f dodsond2.orig.c - -${GUNZIP} < dodsond2.gz > dodsond2.orig.c - -@if [ -s dodsond2.orig.c ]; then \ - echo "${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig"; \ - ${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig; \ - else \ - ${RM} -f dodsond2.orig.c; \ - echo "sorry, we could not gunzip dodsond2.gz"; \ - fi +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= -dodsond2.gz: dodsond2.gz.uu - @${RM} -f dodsond2.gz - ${UUDECODE} dodsond2.gz.uu -dodsond1: dodsond1.c - ${CC} ${CFLAGS} dodsond1.c -o dodsond1 - -clean: - $(RM) -f *.o a.out core - -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - ${RM} -f dodsond2.orig.c dodsond2.gz shapiro_t2.c shapiro_t1 - -nuke: clobber +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1994/weisberg/Makefile b/1994/weisberg/Makefile index 964287422..9a1f2b79a 100644 --- a/1994/weisberg/Makefile +++ b/1994/weisberg/Makefile @@ -1,157 +1,617 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1994 makefile +# IOCCC 1994 winning entry - weisberg + +################################################################################ # -# Copyright (c) 1994, Landon Curt Noll & Larry Bassel. -# All Rights Reserved. Permission for personal, educational or non-profit -# use is granted provided this this copyright and notice are included in its -# entirety and remains unaltered. All other uses must receive prior permission -# from Landon Curt Noll and Larry Bassel. +# 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 -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true +############################# +# shell used by this Makefile +############################# +# +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. +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 # -# 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. +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # # Set CC to the name of your ANSI compiler. -#CC=cc -CC=gcc - -# winners that compile under ANSI C # -WINNERS= dodsond1 dodsond2 horton imc ldb schnitzi shapiro smr tvr weisberg \ - westley -ALT_NAMES= dodsond2.orig shapiro.alt horton.alt gtface weisberg.alt tvr.alt - -all: $(WINNERS) $(ALT_NAMES) - -westley: westley.c - ${CC} ${CFLAGS} westley.c -DO -o westley - -weisberg: weisberg.c - ${CC} ${CFLAGS} -Dc='n*n>x?p:((m=*(b+1)),N))' \ - -De='(2<<6*sizeof(int))' \ - -Do='(8<<5*sizeof(int))' \ - -DN='((b=t+1),x+=2,x>e?exit():o' \ - -Dp='(a-t shapiro_t2.c - -shapiro_t1: shapiro.c - ${CC} ${CFLAGS} shapiro.c -o shapiro_t1 - -shapiro.alt: shapiro.alt.c - ${CC} ${CFLAGS} shapiro.alt.c -o shapiro.alt - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -horton: horton.c - ${CC} ${CFLAGS} horton.c -o horton - -# Here are some programs related to the horton entry. See horton.hint -# for details. +############################## +# Special flags for this entry +############################## # -horton.alt: horton.alt.c - ${CC} ${CFLAGS} horton.alt.c -o horton.alt -gtface: gtface.c - ${CC} ${CFLAGS} gtface.c -o gtface - -ldb: ldb.c - ${CC} ${CFLAGS} ldb.c -o ldb - -imc: imc.c - ${CC} ${CFLAGS} imc.c -o imc - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 - -# NOTE: this is the original (gziped) file that won +ENTRY= weisberg +PROG= ${ENTRY} # -dodsond2.orig: dodsond2.gz - @${RM} -f dodsond2.orig.c - -${GUNZIP} < dodsond2.gz > dodsond2.orig.c - -@if [ -s dodsond2.orig.c ]; then \ - echo "${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig"; \ - ${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig; \ - else \ - ${RM} -f dodsond2.orig.c; \ - echo "sorry, we could not gunzip dodsond2.gz"; \ - fi +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= -dodsond2.gz: dodsond2.gz.uu - @${RM} -f dodsond2.gz - ${UUDECODE} dodsond2.gz.uu -dodsond1: dodsond1.c - ${CC} ${CFLAGS} dodsond1.c -o dodsond1 - -clean: - $(RM) -f *.o a.out core - -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - ${RM} -f dodsond2.orig.c dodsond2.gz shapiro_t2.c shapiro_t1 - -nuke: clobber +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1994/westley/Makefile b/1994/westley/Makefile index 964287422..8b092f295 100644 --- a/1994/westley/Makefile +++ b/1994/westley/Makefile @@ -1,157 +1,617 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1994 makefile +# IOCCC 1994 winning entry - westley + +################################################################################ # -# Copyright (c) 1994, Landon Curt Noll & Larry Bassel. -# All Rights Reserved. Permission for personal, educational or non-profit -# use is granted provided this this copyright and notice are included in its -# entirety and remains unaltered. All other uses must receive prior permission -# from Landon Curt Noll and Larry Bassel. +# 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 -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true +############################# +# shell used by this Makefile +############################# +# +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. +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 # -# 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. +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # # Set CC to the name of your ANSI compiler. -#CC=cc -CC=gcc - -# winners that compile under ANSI C # -WINNERS= dodsond1 dodsond2 horton imc ldb schnitzi shapiro smr tvr weisberg \ - westley -ALT_NAMES= dodsond2.orig shapiro.alt horton.alt gtface weisberg.alt tvr.alt - -all: $(WINNERS) $(ALT_NAMES) - -westley: westley.c - ${CC} ${CFLAGS} westley.c -DO -o westley - -weisberg: weisberg.c - ${CC} ${CFLAGS} -Dc='n*n>x?p:((m=*(b+1)),N))' \ - -De='(2<<6*sizeof(int))' \ - -Do='(8<<5*sizeof(int))' \ - -DN='((b=t+1),x+=2,x>e?exit():o' \ - -Dp='(a-t shapiro_t2.c - -shapiro_t1: shapiro.c - ${CC} ${CFLAGS} shapiro.c -o shapiro_t1 - -shapiro.alt: shapiro.alt.c - ${CC} ${CFLAGS} shapiro.alt.c -o shapiro.alt - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -horton: horton.c - ${CC} ${CFLAGS} horton.c -o horton - -# Here are some programs related to the horton entry. See horton.hint -# for details. +############################## +# Special flags for this entry +############################## # -horton.alt: horton.alt.c - ${CC} ${CFLAGS} horton.alt.c -o horton.alt -gtface: gtface.c - ${CC} ${CFLAGS} gtface.c -o gtface - -ldb: ldb.c - ${CC} ${CFLAGS} ldb.c -o ldb - -imc: imc.c - ${CC} ${CFLAGS} imc.c -o imc - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 - -# NOTE: this is the original (gziped) file that won +ENTRY= westley +PROG= ${ENTRY} # -dodsond2.orig: dodsond2.gz - @${RM} -f dodsond2.orig.c - -${GUNZIP} < dodsond2.gz > dodsond2.orig.c - -@if [ -s dodsond2.orig.c ]; then \ - echo "${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig"; \ - ${CC} ${CFLAGS} dodsond2.orig.c -o dodsond2.orig; \ - else \ - ${RM} -f dodsond2.orig.c; \ - echo "sorry, we could not gunzip dodsond2.gz"; \ - fi +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= -dodsond2.gz: dodsond2.gz.uu - @${RM} -f dodsond2.gz - ${UUDECODE} dodsond2.gz.uu -dodsond1: dodsond1.c - ${CC} ${CFLAGS} dodsond1.c -o dodsond1 - -clean: - $(RM) -f *.o a.out core - -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - ${RM} -f dodsond2.orig.c dodsond2.gz shapiro_t2.c shapiro_t1 - -nuke: clobber +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1995/Makefile b/1995/Makefile index e58a0360f..3948878a4 100644 --- a/1995/Makefile +++ b/1995/Makefile @@ -50,7 +50,7 @@ # tool locations ################ # -SHELL= /bin/bash +SHELL= bash MAKE= make diff --git a/1995/cdua/Makefile b/1995/cdua/Makefile index 95246c58b..69565834b 100644 --- a/1995/cdua/Makefile +++ b/1995/cdua/Makefile @@ -1,118 +1,617 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1995 makefile +# IOCCC 1995 winning entry - cdua + +################################################################################ # -# Copyright (c) 1996, Landon Curt Noll, Larry Bassel & Sriram Srinivasan -# 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, Larry Bassel and Sriram Srinivasan. +# 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 -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true +############################# +# shell used by this Makefile +############################# +# +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. +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 # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # # Set CC to the name of your ANSI compiler. -CC=cc -#CC=gcc - -# winners that compile under ANSI C # -WINNERS= cdua dodsond1 dodsond2 esde garry heathbar leo makarios savastio \ - schnitzi spinellis vanschnitz -ALT_NAMES= leo.orig garry.fmt garry.test - -LEVEL=5 - -all: $(WINNERS) - -cdua: cdua.c - ${CC} ${CFLAGS} cdua.c -o cdua - -dodsond1: dodsond1.c - ${CC} ${CFLAGS} -DXXXXXX= -DXXXXXXX= dodsond1.c -o dodsond1 - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 -lcurses -ltermcap - -esde: esde.c esde.data esde.data2 - ${CC} ${CFLAGS} esde.c -o esde - -garry: garry.c - ${CC} ${CFLAGS} garry.c -o garry - -heathbar: heathbar.c - ${CC} ${CFLAGS} heathbar.c -o heathbar - -# The following as a less obfuscated version of garry. +# Some entries seem to need gcc. If you have gcc, set +# both CC and MAY_NEED_GCC to gcc. # -garry.fmt: garry.fmt.c - ${CC} ${CFLAGS} garry.fmt.c -o garry.fmt - -# The following are test progs for garry +# If you do not have gcc, set CC to the name of your ANSI compiler, and +# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just : +# to disable such programs. # -garry.test: garry.test.sh garry garry.data - rm -f garry.test - cp garry.test.sh garry.test - chmod +x garry.test +CC= cc +#CC=clang +MAY_NEED_GCC= gcc -leo: leo.c - ${CC} ${CFLAGS} -DGa=608 -DAs=792 -DMo=int -DAr='unsigned long' \ - -DS='struct Se' leo.c -o leo -# NOTE: this is the original program that was non-interactive +############################## +# Special flags for this entry +############################## # -leo.orig: leo.orig.c - ${CC} ${CFLAGS} -DGa=608 -DAs=792 -DMo=int -DAr='unsigned long' \ - -DS='struct S' leo.orig.c -o leo.orig +ENTRY= cdua +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= -makarios: makarios.c - ${CC} ${CFLAGS} makarios.c -o makarios -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -spinellis: spinellis.c - ${CC} ${CFLAGS} spinellis.c -o spinellis - -vanschnitz: vanschnitz.c - ${CC} ${CFLAGS} -Dn=${LEVEL} vanschnitz.c -o vanschnitz - -clean: - $(RM) -f *.o a.out core ${WINNERS} - -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - -nuke: clobber +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1995/dodsond1/Makefile b/1995/dodsond1/Makefile index 95246c58b..a27933f88 100644 --- a/1995/dodsond1/Makefile +++ b/1995/dodsond1/Makefile @@ -1,118 +1,617 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1995 makefile +# IOCCC 1995 winning entry - dodsond1 + +################################################################################ # -# Copyright (c) 1996, Landon Curt Noll, Larry Bassel & Sriram Srinivasan -# 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, Larry Bassel and Sriram Srinivasan. +# 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 -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true +############################# +# shell used by this Makefile +############################# +# +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. +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 # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # # Set CC to the name of your ANSI compiler. -CC=cc -#CC=gcc - -# winners that compile under ANSI C # -WINNERS= cdua dodsond1 dodsond2 esde garry heathbar leo makarios savastio \ - schnitzi spinellis vanschnitz -ALT_NAMES= leo.orig garry.fmt garry.test - -LEVEL=5 - -all: $(WINNERS) - -cdua: cdua.c - ${CC} ${CFLAGS} cdua.c -o cdua - -dodsond1: dodsond1.c - ${CC} ${CFLAGS} -DXXXXXX= -DXXXXXXX= dodsond1.c -o dodsond1 - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 -lcurses -ltermcap - -esde: esde.c esde.data esde.data2 - ${CC} ${CFLAGS} esde.c -o esde - -garry: garry.c - ${CC} ${CFLAGS} garry.c -o garry - -heathbar: heathbar.c - ${CC} ${CFLAGS} heathbar.c -o heathbar - -# The following as a less obfuscated version of garry. +# Some entries seem to need gcc. If you have gcc, set +# both CC and MAY_NEED_GCC to gcc. # -garry.fmt: garry.fmt.c - ${CC} ${CFLAGS} garry.fmt.c -o garry.fmt - -# The following are test progs for garry +# If you do not have gcc, set CC to the name of your ANSI compiler, and +# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just : +# to disable such programs. # -garry.test: garry.test.sh garry garry.data - rm -f garry.test - cp garry.test.sh garry.test - chmod +x garry.test +CC= cc +#CC=clang +MAY_NEED_GCC= gcc -leo: leo.c - ${CC} ${CFLAGS} -DGa=608 -DAs=792 -DMo=int -DAr='unsigned long' \ - -DS='struct Se' leo.c -o leo -# NOTE: this is the original program that was non-interactive +############################## +# Special flags for this entry +############################## # -leo.orig: leo.orig.c - ${CC} ${CFLAGS} -DGa=608 -DAs=792 -DMo=int -DAr='unsigned long' \ - -DS='struct S' leo.orig.c -o leo.orig +ENTRY= dodsond1 +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= -makarios: makarios.c - ${CC} ${CFLAGS} makarios.c -o makarios -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -spinellis: spinellis.c - ${CC} ${CFLAGS} spinellis.c -o spinellis - -vanschnitz: vanschnitz.c - ${CC} ${CFLAGS} -Dn=${LEVEL} vanschnitz.c -o vanschnitz - -clean: - $(RM) -f *.o a.out core ${WINNERS} - -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - -nuke: clobber +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1995/dodsond2/Makefile b/1995/dodsond2/Makefile index 95246c58b..24da0a920 100644 --- a/1995/dodsond2/Makefile +++ b/1995/dodsond2/Makefile @@ -1,118 +1,617 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1995 makefile +# IOCCC 1995 winning entry - dodsond2 + +################################################################################ # -# Copyright (c) 1996, Landon Curt Noll, Larry Bassel & Sriram Srinivasan -# 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, Larry Bassel and Sriram Srinivasan. +# 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 -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true +############################# +# shell used by this Makefile +############################# +# +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. +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 # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # # Set CC to the name of your ANSI compiler. -CC=cc -#CC=gcc - -# winners that compile under ANSI C # -WINNERS= cdua dodsond1 dodsond2 esde garry heathbar leo makarios savastio \ - schnitzi spinellis vanschnitz -ALT_NAMES= leo.orig garry.fmt garry.test - -LEVEL=5 - -all: $(WINNERS) - -cdua: cdua.c - ${CC} ${CFLAGS} cdua.c -o cdua - -dodsond1: dodsond1.c - ${CC} ${CFLAGS} -DXXXXXX= -DXXXXXXX= dodsond1.c -o dodsond1 - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 -lcurses -ltermcap - -esde: esde.c esde.data esde.data2 - ${CC} ${CFLAGS} esde.c -o esde - -garry: garry.c - ${CC} ${CFLAGS} garry.c -o garry - -heathbar: heathbar.c - ${CC} ${CFLAGS} heathbar.c -o heathbar - -# The following as a less obfuscated version of garry. +# Some entries seem to need gcc. If you have gcc, set +# both CC and MAY_NEED_GCC to gcc. # -garry.fmt: garry.fmt.c - ${CC} ${CFLAGS} garry.fmt.c -o garry.fmt - -# The following are test progs for garry +# If you do not have gcc, set CC to the name of your ANSI compiler, and +# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just : +# to disable such programs. # -garry.test: garry.test.sh garry garry.data - rm -f garry.test - cp garry.test.sh garry.test - chmod +x garry.test +CC= cc +#CC=clang +MAY_NEED_GCC= gcc -leo: leo.c - ${CC} ${CFLAGS} -DGa=608 -DAs=792 -DMo=int -DAr='unsigned long' \ - -DS='struct Se' leo.c -o leo -# NOTE: this is the original program that was non-interactive +############################## +# Special flags for this entry +############################## # -leo.orig: leo.orig.c - ${CC} ${CFLAGS} -DGa=608 -DAs=792 -DMo=int -DAr='unsigned long' \ - -DS='struct S' leo.orig.c -o leo.orig +ENTRY= dodsond2 +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= -makarios: makarios.c - ${CC} ${CFLAGS} makarios.c -o makarios -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -spinellis: spinellis.c - ${CC} ${CFLAGS} spinellis.c -o spinellis - -vanschnitz: vanschnitz.c - ${CC} ${CFLAGS} -Dn=${LEVEL} vanschnitz.c -o vanschnitz - -clean: - $(RM) -f *.o a.out core ${WINNERS} - -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - -nuke: clobber +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1995/esde/Makefile b/1995/esde/Makefile index 95246c58b..dc01b137f 100644 --- a/1995/esde/Makefile +++ b/1995/esde/Makefile @@ -1,118 +1,617 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1995 makefile +# IOCCC 1995 winning entry - esde + +################################################################################ # -# Copyright (c) 1996, Landon Curt Noll, Larry Bassel & Sriram Srinivasan -# 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, Larry Bassel and Sriram Srinivasan. +# 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 -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true +############################# +# shell used by this Makefile +############################# +# +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. +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 # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # # Set CC to the name of your ANSI compiler. -CC=cc -#CC=gcc - -# winners that compile under ANSI C # -WINNERS= cdua dodsond1 dodsond2 esde garry heathbar leo makarios savastio \ - schnitzi spinellis vanschnitz -ALT_NAMES= leo.orig garry.fmt garry.test - -LEVEL=5 - -all: $(WINNERS) - -cdua: cdua.c - ${CC} ${CFLAGS} cdua.c -o cdua - -dodsond1: dodsond1.c - ${CC} ${CFLAGS} -DXXXXXX= -DXXXXXXX= dodsond1.c -o dodsond1 - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 -lcurses -ltermcap - -esde: esde.c esde.data esde.data2 - ${CC} ${CFLAGS} esde.c -o esde - -garry: garry.c - ${CC} ${CFLAGS} garry.c -o garry - -heathbar: heathbar.c - ${CC} ${CFLAGS} heathbar.c -o heathbar - -# The following as a less obfuscated version of garry. +# Some entries seem to need gcc. If you have gcc, set +# both CC and MAY_NEED_GCC to gcc. # -garry.fmt: garry.fmt.c - ${CC} ${CFLAGS} garry.fmt.c -o garry.fmt - -# The following are test progs for garry +# If you do not have gcc, set CC to the name of your ANSI compiler, and +# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just : +# to disable such programs. # -garry.test: garry.test.sh garry garry.data - rm -f garry.test - cp garry.test.sh garry.test - chmod +x garry.test +CC= cc +#CC=clang +MAY_NEED_GCC= gcc -leo: leo.c - ${CC} ${CFLAGS} -DGa=608 -DAs=792 -DMo=int -DAr='unsigned long' \ - -DS='struct Se' leo.c -o leo -# NOTE: this is the original program that was non-interactive +############################## +# Special flags for this entry +############################## # -leo.orig: leo.orig.c - ${CC} ${CFLAGS} -DGa=608 -DAs=792 -DMo=int -DAr='unsigned long' \ - -DS='struct S' leo.orig.c -o leo.orig +ENTRY= esde +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= -makarios: makarios.c - ${CC} ${CFLAGS} makarios.c -o makarios -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -spinellis: spinellis.c - ${CC} ${CFLAGS} spinellis.c -o spinellis - -vanschnitz: vanschnitz.c - ${CC} ${CFLAGS} -Dn=${LEVEL} vanschnitz.c -o vanschnitz - -clean: - $(RM) -f *.o a.out core ${WINNERS} - -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - -nuke: clobber +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1995/garry/Makefile b/1995/garry/Makefile index 95246c58b..bd9ee3997 100644 --- a/1995/garry/Makefile +++ b/1995/garry/Makefile @@ -1,118 +1,617 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1995 makefile +# IOCCC 1995 winning entry - garry + +################################################################################ # -# Copyright (c) 1996, Landon Curt Noll, Larry Bassel & Sriram Srinivasan -# 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, Larry Bassel and Sriram Srinivasan. +# 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 -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true +############################# +# shell used by this Makefile +############################# +# +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. +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 # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # # Set CC to the name of your ANSI compiler. -CC=cc -#CC=gcc - -# winners that compile under ANSI C # -WINNERS= cdua dodsond1 dodsond2 esde garry heathbar leo makarios savastio \ - schnitzi spinellis vanschnitz -ALT_NAMES= leo.orig garry.fmt garry.test - -LEVEL=5 - -all: $(WINNERS) - -cdua: cdua.c - ${CC} ${CFLAGS} cdua.c -o cdua - -dodsond1: dodsond1.c - ${CC} ${CFLAGS} -DXXXXXX= -DXXXXXXX= dodsond1.c -o dodsond1 - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 -lcurses -ltermcap - -esde: esde.c esde.data esde.data2 - ${CC} ${CFLAGS} esde.c -o esde - -garry: garry.c - ${CC} ${CFLAGS} garry.c -o garry - -heathbar: heathbar.c - ${CC} ${CFLAGS} heathbar.c -o heathbar - -# The following as a less obfuscated version of garry. +# Some entries seem to need gcc. If you have gcc, set +# both CC and MAY_NEED_GCC to gcc. # -garry.fmt: garry.fmt.c - ${CC} ${CFLAGS} garry.fmt.c -o garry.fmt - -# The following are test progs for garry +# If you do not have gcc, set CC to the name of your ANSI compiler, and +# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just : +# to disable such programs. # -garry.test: garry.test.sh garry garry.data - rm -f garry.test - cp garry.test.sh garry.test - chmod +x garry.test +CC= cc +#CC=clang +MAY_NEED_GCC= gcc -leo: leo.c - ${CC} ${CFLAGS} -DGa=608 -DAs=792 -DMo=int -DAr='unsigned long' \ - -DS='struct Se' leo.c -o leo -# NOTE: this is the original program that was non-interactive +############################## +# Special flags for this entry +############################## # -leo.orig: leo.orig.c - ${CC} ${CFLAGS} -DGa=608 -DAs=792 -DMo=int -DAr='unsigned long' \ - -DS='struct S' leo.orig.c -o leo.orig +ENTRY= garry +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= -makarios: makarios.c - ${CC} ${CFLAGS} makarios.c -o makarios -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -spinellis: spinellis.c - ${CC} ${CFLAGS} spinellis.c -o spinellis - -vanschnitz: vanschnitz.c - ${CC} ${CFLAGS} -Dn=${LEVEL} vanschnitz.c -o vanschnitz - -clean: - $(RM) -f *.o a.out core ${WINNERS} - -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - -nuke: clobber +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1995/heathbar/Makefile b/1995/heathbar/Makefile index 95246c58b..909a2cf46 100644 --- a/1995/heathbar/Makefile +++ b/1995/heathbar/Makefile @@ -1,118 +1,617 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1995 makefile +# IOCCC 1995 winning entry - heathbar + +################################################################################ # -# Copyright (c) 1996, Landon Curt Noll, Larry Bassel & Sriram Srinivasan -# 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, Larry Bassel and Sriram Srinivasan. +# 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 -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true +############################# +# shell used by this Makefile +############################# +# +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. +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 # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # # Set CC to the name of your ANSI compiler. -CC=cc -#CC=gcc - -# winners that compile under ANSI C # -WINNERS= cdua dodsond1 dodsond2 esde garry heathbar leo makarios savastio \ - schnitzi spinellis vanschnitz -ALT_NAMES= leo.orig garry.fmt garry.test - -LEVEL=5 - -all: $(WINNERS) - -cdua: cdua.c - ${CC} ${CFLAGS} cdua.c -o cdua - -dodsond1: dodsond1.c - ${CC} ${CFLAGS} -DXXXXXX= -DXXXXXXX= dodsond1.c -o dodsond1 - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 -lcurses -ltermcap - -esde: esde.c esde.data esde.data2 - ${CC} ${CFLAGS} esde.c -o esde - -garry: garry.c - ${CC} ${CFLAGS} garry.c -o garry - -heathbar: heathbar.c - ${CC} ${CFLAGS} heathbar.c -o heathbar - -# The following as a less obfuscated version of garry. +# Some entries seem to need gcc. If you have gcc, set +# both CC and MAY_NEED_GCC to gcc. # -garry.fmt: garry.fmt.c - ${CC} ${CFLAGS} garry.fmt.c -o garry.fmt - -# The following are test progs for garry +# If you do not have gcc, set CC to the name of your ANSI compiler, and +# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just : +# to disable such programs. # -garry.test: garry.test.sh garry garry.data - rm -f garry.test - cp garry.test.sh garry.test - chmod +x garry.test +CC= cc +#CC=clang +MAY_NEED_GCC= gcc -leo: leo.c - ${CC} ${CFLAGS} -DGa=608 -DAs=792 -DMo=int -DAr='unsigned long' \ - -DS='struct Se' leo.c -o leo -# NOTE: this is the original program that was non-interactive +############################## +# Special flags for this entry +############################## # -leo.orig: leo.orig.c - ${CC} ${CFLAGS} -DGa=608 -DAs=792 -DMo=int -DAr='unsigned long' \ - -DS='struct S' leo.orig.c -o leo.orig +ENTRY= heathbar +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= -makarios: makarios.c - ${CC} ${CFLAGS} makarios.c -o makarios -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -spinellis: spinellis.c - ${CC} ${CFLAGS} spinellis.c -o spinellis - -vanschnitz: vanschnitz.c - ${CC} ${CFLAGS} -Dn=${LEVEL} vanschnitz.c -o vanschnitz - -clean: - $(RM) -f *.o a.out core ${WINNERS} - -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - -nuke: clobber +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1995/leo/Makefile b/1995/leo/Makefile index 95246c58b..93cd10385 100644 --- a/1995/leo/Makefile +++ b/1995/leo/Makefile @@ -1,118 +1,617 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1995 makefile +# IOCCC 1995 winning entry - leo + +################################################################################ # -# Copyright (c) 1996, Landon Curt Noll, Larry Bassel & Sriram Srinivasan -# 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, Larry Bassel and Sriram Srinivasan. +# 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 -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true +############################# +# shell used by this Makefile +############################# +# +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. +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 # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # # Set CC to the name of your ANSI compiler. -CC=cc -#CC=gcc - -# winners that compile under ANSI C # -WINNERS= cdua dodsond1 dodsond2 esde garry heathbar leo makarios savastio \ - schnitzi spinellis vanschnitz -ALT_NAMES= leo.orig garry.fmt garry.test - -LEVEL=5 - -all: $(WINNERS) - -cdua: cdua.c - ${CC} ${CFLAGS} cdua.c -o cdua - -dodsond1: dodsond1.c - ${CC} ${CFLAGS} -DXXXXXX= -DXXXXXXX= dodsond1.c -o dodsond1 - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 -lcurses -ltermcap - -esde: esde.c esde.data esde.data2 - ${CC} ${CFLAGS} esde.c -o esde - -garry: garry.c - ${CC} ${CFLAGS} garry.c -o garry - -heathbar: heathbar.c - ${CC} ${CFLAGS} heathbar.c -o heathbar - -# The following as a less obfuscated version of garry. +# Some entries seem to need gcc. If you have gcc, set +# both CC and MAY_NEED_GCC to gcc. # -garry.fmt: garry.fmt.c - ${CC} ${CFLAGS} garry.fmt.c -o garry.fmt - -# The following are test progs for garry +# If you do not have gcc, set CC to the name of your ANSI compiler, and +# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just : +# to disable such programs. # -garry.test: garry.test.sh garry garry.data - rm -f garry.test - cp garry.test.sh garry.test - chmod +x garry.test +CC= cc +#CC=clang +MAY_NEED_GCC= gcc -leo: leo.c - ${CC} ${CFLAGS} -DGa=608 -DAs=792 -DMo=int -DAr='unsigned long' \ - -DS='struct Se' leo.c -o leo -# NOTE: this is the original program that was non-interactive +############################## +# Special flags for this entry +############################## # -leo.orig: leo.orig.c - ${CC} ${CFLAGS} -DGa=608 -DAs=792 -DMo=int -DAr='unsigned long' \ - -DS='struct S' leo.orig.c -o leo.orig +ENTRY= leo +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= -makarios: makarios.c - ${CC} ${CFLAGS} makarios.c -o makarios -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -spinellis: spinellis.c - ${CC} ${CFLAGS} spinellis.c -o spinellis - -vanschnitz: vanschnitz.c - ${CC} ${CFLAGS} -Dn=${LEVEL} vanschnitz.c -o vanschnitz - -clean: - $(RM) -f *.o a.out core ${WINNERS} - -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - -nuke: clobber +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1995/makarios/Makefile b/1995/makarios/Makefile index 95246c58b..880c445ea 100644 --- a/1995/makarios/Makefile +++ b/1995/makarios/Makefile @@ -1,118 +1,617 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1995 makefile +# IOCCC 1995 winning entry - makarios + +################################################################################ # -# Copyright (c) 1996, Landon Curt Noll, Larry Bassel & Sriram Srinivasan -# 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, Larry Bassel and Sriram Srinivasan. +# 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 -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true +############################# +# shell used by this Makefile +############################# +# +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. +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 # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # # Set CC to the name of your ANSI compiler. -CC=cc -#CC=gcc - -# winners that compile under ANSI C # -WINNERS= cdua dodsond1 dodsond2 esde garry heathbar leo makarios savastio \ - schnitzi spinellis vanschnitz -ALT_NAMES= leo.orig garry.fmt garry.test - -LEVEL=5 - -all: $(WINNERS) - -cdua: cdua.c - ${CC} ${CFLAGS} cdua.c -o cdua - -dodsond1: dodsond1.c - ${CC} ${CFLAGS} -DXXXXXX= -DXXXXXXX= dodsond1.c -o dodsond1 - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 -lcurses -ltermcap - -esde: esde.c esde.data esde.data2 - ${CC} ${CFLAGS} esde.c -o esde - -garry: garry.c - ${CC} ${CFLAGS} garry.c -o garry - -heathbar: heathbar.c - ${CC} ${CFLAGS} heathbar.c -o heathbar - -# The following as a less obfuscated version of garry. +# Some entries seem to need gcc. If you have gcc, set +# both CC and MAY_NEED_GCC to gcc. # -garry.fmt: garry.fmt.c - ${CC} ${CFLAGS} garry.fmt.c -o garry.fmt - -# The following are test progs for garry +# If you do not have gcc, set CC to the name of your ANSI compiler, and +# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just : +# to disable such programs. # -garry.test: garry.test.sh garry garry.data - rm -f garry.test - cp garry.test.sh garry.test - chmod +x garry.test +CC= cc +#CC=clang +MAY_NEED_GCC= gcc -leo: leo.c - ${CC} ${CFLAGS} -DGa=608 -DAs=792 -DMo=int -DAr='unsigned long' \ - -DS='struct Se' leo.c -o leo -# NOTE: this is the original program that was non-interactive +############################## +# Special flags for this entry +############################## # -leo.orig: leo.orig.c - ${CC} ${CFLAGS} -DGa=608 -DAs=792 -DMo=int -DAr='unsigned long' \ - -DS='struct S' leo.orig.c -o leo.orig +ENTRY= makarios +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= -makarios: makarios.c - ${CC} ${CFLAGS} makarios.c -o makarios -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -spinellis: spinellis.c - ${CC} ${CFLAGS} spinellis.c -o spinellis - -vanschnitz: vanschnitz.c - ${CC} ${CFLAGS} -Dn=${LEVEL} vanschnitz.c -o vanschnitz - -clean: - $(RM) -f *.o a.out core ${WINNERS} - -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - -nuke: clobber +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1995/savastio/Makefile b/1995/savastio/Makefile index 95246c58b..1c8ba6a8b 100644 --- a/1995/savastio/Makefile +++ b/1995/savastio/Makefile @@ -1,118 +1,617 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1995 makefile +# IOCCC 1995 winning entry - savastio + +################################################################################ # -# Copyright (c) 1996, Landon Curt Noll, Larry Bassel & Sriram Srinivasan -# 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, Larry Bassel and Sriram Srinivasan. +# 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 -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true +############################# +# shell used by this Makefile +############################# +# +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. +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 # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # # Set CC to the name of your ANSI compiler. -CC=cc -#CC=gcc - -# winners that compile under ANSI C # -WINNERS= cdua dodsond1 dodsond2 esde garry heathbar leo makarios savastio \ - schnitzi spinellis vanschnitz -ALT_NAMES= leo.orig garry.fmt garry.test - -LEVEL=5 - -all: $(WINNERS) - -cdua: cdua.c - ${CC} ${CFLAGS} cdua.c -o cdua - -dodsond1: dodsond1.c - ${CC} ${CFLAGS} -DXXXXXX= -DXXXXXXX= dodsond1.c -o dodsond1 - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 -lcurses -ltermcap - -esde: esde.c esde.data esde.data2 - ${CC} ${CFLAGS} esde.c -o esde - -garry: garry.c - ${CC} ${CFLAGS} garry.c -o garry - -heathbar: heathbar.c - ${CC} ${CFLAGS} heathbar.c -o heathbar - -# The following as a less obfuscated version of garry. +# Some entries seem to need gcc. If you have gcc, set +# both CC and MAY_NEED_GCC to gcc. # -garry.fmt: garry.fmt.c - ${CC} ${CFLAGS} garry.fmt.c -o garry.fmt - -# The following are test progs for garry +# If you do not have gcc, set CC to the name of your ANSI compiler, and +# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just : +# to disable such programs. # -garry.test: garry.test.sh garry garry.data - rm -f garry.test - cp garry.test.sh garry.test - chmod +x garry.test +CC= cc +#CC=clang +MAY_NEED_GCC= gcc -leo: leo.c - ${CC} ${CFLAGS} -DGa=608 -DAs=792 -DMo=int -DAr='unsigned long' \ - -DS='struct Se' leo.c -o leo -# NOTE: this is the original program that was non-interactive +############################## +# Special flags for this entry +############################## # -leo.orig: leo.orig.c - ${CC} ${CFLAGS} -DGa=608 -DAs=792 -DMo=int -DAr='unsigned long' \ - -DS='struct S' leo.orig.c -o leo.orig +ENTRY= savastio +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= -makarios: makarios.c - ${CC} ${CFLAGS} makarios.c -o makarios -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -spinellis: spinellis.c - ${CC} ${CFLAGS} spinellis.c -o spinellis - -vanschnitz: vanschnitz.c - ${CC} ${CFLAGS} -Dn=${LEVEL} vanschnitz.c -o vanschnitz - -clean: - $(RM) -f *.o a.out core ${WINNERS} - -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - -nuke: clobber +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1995/schnitzi/Makefile b/1995/schnitzi/Makefile index 95246c58b..0bceb6a02 100644 --- a/1995/schnitzi/Makefile +++ b/1995/schnitzi/Makefile @@ -1,118 +1,617 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1995 makefile +# IOCCC 1995 winning entry - schnitzi + +################################################################################ # -# Copyright (c) 1996, Landon Curt Noll, Larry Bassel & Sriram Srinivasan -# 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, Larry Bassel and Sriram Srinivasan. +# 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 -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true +############################# +# shell used by this Makefile +############################# +# +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. +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 # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # # Set CC to the name of your ANSI compiler. -CC=cc -#CC=gcc - -# winners that compile under ANSI C # -WINNERS= cdua dodsond1 dodsond2 esde garry heathbar leo makarios savastio \ - schnitzi spinellis vanschnitz -ALT_NAMES= leo.orig garry.fmt garry.test - -LEVEL=5 - -all: $(WINNERS) - -cdua: cdua.c - ${CC} ${CFLAGS} cdua.c -o cdua - -dodsond1: dodsond1.c - ${CC} ${CFLAGS} -DXXXXXX= -DXXXXXXX= dodsond1.c -o dodsond1 - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 -lcurses -ltermcap - -esde: esde.c esde.data esde.data2 - ${CC} ${CFLAGS} esde.c -o esde - -garry: garry.c - ${CC} ${CFLAGS} garry.c -o garry - -heathbar: heathbar.c - ${CC} ${CFLAGS} heathbar.c -o heathbar - -# The following as a less obfuscated version of garry. +# Some entries seem to need gcc. If you have gcc, set +# both CC and MAY_NEED_GCC to gcc. # -garry.fmt: garry.fmt.c - ${CC} ${CFLAGS} garry.fmt.c -o garry.fmt - -# The following are test progs for garry +# If you do not have gcc, set CC to the name of your ANSI compiler, and +# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just : +# to disable such programs. # -garry.test: garry.test.sh garry garry.data - rm -f garry.test - cp garry.test.sh garry.test - chmod +x garry.test +CC= cc +#CC=clang +MAY_NEED_GCC= gcc -leo: leo.c - ${CC} ${CFLAGS} -DGa=608 -DAs=792 -DMo=int -DAr='unsigned long' \ - -DS='struct Se' leo.c -o leo -# NOTE: this is the original program that was non-interactive +############################## +# Special flags for this entry +############################## # -leo.orig: leo.orig.c - ${CC} ${CFLAGS} -DGa=608 -DAs=792 -DMo=int -DAr='unsigned long' \ - -DS='struct S' leo.orig.c -o leo.orig +ENTRY= schnitzi +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= -makarios: makarios.c - ${CC} ${CFLAGS} makarios.c -o makarios -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -spinellis: spinellis.c - ${CC} ${CFLAGS} spinellis.c -o spinellis - -vanschnitz: vanschnitz.c - ${CC} ${CFLAGS} -Dn=${LEVEL} vanschnitz.c -o vanschnitz - -clean: - $(RM) -f *.o a.out core ${WINNERS} - -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - -nuke: clobber +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1995/spinellis/Makefile b/1995/spinellis/Makefile index 95246c58b..030324407 100644 --- a/1995/spinellis/Makefile +++ b/1995/spinellis/Makefile @@ -1,118 +1,617 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1995 makefile +# IOCCC 1995 winning entry - spinellis + +################################################################################ # -# Copyright (c) 1996, Landon Curt Noll, Larry Bassel & Sriram Srinivasan -# 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, Larry Bassel and Sriram Srinivasan. +# 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 -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true +############################# +# shell used by this Makefile +############################# +# +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. +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 # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # # Set CC to the name of your ANSI compiler. -CC=cc -#CC=gcc - -# winners that compile under ANSI C # -WINNERS= cdua dodsond1 dodsond2 esde garry heathbar leo makarios savastio \ - schnitzi spinellis vanschnitz -ALT_NAMES= leo.orig garry.fmt garry.test - -LEVEL=5 - -all: $(WINNERS) - -cdua: cdua.c - ${CC} ${CFLAGS} cdua.c -o cdua - -dodsond1: dodsond1.c - ${CC} ${CFLAGS} -DXXXXXX= -DXXXXXXX= dodsond1.c -o dodsond1 - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 -lcurses -ltermcap - -esde: esde.c esde.data esde.data2 - ${CC} ${CFLAGS} esde.c -o esde - -garry: garry.c - ${CC} ${CFLAGS} garry.c -o garry - -heathbar: heathbar.c - ${CC} ${CFLAGS} heathbar.c -o heathbar - -# The following as a less obfuscated version of garry. +# Some entries seem to need gcc. If you have gcc, set +# both CC and MAY_NEED_GCC to gcc. # -garry.fmt: garry.fmt.c - ${CC} ${CFLAGS} garry.fmt.c -o garry.fmt - -# The following are test progs for garry +# If you do not have gcc, set CC to the name of your ANSI compiler, and +# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just : +# to disable such programs. # -garry.test: garry.test.sh garry garry.data - rm -f garry.test - cp garry.test.sh garry.test - chmod +x garry.test +CC= cc +#CC=clang +MAY_NEED_GCC= gcc -leo: leo.c - ${CC} ${CFLAGS} -DGa=608 -DAs=792 -DMo=int -DAr='unsigned long' \ - -DS='struct Se' leo.c -o leo -# NOTE: this is the original program that was non-interactive +############################## +# Special flags for this entry +############################## # -leo.orig: leo.orig.c - ${CC} ${CFLAGS} -DGa=608 -DAs=792 -DMo=int -DAr='unsigned long' \ - -DS='struct S' leo.orig.c -o leo.orig +ENTRY= spinellis +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= -makarios: makarios.c - ${CC} ${CFLAGS} makarios.c -o makarios -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -spinellis: spinellis.c - ${CC} ${CFLAGS} spinellis.c -o spinellis - -vanschnitz: vanschnitz.c - ${CC} ${CFLAGS} -Dn=${LEVEL} vanschnitz.c -o vanschnitz - -clean: - $(RM) -f *.o a.out core ${WINNERS} - -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - -nuke: clobber +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1995/vanschnitz/Makefile b/1995/vanschnitz/Makefile index 95246c58b..74c43c831 100644 --- a/1995/vanschnitz/Makefile +++ b/1995/vanschnitz/Makefile @@ -1,118 +1,617 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1995 makefile +# IOCCC 1995 winning entry - vanschnitz + +################################################################################ # -# Copyright (c) 1996, Landon Curt Noll, Larry Bassel & Sriram Srinivasan -# 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, Larry Bassel and Sriram Srinivasan. +# 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 -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true +############################# +# shell used by this Makefile +############################# +# +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. +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 # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # # Set CC to the name of your ANSI compiler. -CC=cc -#CC=gcc - -# winners that compile under ANSI C # -WINNERS= cdua dodsond1 dodsond2 esde garry heathbar leo makarios savastio \ - schnitzi spinellis vanschnitz -ALT_NAMES= leo.orig garry.fmt garry.test - -LEVEL=5 - -all: $(WINNERS) - -cdua: cdua.c - ${CC} ${CFLAGS} cdua.c -o cdua - -dodsond1: dodsond1.c - ${CC} ${CFLAGS} -DXXXXXX= -DXXXXXXX= dodsond1.c -o dodsond1 - -dodsond2: dodsond2.c - ${CC} ${CFLAGS} dodsond2.c -o dodsond2 -lcurses -ltermcap - -esde: esde.c esde.data esde.data2 - ${CC} ${CFLAGS} esde.c -o esde - -garry: garry.c - ${CC} ${CFLAGS} garry.c -o garry - -heathbar: heathbar.c - ${CC} ${CFLAGS} heathbar.c -o heathbar - -# The following as a less obfuscated version of garry. +# Some entries seem to need gcc. If you have gcc, set +# both CC and MAY_NEED_GCC to gcc. # -garry.fmt: garry.fmt.c - ${CC} ${CFLAGS} garry.fmt.c -o garry.fmt - -# The following are test progs for garry +# If you do not have gcc, set CC to the name of your ANSI compiler, and +# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just : +# to disable such programs. # -garry.test: garry.test.sh garry garry.data - rm -f garry.test - cp garry.test.sh garry.test - chmod +x garry.test +CC= cc +#CC=clang +MAY_NEED_GCC= gcc -leo: leo.c - ${CC} ${CFLAGS} -DGa=608 -DAs=792 -DMo=int -DAr='unsigned long' \ - -DS='struct Se' leo.c -o leo -# NOTE: this is the original program that was non-interactive +############################## +# Special flags for this entry +############################## # -leo.orig: leo.orig.c - ${CC} ${CFLAGS} -DGa=608 -DAs=792 -DMo=int -DAr='unsigned long' \ - -DS='struct S' leo.orig.c -o leo.orig +ENTRY= vanschnitz +PROG= ${ENTRY} +# +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= -makarios: makarios.c - ${CC} ${CFLAGS} makarios.c -o makarios -schnitzi: schnitzi.c - ${CC} ${CFLAGS} schnitzi.c -o schnitzi - -spinellis: spinellis.c - ${CC} ${CFLAGS} spinellis.c -o spinellis - -vanschnitz: vanschnitz.c - ${CC} ${CFLAGS} -Dn=${LEVEL} vanschnitz.c -o vanschnitz - -clean: - $(RM) -f *.o a.out core ${WINNERS} - -clobber: clean - $(RM) -f $(WINNERS) - $(RM) -f $(ALT_NAMES) - -nuke: clobber +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1996/Makefile b/1996/Makefile index ba2c62aec..20bd8e4db 100644 --- a/1996/Makefile +++ b/1996/Makefile @@ -50,7 +50,7 @@ # tool locations ################ # -SHELL= /bin/bash +SHELL= bash MAKE= make diff --git a/1996/august/Makefile b/1996/august/Makefile index d06ef33b5..ef47612bc 100644 --- a/1996/august/Makefile +++ b/1996/august/Makefile @@ -1,156 +1,617 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1996 makefile +# IOCCC 1996 winning entry - august + +################################################################################ # -# Copyright (c) 1997, Landon Curt Noll & Sriram Srinivasan -# 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 Sriram Srinivasan. +# 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 -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true +############################# +# shell used by this Makefile +############################# +# +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. +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 # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # # Set CC to the name of your ANSI compiler. -CC=cc -#CC=gcc - -# winners that compile under ANSI C # -WINNERS= august dalbec eldby gandalf huffman jonth rcm schweikh1 \ - schweikh2 schweikh3 westley -ALT_NAMES= august.orig - -LEVEL=5 - -all: $(WINNERS) - -# NOTE: Some compilers will compile this code into infinite loop -# progs. We have found gcc to work on a number of platforms. -# If the following example does not execute in a very -# short time, try a better compiler: +# Some entries seem to need gcc. If you have gcc, set +# both CC and MAY_NEED_GCC to gcc. # -# cat august.c test.oc | ./august > test.oo -# -august: august.c fac.oc parse.oc test.oc - ${CC} ${CFLAGS} -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.c -o august - ${CHMOD} +r fac.oc parse.oc test.oc - -# This forms a byte code execution engine written in OC +# If you do not have gcc, set CC to the name of your ANSI compiler, and +# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just : +# to disable such programs. # -august.oc: august.c - ${RM} -f august.oc - ${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.c > august.oc - ${CHMOD} +r august.oc +CC= cc +#CC=clang +MAY_NEED_GCC= gcc -# NOTE: this is the original source that won + +############################## +# Special flags for this entry +############################## # -august.orig: august.orig.c fac.oc parse.oc test.oc - ${CC} ${CFLAGS} -DZ=60000 -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.orig.c -o august.orig - ${RM} -f august.oc - ${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.orig.c > august.oc - ${CHMOD} +r fac.oc parse.oc test.oc august.oc - -dalbec: dalbec.c - ${CC} ${CFLAGS} dalbec.c -o dalbec - -eldby: eldby.c - ${CC} ${CFLAGS} eldby.c -o eldby - -gandalf: gandalf.c - ${CC} ${CFLAGS} gandalf.c -o gandalf - ${RM} -f hatcat cathat - ${CP} gandalf hatcat - ${CP} gandalf cathat - -huffman: huffman.c - ${CC} ${CFLAGS} huffman.c -o huffman - -# Add -I${X}/include and -L${X}/lib if this doesn't build -# (X is the root of the X Window distribution) -# Solaris users add -lsocket +ENTRY= august +PROG= ${ENTRY} # -jonth: jonth.c - ${CC} ${CFLAGS} jonth.c -o jonth -lX11 -lm - -rcm: rcm.c - ${CC} ${CFLAGS} -DJ='if(' -Ds='else J O==' -DU='B(' \ - -DX='for(' -DH='unsigned' -Dn='struct x' -DA='0,0,0,0,' \ - -DT='' -DY='' -DR='malloc(sizeof(n))' \ - -DM='%=K' -DK=32768 -DD='getchar()' -DN=putchar rcm.c -o rcm - -schweikh1: schweikh1.c errno.h - ${CC} ${CFLAGS} -I. schweikh1.c -o schweikh1 - -schweikh2: schweikh2.c hunni.c hunni.pl - ${CC} ${CFLAGS} -D_POSIX_SOURCE schweikh2.c -o schweikh2 - -# NOTE: On some systems such as SunOS, one may need to compile with: +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} # -# ${CC} ${CFLAGS} \ -# -I. -D_POSIX_SOURCE '-Ddifftime(a,b)=(double)(b-a)' \ -# schweikh3.c -o schweikh3 -# -schweikh3: schweikh3.c iso646.h - ${CC} ${CFLAGS} -I. -D_POSIX_SOURCE schweikh3.c -o schweikh3 +ALT_OBJ= +ALT_TARGET= -westley: westley.c clock1 clock2 clock3 - ${CC} ${CFLAGS} westley.c -o westley - ${CHMOD} +x clock1 clock2 clock3 -clean: - ${RM} -f *.o a.out core ${WINNERS} - -clobber: clean - ${RM} -f $(WINNERS) - ${RM} -f $(ALT_NAMES) - ${RM} -f fac.oo parse.oo test.oo hatcat cathat august.oc - -nuke: clobber +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1996/dalbec/Makefile b/1996/dalbec/Makefile index d06ef33b5..46566774f 100644 --- a/1996/dalbec/Makefile +++ b/1996/dalbec/Makefile @@ -1,156 +1,617 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1996 makefile +# IOCCC 1996 winning entry - dalbec + +################################################################################ # -# Copyright (c) 1997, Landon Curt Noll & Sriram Srinivasan -# 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 Sriram Srinivasan. +# 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 -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true +############################# +# shell used by this Makefile +############################# +# +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. +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 # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # # Set CC to the name of your ANSI compiler. -CC=cc -#CC=gcc - -# winners that compile under ANSI C # -WINNERS= august dalbec eldby gandalf huffman jonth rcm schweikh1 \ - schweikh2 schweikh3 westley -ALT_NAMES= august.orig - -LEVEL=5 - -all: $(WINNERS) - -# NOTE: Some compilers will compile this code into infinite loop -# progs. We have found gcc to work on a number of platforms. -# If the following example does not execute in a very -# short time, try a better compiler: +# Some entries seem to need gcc. If you have gcc, set +# both CC and MAY_NEED_GCC to gcc. # -# cat august.c test.oc | ./august > test.oo -# -august: august.c fac.oc parse.oc test.oc - ${CC} ${CFLAGS} -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.c -o august - ${CHMOD} +r fac.oc parse.oc test.oc - -# This forms a byte code execution engine written in OC +# If you do not have gcc, set CC to the name of your ANSI compiler, and +# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just : +# to disable such programs. # -august.oc: august.c - ${RM} -f august.oc - ${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.c > august.oc - ${CHMOD} +r august.oc +CC= cc +#CC=clang +MAY_NEED_GCC= gcc -# NOTE: this is the original source that won + +############################## +# Special flags for this entry +############################## # -august.orig: august.orig.c fac.oc parse.oc test.oc - ${CC} ${CFLAGS} -DZ=60000 -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.orig.c -o august.orig - ${RM} -f august.oc - ${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.orig.c > august.oc - ${CHMOD} +r fac.oc parse.oc test.oc august.oc - -dalbec: dalbec.c - ${CC} ${CFLAGS} dalbec.c -o dalbec - -eldby: eldby.c - ${CC} ${CFLAGS} eldby.c -o eldby - -gandalf: gandalf.c - ${CC} ${CFLAGS} gandalf.c -o gandalf - ${RM} -f hatcat cathat - ${CP} gandalf hatcat - ${CP} gandalf cathat - -huffman: huffman.c - ${CC} ${CFLAGS} huffman.c -o huffman - -# Add -I${X}/include and -L${X}/lib if this doesn't build -# (X is the root of the X Window distribution) -# Solaris users add -lsocket +ENTRY= dalbec +PROG= ${ENTRY} # -jonth: jonth.c - ${CC} ${CFLAGS} jonth.c -o jonth -lX11 -lm - -rcm: rcm.c - ${CC} ${CFLAGS} -DJ='if(' -Ds='else J O==' -DU='B(' \ - -DX='for(' -DH='unsigned' -Dn='struct x' -DA='0,0,0,0,' \ - -DT='' -DY='' -DR='malloc(sizeof(n))' \ - -DM='%=K' -DK=32768 -DD='getchar()' -DN=putchar rcm.c -o rcm - -schweikh1: schweikh1.c errno.h - ${CC} ${CFLAGS} -I. schweikh1.c -o schweikh1 - -schweikh2: schweikh2.c hunni.c hunni.pl - ${CC} ${CFLAGS} -D_POSIX_SOURCE schweikh2.c -o schweikh2 - -# NOTE: On some systems such as SunOS, one may need to compile with: +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} # -# ${CC} ${CFLAGS} \ -# -I. -D_POSIX_SOURCE '-Ddifftime(a,b)=(double)(b-a)' \ -# schweikh3.c -o schweikh3 -# -schweikh3: schweikh3.c iso646.h - ${CC} ${CFLAGS} -I. -D_POSIX_SOURCE schweikh3.c -o schweikh3 +ALT_OBJ= +ALT_TARGET= -westley: westley.c clock1 clock2 clock3 - ${CC} ${CFLAGS} westley.c -o westley - ${CHMOD} +x clock1 clock2 clock3 -clean: - ${RM} -f *.o a.out core ${WINNERS} - -clobber: clean - ${RM} -f $(WINNERS) - ${RM} -f $(ALT_NAMES) - ${RM} -f fac.oo parse.oo test.oo hatcat cathat august.oc - -nuke: clobber +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1996/eldby/Makefile b/1996/eldby/Makefile index d06ef33b5..72d0b6260 100644 --- a/1996/eldby/Makefile +++ b/1996/eldby/Makefile @@ -1,156 +1,617 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1996 makefile +# IOCCC 1996 winning entry - eldby + +################################################################################ # -# Copyright (c) 1997, Landon Curt Noll & Sriram Srinivasan -# 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 Sriram Srinivasan. +# 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 -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true +############################# +# shell used by this Makefile +############################# +# +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. +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 # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # # Set CC to the name of your ANSI compiler. -CC=cc -#CC=gcc - -# winners that compile under ANSI C # -WINNERS= august dalbec eldby gandalf huffman jonth rcm schweikh1 \ - schweikh2 schweikh3 westley -ALT_NAMES= august.orig - -LEVEL=5 - -all: $(WINNERS) - -# NOTE: Some compilers will compile this code into infinite loop -# progs. We have found gcc to work on a number of platforms. -# If the following example does not execute in a very -# short time, try a better compiler: +# Some entries seem to need gcc. If you have gcc, set +# both CC and MAY_NEED_GCC to gcc. # -# cat august.c test.oc | ./august > test.oo -# -august: august.c fac.oc parse.oc test.oc - ${CC} ${CFLAGS} -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.c -o august - ${CHMOD} +r fac.oc parse.oc test.oc - -# This forms a byte code execution engine written in OC +# If you do not have gcc, set CC to the name of your ANSI compiler, and +# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just : +# to disable such programs. # -august.oc: august.c - ${RM} -f august.oc - ${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.c > august.oc - ${CHMOD} +r august.oc +CC= cc +#CC=clang +MAY_NEED_GCC= gcc -# NOTE: this is the original source that won + +############################## +# Special flags for this entry +############################## # -august.orig: august.orig.c fac.oc parse.oc test.oc - ${CC} ${CFLAGS} -DZ=60000 -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.orig.c -o august.orig - ${RM} -f august.oc - ${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.orig.c > august.oc - ${CHMOD} +r fac.oc parse.oc test.oc august.oc - -dalbec: dalbec.c - ${CC} ${CFLAGS} dalbec.c -o dalbec - -eldby: eldby.c - ${CC} ${CFLAGS} eldby.c -o eldby - -gandalf: gandalf.c - ${CC} ${CFLAGS} gandalf.c -o gandalf - ${RM} -f hatcat cathat - ${CP} gandalf hatcat - ${CP} gandalf cathat - -huffman: huffman.c - ${CC} ${CFLAGS} huffman.c -o huffman - -# Add -I${X}/include and -L${X}/lib if this doesn't build -# (X is the root of the X Window distribution) -# Solaris users add -lsocket +ENTRY= eldby +PROG= ${ENTRY} # -jonth: jonth.c - ${CC} ${CFLAGS} jonth.c -o jonth -lX11 -lm - -rcm: rcm.c - ${CC} ${CFLAGS} -DJ='if(' -Ds='else J O==' -DU='B(' \ - -DX='for(' -DH='unsigned' -Dn='struct x' -DA='0,0,0,0,' \ - -DT='' -DY='' -DR='malloc(sizeof(n))' \ - -DM='%=K' -DK=32768 -DD='getchar()' -DN=putchar rcm.c -o rcm - -schweikh1: schweikh1.c errno.h - ${CC} ${CFLAGS} -I. schweikh1.c -o schweikh1 - -schweikh2: schweikh2.c hunni.c hunni.pl - ${CC} ${CFLAGS} -D_POSIX_SOURCE schweikh2.c -o schweikh2 - -# NOTE: On some systems such as SunOS, one may need to compile with: +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} # -# ${CC} ${CFLAGS} \ -# -I. -D_POSIX_SOURCE '-Ddifftime(a,b)=(double)(b-a)' \ -# schweikh3.c -o schweikh3 -# -schweikh3: schweikh3.c iso646.h - ${CC} ${CFLAGS} -I. -D_POSIX_SOURCE schweikh3.c -o schweikh3 +ALT_OBJ= +ALT_TARGET= -westley: westley.c clock1 clock2 clock3 - ${CC} ${CFLAGS} westley.c -o westley - ${CHMOD} +x clock1 clock2 clock3 -clean: - ${RM} -f *.o a.out core ${WINNERS} - -clobber: clean - ${RM} -f $(WINNERS) - ${RM} -f $(ALT_NAMES) - ${RM} -f fac.oo parse.oo test.oo hatcat cathat august.oc - -nuke: clobber +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1996/gandalf/Makefile b/1996/gandalf/Makefile index d06ef33b5..ddb1d75c7 100644 --- a/1996/gandalf/Makefile +++ b/1996/gandalf/Makefile @@ -1,156 +1,617 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1996 makefile +# IOCCC 1996 winning entry - gandalf + +################################################################################ # -# Copyright (c) 1997, Landon Curt Noll & Sriram Srinivasan -# 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 Sriram Srinivasan. +# 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 -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true +############################# +# shell used by this Makefile +############################# +# +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. +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 # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # # Set CC to the name of your ANSI compiler. -CC=cc -#CC=gcc - -# winners that compile under ANSI C # -WINNERS= august dalbec eldby gandalf huffman jonth rcm schweikh1 \ - schweikh2 schweikh3 westley -ALT_NAMES= august.orig - -LEVEL=5 - -all: $(WINNERS) - -# NOTE: Some compilers will compile this code into infinite loop -# progs. We have found gcc to work on a number of platforms. -# If the following example does not execute in a very -# short time, try a better compiler: +# Some entries seem to need gcc. If you have gcc, set +# both CC and MAY_NEED_GCC to gcc. # -# cat august.c test.oc | ./august > test.oo -# -august: august.c fac.oc parse.oc test.oc - ${CC} ${CFLAGS} -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.c -o august - ${CHMOD} +r fac.oc parse.oc test.oc - -# This forms a byte code execution engine written in OC +# If you do not have gcc, set CC to the name of your ANSI compiler, and +# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just : +# to disable such programs. # -august.oc: august.c - ${RM} -f august.oc - ${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.c > august.oc - ${CHMOD} +r august.oc +CC= cc +#CC=clang +MAY_NEED_GCC= gcc -# NOTE: this is the original source that won + +############################## +# Special flags for this entry +############################## # -august.orig: august.orig.c fac.oc parse.oc test.oc - ${CC} ${CFLAGS} -DZ=60000 -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.orig.c -o august.orig - ${RM} -f august.oc - ${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.orig.c > august.oc - ${CHMOD} +r fac.oc parse.oc test.oc august.oc - -dalbec: dalbec.c - ${CC} ${CFLAGS} dalbec.c -o dalbec - -eldby: eldby.c - ${CC} ${CFLAGS} eldby.c -o eldby - -gandalf: gandalf.c - ${CC} ${CFLAGS} gandalf.c -o gandalf - ${RM} -f hatcat cathat - ${CP} gandalf hatcat - ${CP} gandalf cathat - -huffman: huffman.c - ${CC} ${CFLAGS} huffman.c -o huffman - -# Add -I${X}/include and -L${X}/lib if this doesn't build -# (X is the root of the X Window distribution) -# Solaris users add -lsocket +ENTRY= gandalf +PROG= ${ENTRY} # -jonth: jonth.c - ${CC} ${CFLAGS} jonth.c -o jonth -lX11 -lm - -rcm: rcm.c - ${CC} ${CFLAGS} -DJ='if(' -Ds='else J O==' -DU='B(' \ - -DX='for(' -DH='unsigned' -Dn='struct x' -DA='0,0,0,0,' \ - -DT='' -DY='' -DR='malloc(sizeof(n))' \ - -DM='%=K' -DK=32768 -DD='getchar()' -DN=putchar rcm.c -o rcm - -schweikh1: schweikh1.c errno.h - ${CC} ${CFLAGS} -I. schweikh1.c -o schweikh1 - -schweikh2: schweikh2.c hunni.c hunni.pl - ${CC} ${CFLAGS} -D_POSIX_SOURCE schweikh2.c -o schweikh2 - -# NOTE: On some systems such as SunOS, one may need to compile with: +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} # -# ${CC} ${CFLAGS} \ -# -I. -D_POSIX_SOURCE '-Ddifftime(a,b)=(double)(b-a)' \ -# schweikh3.c -o schweikh3 -# -schweikh3: schweikh3.c iso646.h - ${CC} ${CFLAGS} -I. -D_POSIX_SOURCE schweikh3.c -o schweikh3 +ALT_OBJ= +ALT_TARGET= -westley: westley.c clock1 clock2 clock3 - ${CC} ${CFLAGS} westley.c -o westley - ${CHMOD} +x clock1 clock2 clock3 -clean: - ${RM} -f *.o a.out core ${WINNERS} - -clobber: clean - ${RM} -f $(WINNERS) - ${RM} -f $(ALT_NAMES) - ${RM} -f fac.oo parse.oo test.oo hatcat cathat august.oc - -nuke: clobber +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1996/huffman/Makefile b/1996/huffman/Makefile index d06ef33b5..694c62860 100644 --- a/1996/huffman/Makefile +++ b/1996/huffman/Makefile @@ -1,156 +1,617 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1996 makefile +# IOCCC 1996 winning entry - huffman + +################################################################################ # -# Copyright (c) 1997, Landon Curt Noll & Sriram Srinivasan -# 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 Sriram Srinivasan. +# 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 -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true +############################# +# shell used by this Makefile +############################# +# +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. +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 # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # # Set CC to the name of your ANSI compiler. -CC=cc -#CC=gcc - -# winners that compile under ANSI C # -WINNERS= august dalbec eldby gandalf huffman jonth rcm schweikh1 \ - schweikh2 schweikh3 westley -ALT_NAMES= august.orig - -LEVEL=5 - -all: $(WINNERS) - -# NOTE: Some compilers will compile this code into infinite loop -# progs. We have found gcc to work on a number of platforms. -# If the following example does not execute in a very -# short time, try a better compiler: +# Some entries seem to need gcc. If you have gcc, set +# both CC and MAY_NEED_GCC to gcc. # -# cat august.c test.oc | ./august > test.oo -# -august: august.c fac.oc parse.oc test.oc - ${CC} ${CFLAGS} -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.c -o august - ${CHMOD} +r fac.oc parse.oc test.oc - -# This forms a byte code execution engine written in OC +# If you do not have gcc, set CC to the name of your ANSI compiler, and +# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just : +# to disable such programs. # -august.oc: august.c - ${RM} -f august.oc - ${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.c > august.oc - ${CHMOD} +r august.oc +CC= cc +#CC=clang +MAY_NEED_GCC= gcc -# NOTE: this is the original source that won + +############################## +# Special flags for this entry +############################## # -august.orig: august.orig.c fac.oc parse.oc test.oc - ${CC} ${CFLAGS} -DZ=60000 -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.orig.c -o august.orig - ${RM} -f august.oc - ${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.orig.c > august.oc - ${CHMOD} +r fac.oc parse.oc test.oc august.oc - -dalbec: dalbec.c - ${CC} ${CFLAGS} dalbec.c -o dalbec - -eldby: eldby.c - ${CC} ${CFLAGS} eldby.c -o eldby - -gandalf: gandalf.c - ${CC} ${CFLAGS} gandalf.c -o gandalf - ${RM} -f hatcat cathat - ${CP} gandalf hatcat - ${CP} gandalf cathat - -huffman: huffman.c - ${CC} ${CFLAGS} huffman.c -o huffman - -# Add -I${X}/include and -L${X}/lib if this doesn't build -# (X is the root of the X Window distribution) -# Solaris users add -lsocket +ENTRY= huffman +PROG= ${ENTRY} # -jonth: jonth.c - ${CC} ${CFLAGS} jonth.c -o jonth -lX11 -lm - -rcm: rcm.c - ${CC} ${CFLAGS} -DJ='if(' -Ds='else J O==' -DU='B(' \ - -DX='for(' -DH='unsigned' -Dn='struct x' -DA='0,0,0,0,' \ - -DT='' -DY='' -DR='malloc(sizeof(n))' \ - -DM='%=K' -DK=32768 -DD='getchar()' -DN=putchar rcm.c -o rcm - -schweikh1: schweikh1.c errno.h - ${CC} ${CFLAGS} -I. schweikh1.c -o schweikh1 - -schweikh2: schweikh2.c hunni.c hunni.pl - ${CC} ${CFLAGS} -D_POSIX_SOURCE schweikh2.c -o schweikh2 - -# NOTE: On some systems such as SunOS, one may need to compile with: +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} # -# ${CC} ${CFLAGS} \ -# -I. -D_POSIX_SOURCE '-Ddifftime(a,b)=(double)(b-a)' \ -# schweikh3.c -o schweikh3 -# -schweikh3: schweikh3.c iso646.h - ${CC} ${CFLAGS} -I. -D_POSIX_SOURCE schweikh3.c -o schweikh3 +ALT_OBJ= +ALT_TARGET= -westley: westley.c clock1 clock2 clock3 - ${CC} ${CFLAGS} westley.c -o westley - ${CHMOD} +x clock1 clock2 clock3 -clean: - ${RM} -f *.o a.out core ${WINNERS} - -clobber: clean - ${RM} -f $(WINNERS) - ${RM} -f $(ALT_NAMES) - ${RM} -f fac.oo parse.oo test.oo hatcat cathat august.oc - -nuke: clobber +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1996/jonth/Makefile b/1996/jonth/Makefile index d06ef33b5..599b968b2 100644 --- a/1996/jonth/Makefile +++ b/1996/jonth/Makefile @@ -1,156 +1,617 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1996 makefile +# IOCCC 1996 winning entry - jonth + +################################################################################ # -# Copyright (c) 1997, Landon Curt Noll & Sriram Srinivasan -# 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 Sriram Srinivasan. +# 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 -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true +############################# +# shell used by this Makefile +############################# +# +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. +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 # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # # Set CC to the name of your ANSI compiler. -CC=cc -#CC=gcc - -# winners that compile under ANSI C # -WINNERS= august dalbec eldby gandalf huffman jonth rcm schweikh1 \ - schweikh2 schweikh3 westley -ALT_NAMES= august.orig - -LEVEL=5 - -all: $(WINNERS) - -# NOTE: Some compilers will compile this code into infinite loop -# progs. We have found gcc to work on a number of platforms. -# If the following example does not execute in a very -# short time, try a better compiler: +# Some entries seem to need gcc. If you have gcc, set +# both CC and MAY_NEED_GCC to gcc. # -# cat august.c test.oc | ./august > test.oo -# -august: august.c fac.oc parse.oc test.oc - ${CC} ${CFLAGS} -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.c -o august - ${CHMOD} +r fac.oc parse.oc test.oc - -# This forms a byte code execution engine written in OC +# If you do not have gcc, set CC to the name of your ANSI compiler, and +# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just : +# to disable such programs. # -august.oc: august.c - ${RM} -f august.oc - ${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.c > august.oc - ${CHMOD} +r august.oc +CC= cc +#CC=clang +MAY_NEED_GCC= gcc -# NOTE: this is the original source that won + +############################## +# Special flags for this entry +############################## # -august.orig: august.orig.c fac.oc parse.oc test.oc - ${CC} ${CFLAGS} -DZ=60000 -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.orig.c -o august.orig - ${RM} -f august.oc - ${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.orig.c > august.oc - ${CHMOD} +r fac.oc parse.oc test.oc august.oc - -dalbec: dalbec.c - ${CC} ${CFLAGS} dalbec.c -o dalbec - -eldby: eldby.c - ${CC} ${CFLAGS} eldby.c -o eldby - -gandalf: gandalf.c - ${CC} ${CFLAGS} gandalf.c -o gandalf - ${RM} -f hatcat cathat - ${CP} gandalf hatcat - ${CP} gandalf cathat - -huffman: huffman.c - ${CC} ${CFLAGS} huffman.c -o huffman - -# Add -I${X}/include and -L${X}/lib if this doesn't build -# (X is the root of the X Window distribution) -# Solaris users add -lsocket +ENTRY= jonth +PROG= ${ENTRY} # -jonth: jonth.c - ${CC} ${CFLAGS} jonth.c -o jonth -lX11 -lm - -rcm: rcm.c - ${CC} ${CFLAGS} -DJ='if(' -Ds='else J O==' -DU='B(' \ - -DX='for(' -DH='unsigned' -Dn='struct x' -DA='0,0,0,0,' \ - -DT='' -DY='' -DR='malloc(sizeof(n))' \ - -DM='%=K' -DK=32768 -DD='getchar()' -DN=putchar rcm.c -o rcm - -schweikh1: schweikh1.c errno.h - ${CC} ${CFLAGS} -I. schweikh1.c -o schweikh1 - -schweikh2: schweikh2.c hunni.c hunni.pl - ${CC} ${CFLAGS} -D_POSIX_SOURCE schweikh2.c -o schweikh2 - -# NOTE: On some systems such as SunOS, one may need to compile with: +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} # -# ${CC} ${CFLAGS} \ -# -I. -D_POSIX_SOURCE '-Ddifftime(a,b)=(double)(b-a)' \ -# schweikh3.c -o schweikh3 -# -schweikh3: schweikh3.c iso646.h - ${CC} ${CFLAGS} -I. -D_POSIX_SOURCE schweikh3.c -o schweikh3 +ALT_OBJ= +ALT_TARGET= -westley: westley.c clock1 clock2 clock3 - ${CC} ${CFLAGS} westley.c -o westley - ${CHMOD} +x clock1 clock2 clock3 -clean: - ${RM} -f *.o a.out core ${WINNERS} - -clobber: clean - ${RM} -f $(WINNERS) - ${RM} -f $(ALT_NAMES) - ${RM} -f fac.oo parse.oo test.oo hatcat cathat august.oc - -nuke: clobber +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1996/rcm/Makefile b/1996/rcm/Makefile index d06ef33b5..634514a0d 100644 --- a/1996/rcm/Makefile +++ b/1996/rcm/Makefile @@ -1,156 +1,617 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1996 makefile +# IOCCC 1996 winning entry - rcm + +################################################################################ # -# Copyright (c) 1997, Landon Curt Noll & Sriram Srinivasan -# 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 Sriram Srinivasan. +# 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 -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true +############################# +# shell used by this Makefile +############################# +# +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. +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 # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # # Set CC to the name of your ANSI compiler. -CC=cc -#CC=gcc - -# winners that compile under ANSI C # -WINNERS= august dalbec eldby gandalf huffman jonth rcm schweikh1 \ - schweikh2 schweikh3 westley -ALT_NAMES= august.orig - -LEVEL=5 - -all: $(WINNERS) - -# NOTE: Some compilers will compile this code into infinite loop -# progs. We have found gcc to work on a number of platforms. -# If the following example does not execute in a very -# short time, try a better compiler: +# Some entries seem to need gcc. If you have gcc, set +# both CC and MAY_NEED_GCC to gcc. # -# cat august.c test.oc | ./august > test.oo -# -august: august.c fac.oc parse.oc test.oc - ${CC} ${CFLAGS} -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.c -o august - ${CHMOD} +r fac.oc parse.oc test.oc - -# This forms a byte code execution engine written in OC +# If you do not have gcc, set CC to the name of your ANSI compiler, and +# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just : +# to disable such programs. # -august.oc: august.c - ${RM} -f august.oc - ${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.c > august.oc - ${CHMOD} +r august.oc +CC= cc +#CC=clang +MAY_NEED_GCC= gcc -# NOTE: this is the original source that won + +############################## +# Special flags for this entry +############################## # -august.orig: august.orig.c fac.oc parse.oc test.oc - ${CC} ${CFLAGS} -DZ=60000 -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.orig.c -o august.orig - ${RM} -f august.oc - ${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.orig.c > august.oc - ${CHMOD} +r fac.oc parse.oc test.oc august.oc - -dalbec: dalbec.c - ${CC} ${CFLAGS} dalbec.c -o dalbec - -eldby: eldby.c - ${CC} ${CFLAGS} eldby.c -o eldby - -gandalf: gandalf.c - ${CC} ${CFLAGS} gandalf.c -o gandalf - ${RM} -f hatcat cathat - ${CP} gandalf hatcat - ${CP} gandalf cathat - -huffman: huffman.c - ${CC} ${CFLAGS} huffman.c -o huffman - -# Add -I${X}/include and -L${X}/lib if this doesn't build -# (X is the root of the X Window distribution) -# Solaris users add -lsocket +ENTRY= rcm +PROG= ${ENTRY} # -jonth: jonth.c - ${CC} ${CFLAGS} jonth.c -o jonth -lX11 -lm - -rcm: rcm.c - ${CC} ${CFLAGS} -DJ='if(' -Ds='else J O==' -DU='B(' \ - -DX='for(' -DH='unsigned' -Dn='struct x' -DA='0,0,0,0,' \ - -DT='' -DY='' -DR='malloc(sizeof(n))' \ - -DM='%=K' -DK=32768 -DD='getchar()' -DN=putchar rcm.c -o rcm - -schweikh1: schweikh1.c errno.h - ${CC} ${CFLAGS} -I. schweikh1.c -o schweikh1 - -schweikh2: schweikh2.c hunni.c hunni.pl - ${CC} ${CFLAGS} -D_POSIX_SOURCE schweikh2.c -o schweikh2 - -# NOTE: On some systems such as SunOS, one may need to compile with: +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} # -# ${CC} ${CFLAGS} \ -# -I. -D_POSIX_SOURCE '-Ddifftime(a,b)=(double)(b-a)' \ -# schweikh3.c -o schweikh3 -# -schweikh3: schweikh3.c iso646.h - ${CC} ${CFLAGS} -I. -D_POSIX_SOURCE schweikh3.c -o schweikh3 +ALT_OBJ= +ALT_TARGET= -westley: westley.c clock1 clock2 clock3 - ${CC} ${CFLAGS} westley.c -o westley - ${CHMOD} +x clock1 clock2 clock3 -clean: - ${RM} -f *.o a.out core ${WINNERS} - -clobber: clean - ${RM} -f $(WINNERS) - ${RM} -f $(ALT_NAMES) - ${RM} -f fac.oo parse.oo test.oo hatcat cathat august.oc - -nuke: clobber +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1996/schweikh1/Makefile b/1996/schweikh1/Makefile index d06ef33b5..698c5c70d 100644 --- a/1996/schweikh1/Makefile +++ b/1996/schweikh1/Makefile @@ -1,156 +1,617 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1996 makefile +# IOCCC 1996 winning entry - schweikh1 + +################################################################################ # -# Copyright (c) 1997, Landon Curt Noll & Sriram Srinivasan -# 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 Sriram Srinivasan. +# 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 -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true +############################# +# shell used by this Makefile +############################# +# +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. +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 # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # # Set CC to the name of your ANSI compiler. -CC=cc -#CC=gcc - -# winners that compile under ANSI C # -WINNERS= august dalbec eldby gandalf huffman jonth rcm schweikh1 \ - schweikh2 schweikh3 westley -ALT_NAMES= august.orig - -LEVEL=5 - -all: $(WINNERS) - -# NOTE: Some compilers will compile this code into infinite loop -# progs. We have found gcc to work on a number of platforms. -# If the following example does not execute in a very -# short time, try a better compiler: +# Some entries seem to need gcc. If you have gcc, set +# both CC and MAY_NEED_GCC to gcc. # -# cat august.c test.oc | ./august > test.oo -# -august: august.c fac.oc parse.oc test.oc - ${CC} ${CFLAGS} -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.c -o august - ${CHMOD} +r fac.oc parse.oc test.oc - -# This forms a byte code execution engine written in OC +# If you do not have gcc, set CC to the name of your ANSI compiler, and +# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just : +# to disable such programs. # -august.oc: august.c - ${RM} -f august.oc - ${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.c > august.oc - ${CHMOD} +r august.oc +CC= cc +#CC=clang +MAY_NEED_GCC= gcc -# NOTE: this is the original source that won + +############################## +# Special flags for this entry +############################## # -august.orig: august.orig.c fac.oc parse.oc test.oc - ${CC} ${CFLAGS} -DZ=60000 -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.orig.c -o august.orig - ${RM} -f august.oc - ${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.orig.c > august.oc - ${CHMOD} +r fac.oc parse.oc test.oc august.oc - -dalbec: dalbec.c - ${CC} ${CFLAGS} dalbec.c -o dalbec - -eldby: eldby.c - ${CC} ${CFLAGS} eldby.c -o eldby - -gandalf: gandalf.c - ${CC} ${CFLAGS} gandalf.c -o gandalf - ${RM} -f hatcat cathat - ${CP} gandalf hatcat - ${CP} gandalf cathat - -huffman: huffman.c - ${CC} ${CFLAGS} huffman.c -o huffman - -# Add -I${X}/include and -L${X}/lib if this doesn't build -# (X is the root of the X Window distribution) -# Solaris users add -lsocket +ENTRY= schweikh1 +PROG= ${ENTRY} # -jonth: jonth.c - ${CC} ${CFLAGS} jonth.c -o jonth -lX11 -lm - -rcm: rcm.c - ${CC} ${CFLAGS} -DJ='if(' -Ds='else J O==' -DU='B(' \ - -DX='for(' -DH='unsigned' -Dn='struct x' -DA='0,0,0,0,' \ - -DT='' -DY='' -DR='malloc(sizeof(n))' \ - -DM='%=K' -DK=32768 -DD='getchar()' -DN=putchar rcm.c -o rcm - -schweikh1: schweikh1.c errno.h - ${CC} ${CFLAGS} -I. schweikh1.c -o schweikh1 - -schweikh2: schweikh2.c hunni.c hunni.pl - ${CC} ${CFLAGS} -D_POSIX_SOURCE schweikh2.c -o schweikh2 - -# NOTE: On some systems such as SunOS, one may need to compile with: +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} # -# ${CC} ${CFLAGS} \ -# -I. -D_POSIX_SOURCE '-Ddifftime(a,b)=(double)(b-a)' \ -# schweikh3.c -o schweikh3 -# -schweikh3: schweikh3.c iso646.h - ${CC} ${CFLAGS} -I. -D_POSIX_SOURCE schweikh3.c -o schweikh3 +ALT_OBJ= +ALT_TARGET= -westley: westley.c clock1 clock2 clock3 - ${CC} ${CFLAGS} westley.c -o westley - ${CHMOD} +x clock1 clock2 clock3 -clean: - ${RM} -f *.o a.out core ${WINNERS} - -clobber: clean - ${RM} -f $(WINNERS) - ${RM} -f $(ALT_NAMES) - ${RM} -f fac.oo parse.oo test.oo hatcat cathat august.oc - -nuke: clobber +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1996/schweikh2/Makefile b/1996/schweikh2/Makefile index d06ef33b5..818b5e1a3 100644 --- a/1996/schweikh2/Makefile +++ b/1996/schweikh2/Makefile @@ -1,156 +1,617 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1996 makefile +# IOCCC 1996 winning entry - schweikh2 + +################################################################################ # -# Copyright (c) 1997, Landon Curt Noll & Sriram Srinivasan -# 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 Sriram Srinivasan. +# 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 -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true +############################# +# shell used by this Makefile +############################# +# +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. +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 # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # # Set CC to the name of your ANSI compiler. -CC=cc -#CC=gcc - -# winners that compile under ANSI C # -WINNERS= august dalbec eldby gandalf huffman jonth rcm schweikh1 \ - schweikh2 schweikh3 westley -ALT_NAMES= august.orig - -LEVEL=5 - -all: $(WINNERS) - -# NOTE: Some compilers will compile this code into infinite loop -# progs. We have found gcc to work on a number of platforms. -# If the following example does not execute in a very -# short time, try a better compiler: +# Some entries seem to need gcc. If you have gcc, set +# both CC and MAY_NEED_GCC to gcc. # -# cat august.c test.oc | ./august > test.oo -# -august: august.c fac.oc parse.oc test.oc - ${CC} ${CFLAGS} -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.c -o august - ${CHMOD} +r fac.oc parse.oc test.oc - -# This forms a byte code execution engine written in OC +# If you do not have gcc, set CC to the name of your ANSI compiler, and +# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just : +# to disable such programs. # -august.oc: august.c - ${RM} -f august.oc - ${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.c > august.oc - ${CHMOD} +r august.oc +CC= cc +#CC=clang +MAY_NEED_GCC= gcc -# NOTE: this is the original source that won + +############################## +# Special flags for this entry +############################## # -august.orig: august.orig.c fac.oc parse.oc test.oc - ${CC} ${CFLAGS} -DZ=60000 -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.orig.c -o august.orig - ${RM} -f august.oc - ${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.orig.c > august.oc - ${CHMOD} +r fac.oc parse.oc test.oc august.oc - -dalbec: dalbec.c - ${CC} ${CFLAGS} dalbec.c -o dalbec - -eldby: eldby.c - ${CC} ${CFLAGS} eldby.c -o eldby - -gandalf: gandalf.c - ${CC} ${CFLAGS} gandalf.c -o gandalf - ${RM} -f hatcat cathat - ${CP} gandalf hatcat - ${CP} gandalf cathat - -huffman: huffman.c - ${CC} ${CFLAGS} huffman.c -o huffman - -# Add -I${X}/include and -L${X}/lib if this doesn't build -# (X is the root of the X Window distribution) -# Solaris users add -lsocket +ENTRY= schweikh2 +PROG= ${ENTRY} # -jonth: jonth.c - ${CC} ${CFLAGS} jonth.c -o jonth -lX11 -lm - -rcm: rcm.c - ${CC} ${CFLAGS} -DJ='if(' -Ds='else J O==' -DU='B(' \ - -DX='for(' -DH='unsigned' -Dn='struct x' -DA='0,0,0,0,' \ - -DT='' -DY='' -DR='malloc(sizeof(n))' \ - -DM='%=K' -DK=32768 -DD='getchar()' -DN=putchar rcm.c -o rcm - -schweikh1: schweikh1.c errno.h - ${CC} ${CFLAGS} -I. schweikh1.c -o schweikh1 - -schweikh2: schweikh2.c hunni.c hunni.pl - ${CC} ${CFLAGS} -D_POSIX_SOURCE schweikh2.c -o schweikh2 - -# NOTE: On some systems such as SunOS, one may need to compile with: +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} # -# ${CC} ${CFLAGS} \ -# -I. -D_POSIX_SOURCE '-Ddifftime(a,b)=(double)(b-a)' \ -# schweikh3.c -o schweikh3 -# -schweikh3: schweikh3.c iso646.h - ${CC} ${CFLAGS} -I. -D_POSIX_SOURCE schweikh3.c -o schweikh3 +ALT_OBJ= +ALT_TARGET= -westley: westley.c clock1 clock2 clock3 - ${CC} ${CFLAGS} westley.c -o westley - ${CHMOD} +x clock1 clock2 clock3 -clean: - ${RM} -f *.o a.out core ${WINNERS} - -clobber: clean - ${RM} -f $(WINNERS) - ${RM} -f $(ALT_NAMES) - ${RM} -f fac.oo parse.oo test.oo hatcat cathat august.oc - -nuke: clobber +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1996/schweikh3/Makefile b/1996/schweikh3/Makefile index d06ef33b5..98fb60589 100644 --- a/1996/schweikh3/Makefile +++ b/1996/schweikh3/Makefile @@ -1,156 +1,617 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1996 makefile +# IOCCC 1996 winning entry - schweikh3 + +################################################################################ # -# Copyright (c) 1997, Landon Curt Noll & Sriram Srinivasan -# 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 Sriram Srinivasan. +# 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 -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true +############################# +# shell used by this Makefile +############################# +# +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. +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 # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # # Set CC to the name of your ANSI compiler. -CC=cc -#CC=gcc - -# winners that compile under ANSI C # -WINNERS= august dalbec eldby gandalf huffman jonth rcm schweikh1 \ - schweikh2 schweikh3 westley -ALT_NAMES= august.orig - -LEVEL=5 - -all: $(WINNERS) - -# NOTE: Some compilers will compile this code into infinite loop -# progs. We have found gcc to work on a number of platforms. -# If the following example does not execute in a very -# short time, try a better compiler: +# Some entries seem to need gcc. If you have gcc, set +# both CC and MAY_NEED_GCC to gcc. # -# cat august.c test.oc | ./august > test.oo -# -august: august.c fac.oc parse.oc test.oc - ${CC} ${CFLAGS} -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.c -o august - ${CHMOD} +r fac.oc parse.oc test.oc - -# This forms a byte code execution engine written in OC +# If you do not have gcc, set CC to the name of your ANSI compiler, and +# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just : +# to disable such programs. # -august.oc: august.c - ${RM} -f august.oc - ${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.c > august.oc - ${CHMOD} +r august.oc +CC= cc +#CC=clang +MAY_NEED_GCC= gcc -# NOTE: this is the original source that won + +############################## +# Special flags for this entry +############################## # -august.orig: august.orig.c fac.oc parse.oc test.oc - ${CC} ${CFLAGS} -DZ=60000 -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.orig.c -o august.orig - ${RM} -f august.oc - ${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.orig.c > august.oc - ${CHMOD} +r fac.oc parse.oc test.oc august.oc - -dalbec: dalbec.c - ${CC} ${CFLAGS} dalbec.c -o dalbec - -eldby: eldby.c - ${CC} ${CFLAGS} eldby.c -o eldby - -gandalf: gandalf.c - ${CC} ${CFLAGS} gandalf.c -o gandalf - ${RM} -f hatcat cathat - ${CP} gandalf hatcat - ${CP} gandalf cathat - -huffman: huffman.c - ${CC} ${CFLAGS} huffman.c -o huffman - -# Add -I${X}/include and -L${X}/lib if this doesn't build -# (X is the root of the X Window distribution) -# Solaris users add -lsocket +ENTRY= schweikh3 +PROG= ${ENTRY} # -jonth: jonth.c - ${CC} ${CFLAGS} jonth.c -o jonth -lX11 -lm - -rcm: rcm.c - ${CC} ${CFLAGS} -DJ='if(' -Ds='else J O==' -DU='B(' \ - -DX='for(' -DH='unsigned' -Dn='struct x' -DA='0,0,0,0,' \ - -DT='' -DY='' -DR='malloc(sizeof(n))' \ - -DM='%=K' -DK=32768 -DD='getchar()' -DN=putchar rcm.c -o rcm - -schweikh1: schweikh1.c errno.h - ${CC} ${CFLAGS} -I. schweikh1.c -o schweikh1 - -schweikh2: schweikh2.c hunni.c hunni.pl - ${CC} ${CFLAGS} -D_POSIX_SOURCE schweikh2.c -o schweikh2 - -# NOTE: On some systems such as SunOS, one may need to compile with: +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} # -# ${CC} ${CFLAGS} \ -# -I. -D_POSIX_SOURCE '-Ddifftime(a,b)=(double)(b-a)' \ -# schweikh3.c -o schweikh3 -# -schweikh3: schweikh3.c iso646.h - ${CC} ${CFLAGS} -I. -D_POSIX_SOURCE schweikh3.c -o schweikh3 +ALT_OBJ= +ALT_TARGET= -westley: westley.c clock1 clock2 clock3 - ${CC} ${CFLAGS} westley.c -o westley - ${CHMOD} +x clock1 clock2 clock3 -clean: - ${RM} -f *.o a.out core ${WINNERS} - -clobber: clean - ${RM} -f $(WINNERS) - ${RM} -f $(ALT_NAMES) - ${RM} -f fac.oo parse.oo test.oo hatcat cathat august.oc - -nuke: clobber +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1996/westley/Makefile b/1996/westley/Makefile index d06ef33b5..b57b42532 100644 --- a/1996/westley/Makefile +++ b/1996/westley/Makefile @@ -1,156 +1,617 @@ -# %W% %G% %U% +#!/usr/bin/env make # -# 1996 makefile +# IOCCC 1996 winning entry - westley + +################################################################################ # -# Copyright (c) 1997, Landon Curt Noll & Sriram Srinivasan -# 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 Sriram Srinivasan. +# 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 -CAT=cat -CHMOD=chmod -CP=cp -GUNZIP=gunzip -UUDECODE=uudecode -LN=ln -RM=rm -SED=sed -TRUE=true +############################# +# shell used by this Makefile +############################# +# +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. +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 # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -#CFLAGS= -ansi -CFLAGS= -ansi -O -#CFLAGS= +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # # Set CC to the name of your ANSI compiler. -CC=cc -#CC=gcc - -# winners that compile under ANSI C # -WINNERS= august dalbec eldby gandalf huffman jonth rcm schweikh1 \ - schweikh2 schweikh3 westley -ALT_NAMES= august.orig - -LEVEL=5 - -all: $(WINNERS) - -# NOTE: Some compilers will compile this code into infinite loop -# progs. We have found gcc to work on a number of platforms. -# If the following example does not execute in a very -# short time, try a better compiler: +# Some entries seem to need gcc. If you have gcc, set +# both CC and MAY_NEED_GCC to gcc. # -# cat august.c test.oc | ./august > test.oo -# -august: august.c fac.oc parse.oc test.oc - ${CC} ${CFLAGS} -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.c -o august - ${CHMOD} +r fac.oc parse.oc test.oc - -# This forms a byte code execution engine written in OC +# If you do not have gcc, set CC to the name of your ANSI compiler, and +# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just : +# to disable such programs. # -august.oc: august.c - ${RM} -f august.oc - ${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.c > august.oc - ${CHMOD} +r august.oc +CC= cc +#CC=clang +MAY_NEED_GCC= gcc -# NOTE: this is the original source that won + +############################## +# Special flags for this entry +############################## # -august.orig: august.orig.c fac.oc parse.oc test.oc - ${CC} ${CFLAGS} -DZ=60000 -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.orig.c -o august.orig - ${RM} -f august.oc - ${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \ - -D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ - -DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ - -D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \ - august.orig.c > august.oc - ${CHMOD} +r fac.oc parse.oc test.oc august.oc - -dalbec: dalbec.c - ${CC} ${CFLAGS} dalbec.c -o dalbec - -eldby: eldby.c - ${CC} ${CFLAGS} eldby.c -o eldby - -gandalf: gandalf.c - ${CC} ${CFLAGS} gandalf.c -o gandalf - ${RM} -f hatcat cathat - ${CP} gandalf hatcat - ${CP} gandalf cathat - -huffman: huffman.c - ${CC} ${CFLAGS} huffman.c -o huffman - -# Add -I${X}/include and -L${X}/lib if this doesn't build -# (X is the root of the X Window distribution) -# Solaris users add -lsocket +ENTRY= westley +PROG= ${ENTRY} # -jonth: jonth.c - ${CC} ${CFLAGS} jonth.c -o jonth -lX11 -lm - -rcm: rcm.c - ${CC} ${CFLAGS} -DJ='if(' -Ds='else J O==' -DU='B(' \ - -DX='for(' -DH='unsigned' -Dn='struct x' -DA='0,0,0,0,' \ - -DT='' -DY='' -DR='malloc(sizeof(n))' \ - -DM='%=K' -DK=32768 -DD='getchar()' -DN=putchar rcm.c -o rcm - -schweikh1: schweikh1.c errno.h - ${CC} ${CFLAGS} -I. schweikh1.c -o schweikh1 - -schweikh2: schweikh2.c hunni.c hunni.pl - ${CC} ${CFLAGS} -D_POSIX_SOURCE schweikh2.c -o schweikh2 - -# NOTE: On some systems such as SunOS, one may need to compile with: +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} # -# ${CC} ${CFLAGS} \ -# -I. -D_POSIX_SOURCE '-Ddifftime(a,b)=(double)(b-a)' \ -# schweikh3.c -o schweikh3 -# -schweikh3: schweikh3.c iso646.h - ${CC} ${CFLAGS} -I. -D_POSIX_SOURCE schweikh3.c -o schweikh3 +ALT_OBJ= +ALT_TARGET= -westley: westley.c clock1 clock2 clock3 - ${CC} ${CFLAGS} westley.c -o westley - ${CHMOD} +x clock1 clock2 clock3 -clean: - ${RM} -f *.o a.out core ${WINNERS} - -clobber: clean - ${RM} -f $(WINNERS) - ${RM} -f $(ALT_NAMES) - ${RM} -f fac.oo parse.oo test.oo hatcat cathat august.oc - -nuke: clobber +################# +# build the entry +################# +# +all: data ${TARGET} @${TRUE} -install: all - ${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1998/Makefile b/1998/Makefile index ec4f803bc..1bec79809 100644 --- a/1998/Makefile +++ b/1998/Makefile @@ -50,7 +50,7 @@ # tool locations ################ # -SHELL= /bin/bash +SHELL= bash MAKE= make diff --git a/1998/banks/Makefile b/1998/banks/Makefile index c939c82aa..462d71b54 100644 --- a/1998/banks/Makefile +++ b/1998/banks/Makefile @@ -1,43 +1,435 @@ -#!/bin/make -# 1998 makefile +#!/usr/bin/env make # -# Copyright (c) Landon Curt Noll, Jeremy Horn, Peter Seebach -# and Leonid A. Broukhis, 1999. -# 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 the contest judges. +# IOCCC 1998 winning entry - banks -SHELL=/bin/sh -CAT=cat -CHMOD=chmod -CP=cp -MV=mv -LN=ln -RM=rm -SED=sed -TRUE=true +################################################################################ +# +# 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 +# +################################################################################ -# flags for ANSI compiles +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: # -# 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. +# Creative Commons Attribution-ShareAlike 3.0 Unported License. # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +# See: http://creativecommons.org/licenses/by-sa/3.0/ + + +############################# +# shell used by this Makefile +############################# # -# NOTE: On some systems, the library path does not include the location -# of the X11 libraries. You might need to use a -L/path/to/X11/lib/dir -# in order to compile with these libs. +SHELL= bash + +####################### +# common tool locations +####################### # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -CFLAGS= -ansi -#CFLAGS= -ansi -O -#CFLAGS= -#CFLAGS= -ansi -L/usr/X11R6/lib +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 +# +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside +# +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # @@ -51,124 +443,175 @@ CFLAGS= -ansi # to disable such programs. # CC= cc +#CC=clang MAY_NEED_GCC= gcc -# winners that compile under ANSI C + +############################## +# Special flags for this entry +############################## # -WINNERS= schweikh1 df dloweneil banks dlowe bas2 fanf bas1 tomtorfs dorssel \ - schweikh2 schnitzi chaos schweikh3 -ALT_NAMES= schweikh2.orig banks.orig dlowe.orig df.orig schweikh1.orig \ - chaos_nohalf -DATA_FILES= banks_files chaos_files fanf_files schweikh1_files schweikh3_files - - -all: ${WINNERS} - -schweikh1: schweikh1.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh1.orig: schweikh1.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh1_files: info - -df: df.c - ${CC} ${CFLAGS} $? -o $@ - -df.orig: prog.c - ${CC} ${CFLAGS} $? -o $@ - -prog.c : df.c - ${RM} -f prog.c - ${CP} $? prog.c - -dloweneil: dloweneil.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - -# See note about use of -L/path/to/X11/lib/dir above this rule fails to link +ENTRY= banks +PROG= ${ENTRY} # -banks: banks.c - ${CC} ${CFLAGS} $? -DIT=XK_Page_Up -DDT=XK_Page_Down \ - -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \ - -DCS=XK_Return -Ddt=0.02 -lm -lX11 -o $@ - -# See note about use of -L/path/to/X11/lib/dir above this rule fails to link +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} # -banks.orig: banks.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -DIT=XK_Page_Up -DDT=XK_Page_Down \ - -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \ - -DCS=XK_Return -Ddt=0.02 -lm -lX11 -o $@ +ALT_OBJ= +ALT_TARGET= -banks_files: bb.sc horizon.sc mountains.sc pittsburgh.sc pyramids.sc river.sc -dlowe: dlowe.c - ${CC} ${CFLAGS} $? -o $@ - -dlowe.orig: dlowe.orig.c - ${CC} ${CFLAGS} $? -o $@ - -bas2: bas2.c - ${CC} ${CFLAGS} $? -o $@ - -fanf: fanf.c - ${RM} -f fanftmp1.c fanftmp2.c - ${MAY_NEED_GCC} ${CFLAGS} -E $? > fanftmp1.c - ${MAY_NEED_GCC} ${CFLAGS} -E fanftmp1.c > fanftmp2.c - ${MAY_NEED_GCC} ${CFLAGS} fanftmp2.c ${LDFLAGS} -o $@ - -fanf_files: fanf.lambda - -bas1: bas1.c - ${CC} ${CFLAGS} $? -o $@ - -tomtorfs: tomtorfs.c - ${CC} ${CFLAGS} $? -o $@ - -dorssel: dorssel.c - ${CC} ${CFLAGS} $? -o $@ - -schweikh2: schweikh2.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh2.orig: schweikh2.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh3: schweikh3.c - ${MAY_NEED_GCC} ${CFLAGS} $? -DM0=sizeof -DM1=long -DM2=void \ - -DM3=realloc -DM4=calloc -DM5=free -o $@ - -schweikh3_files: samefile.1 - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} $? -o $@ - -chaos: chaos.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - -# some libcurses do not have halfdelay(). This rule is for those systems +################# +# build the entry +################# # -chaos_nohalf: chaos_nohalf.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - ${CP} -f $@ chaos - -chaos_nohalf.c: chaos.c - ${RM} -f $@ - ${SED} -e 's/halfdelay([^)]*);//' < $? > $@ - -chaos_files: cube.data desk.data ioccc.data pyramid.data xwing.data - -everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES} - -clean: - ${RM} -f *.o a.out core ${WINNERS} - ${RM} -f prog.c fanftmp1.c fanftmp2.c chaos_nohalf.c - -clobber: clean - ${RM} -f ${WINNERS} - ${RM} -f ${ALT_NAMES} - -nuke: clobber +all: data ${TARGET} @${TRUE} -install: all - ${CAT} ${WINNERS} ${ALT_NAMES} > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1998/bas1/Makefile b/1998/bas1/Makefile index c939c82aa..f104ea3ae 100644 --- a/1998/bas1/Makefile +++ b/1998/bas1/Makefile @@ -1,43 +1,435 @@ -#!/bin/make -# 1998 makefile +#!/usr/bin/env make # -# Copyright (c) Landon Curt Noll, Jeremy Horn, Peter Seebach -# and Leonid A. Broukhis, 1999. -# 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 the contest judges. +# IOCCC 1998 winning entry - bas1 -SHELL=/bin/sh -CAT=cat -CHMOD=chmod -CP=cp -MV=mv -LN=ln -RM=rm -SED=sed -TRUE=true +################################################################################ +# +# 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 +# +################################################################################ -# flags for ANSI compiles +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: # -# 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. +# Creative Commons Attribution-ShareAlike 3.0 Unported License. # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +# See: http://creativecommons.org/licenses/by-sa/3.0/ + + +############################# +# shell used by this Makefile +############################# # -# NOTE: On some systems, the library path does not include the location -# of the X11 libraries. You might need to use a -L/path/to/X11/lib/dir -# in order to compile with these libs. +SHELL= bash + +####################### +# common tool locations +####################### # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -CFLAGS= -ansi -#CFLAGS= -ansi -O -#CFLAGS= -#CFLAGS= -ansi -L/usr/X11R6/lib +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 +# +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside +# +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # @@ -51,124 +443,175 @@ CFLAGS= -ansi # to disable such programs. # CC= cc +#CC=clang MAY_NEED_GCC= gcc -# winners that compile under ANSI C + +############################## +# Special flags for this entry +############################## # -WINNERS= schweikh1 df dloweneil banks dlowe bas2 fanf bas1 tomtorfs dorssel \ - schweikh2 schnitzi chaos schweikh3 -ALT_NAMES= schweikh2.orig banks.orig dlowe.orig df.orig schweikh1.orig \ - chaos_nohalf -DATA_FILES= banks_files chaos_files fanf_files schweikh1_files schweikh3_files - - -all: ${WINNERS} - -schweikh1: schweikh1.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh1.orig: schweikh1.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh1_files: info - -df: df.c - ${CC} ${CFLAGS} $? -o $@ - -df.orig: prog.c - ${CC} ${CFLAGS} $? -o $@ - -prog.c : df.c - ${RM} -f prog.c - ${CP} $? prog.c - -dloweneil: dloweneil.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - -# See note about use of -L/path/to/X11/lib/dir above this rule fails to link +ENTRY= bas1 +PROG= ${ENTRY} # -banks: banks.c - ${CC} ${CFLAGS} $? -DIT=XK_Page_Up -DDT=XK_Page_Down \ - -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \ - -DCS=XK_Return -Ddt=0.02 -lm -lX11 -o $@ - -# See note about use of -L/path/to/X11/lib/dir above this rule fails to link +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} # -banks.orig: banks.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -DIT=XK_Page_Up -DDT=XK_Page_Down \ - -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \ - -DCS=XK_Return -Ddt=0.02 -lm -lX11 -o $@ +ALT_OBJ= +ALT_TARGET= -banks_files: bb.sc horizon.sc mountains.sc pittsburgh.sc pyramids.sc river.sc -dlowe: dlowe.c - ${CC} ${CFLAGS} $? -o $@ - -dlowe.orig: dlowe.orig.c - ${CC} ${CFLAGS} $? -o $@ - -bas2: bas2.c - ${CC} ${CFLAGS} $? -o $@ - -fanf: fanf.c - ${RM} -f fanftmp1.c fanftmp2.c - ${MAY_NEED_GCC} ${CFLAGS} -E $? > fanftmp1.c - ${MAY_NEED_GCC} ${CFLAGS} -E fanftmp1.c > fanftmp2.c - ${MAY_NEED_GCC} ${CFLAGS} fanftmp2.c ${LDFLAGS} -o $@ - -fanf_files: fanf.lambda - -bas1: bas1.c - ${CC} ${CFLAGS} $? -o $@ - -tomtorfs: tomtorfs.c - ${CC} ${CFLAGS} $? -o $@ - -dorssel: dorssel.c - ${CC} ${CFLAGS} $? -o $@ - -schweikh2: schweikh2.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh2.orig: schweikh2.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh3: schweikh3.c - ${MAY_NEED_GCC} ${CFLAGS} $? -DM0=sizeof -DM1=long -DM2=void \ - -DM3=realloc -DM4=calloc -DM5=free -o $@ - -schweikh3_files: samefile.1 - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} $? -o $@ - -chaos: chaos.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - -# some libcurses do not have halfdelay(). This rule is for those systems +################# +# build the entry +################# # -chaos_nohalf: chaos_nohalf.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - ${CP} -f $@ chaos - -chaos_nohalf.c: chaos.c - ${RM} -f $@ - ${SED} -e 's/halfdelay([^)]*);//' < $? > $@ - -chaos_files: cube.data desk.data ioccc.data pyramid.data xwing.data - -everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES} - -clean: - ${RM} -f *.o a.out core ${WINNERS} - ${RM} -f prog.c fanftmp1.c fanftmp2.c chaos_nohalf.c - -clobber: clean - ${RM} -f ${WINNERS} - ${RM} -f ${ALT_NAMES} - -nuke: clobber +all: data ${TARGET} @${TRUE} -install: all - ${CAT} ${WINNERS} ${ALT_NAMES} > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1998/bas2/Makefile b/1998/bas2/Makefile index c939c82aa..13452cfbe 100644 --- a/1998/bas2/Makefile +++ b/1998/bas2/Makefile @@ -1,43 +1,435 @@ -#!/bin/make -# 1998 makefile +#!/usr/bin/env make # -# Copyright (c) Landon Curt Noll, Jeremy Horn, Peter Seebach -# and Leonid A. Broukhis, 1999. -# 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 the contest judges. +# IOCCC 1998 winning entry - bas2 -SHELL=/bin/sh -CAT=cat -CHMOD=chmod -CP=cp -MV=mv -LN=ln -RM=rm -SED=sed -TRUE=true +################################################################################ +# +# 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 +# +################################################################################ -# flags for ANSI compiles +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: # -# 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. +# Creative Commons Attribution-ShareAlike 3.0 Unported License. # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +# See: http://creativecommons.org/licenses/by-sa/3.0/ + + +############################# +# shell used by this Makefile +############################# # -# NOTE: On some systems, the library path does not include the location -# of the X11 libraries. You might need to use a -L/path/to/X11/lib/dir -# in order to compile with these libs. +SHELL= bash + +####################### +# common tool locations +####################### # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -CFLAGS= -ansi -#CFLAGS= -ansi -O -#CFLAGS= -#CFLAGS= -ansi -L/usr/X11R6/lib +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 +# +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside +# +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # @@ -51,124 +443,175 @@ CFLAGS= -ansi # to disable such programs. # CC= cc +#CC=clang MAY_NEED_GCC= gcc -# winners that compile under ANSI C + +############################## +# Special flags for this entry +############################## # -WINNERS= schweikh1 df dloweneil banks dlowe bas2 fanf bas1 tomtorfs dorssel \ - schweikh2 schnitzi chaos schweikh3 -ALT_NAMES= schweikh2.orig banks.orig dlowe.orig df.orig schweikh1.orig \ - chaos_nohalf -DATA_FILES= banks_files chaos_files fanf_files schweikh1_files schweikh3_files - - -all: ${WINNERS} - -schweikh1: schweikh1.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh1.orig: schweikh1.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh1_files: info - -df: df.c - ${CC} ${CFLAGS} $? -o $@ - -df.orig: prog.c - ${CC} ${CFLAGS} $? -o $@ - -prog.c : df.c - ${RM} -f prog.c - ${CP} $? prog.c - -dloweneil: dloweneil.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - -# See note about use of -L/path/to/X11/lib/dir above this rule fails to link +ENTRY= bas2 +PROG= ${ENTRY} # -banks: banks.c - ${CC} ${CFLAGS} $? -DIT=XK_Page_Up -DDT=XK_Page_Down \ - -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \ - -DCS=XK_Return -Ddt=0.02 -lm -lX11 -o $@ - -# See note about use of -L/path/to/X11/lib/dir above this rule fails to link +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} # -banks.orig: banks.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -DIT=XK_Page_Up -DDT=XK_Page_Down \ - -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \ - -DCS=XK_Return -Ddt=0.02 -lm -lX11 -o $@ +ALT_OBJ= +ALT_TARGET= -banks_files: bb.sc horizon.sc mountains.sc pittsburgh.sc pyramids.sc river.sc -dlowe: dlowe.c - ${CC} ${CFLAGS} $? -o $@ - -dlowe.orig: dlowe.orig.c - ${CC} ${CFLAGS} $? -o $@ - -bas2: bas2.c - ${CC} ${CFLAGS} $? -o $@ - -fanf: fanf.c - ${RM} -f fanftmp1.c fanftmp2.c - ${MAY_NEED_GCC} ${CFLAGS} -E $? > fanftmp1.c - ${MAY_NEED_GCC} ${CFLAGS} -E fanftmp1.c > fanftmp2.c - ${MAY_NEED_GCC} ${CFLAGS} fanftmp2.c ${LDFLAGS} -o $@ - -fanf_files: fanf.lambda - -bas1: bas1.c - ${CC} ${CFLAGS} $? -o $@ - -tomtorfs: tomtorfs.c - ${CC} ${CFLAGS} $? -o $@ - -dorssel: dorssel.c - ${CC} ${CFLAGS} $? -o $@ - -schweikh2: schweikh2.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh2.orig: schweikh2.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh3: schweikh3.c - ${MAY_NEED_GCC} ${CFLAGS} $? -DM0=sizeof -DM1=long -DM2=void \ - -DM3=realloc -DM4=calloc -DM5=free -o $@ - -schweikh3_files: samefile.1 - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} $? -o $@ - -chaos: chaos.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - -# some libcurses do not have halfdelay(). This rule is for those systems +################# +# build the entry +################# # -chaos_nohalf: chaos_nohalf.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - ${CP} -f $@ chaos - -chaos_nohalf.c: chaos.c - ${RM} -f $@ - ${SED} -e 's/halfdelay([^)]*);//' < $? > $@ - -chaos_files: cube.data desk.data ioccc.data pyramid.data xwing.data - -everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES} - -clean: - ${RM} -f *.o a.out core ${WINNERS} - ${RM} -f prog.c fanftmp1.c fanftmp2.c chaos_nohalf.c - -clobber: clean - ${RM} -f ${WINNERS} - ${RM} -f ${ALT_NAMES} - -nuke: clobber +all: data ${TARGET} @${TRUE} -install: all - ${CAT} ${WINNERS} ${ALT_NAMES} > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1998/chaos/Makefile b/1998/chaos/Makefile index c939c82aa..f34bcc638 100644 --- a/1998/chaos/Makefile +++ b/1998/chaos/Makefile @@ -1,43 +1,435 @@ -#!/bin/make -# 1998 makefile +#!/usr/bin/env make # -# Copyright (c) Landon Curt Noll, Jeremy Horn, Peter Seebach -# and Leonid A. Broukhis, 1999. -# 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 the contest judges. +# IOCCC 1998 winning entry - chaos -SHELL=/bin/sh -CAT=cat -CHMOD=chmod -CP=cp -MV=mv -LN=ln -RM=rm -SED=sed -TRUE=true +################################################################################ +# +# 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 +# +################################################################################ -# flags for ANSI compiles +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: # -# 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. +# Creative Commons Attribution-ShareAlike 3.0 Unported License. # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +# See: http://creativecommons.org/licenses/by-sa/3.0/ + + +############################# +# shell used by this Makefile +############################# # -# NOTE: On some systems, the library path does not include the location -# of the X11 libraries. You might need to use a -L/path/to/X11/lib/dir -# in order to compile with these libs. +SHELL= bash + +####################### +# common tool locations +####################### # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -CFLAGS= -ansi -#CFLAGS= -ansi -O -#CFLAGS= -#CFLAGS= -ansi -L/usr/X11R6/lib +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 +# +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside +# +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # @@ -51,124 +443,175 @@ CFLAGS= -ansi # to disable such programs. # CC= cc +#CC=clang MAY_NEED_GCC= gcc -# winners that compile under ANSI C + +############################## +# Special flags for this entry +############################## # -WINNERS= schweikh1 df dloweneil banks dlowe bas2 fanf bas1 tomtorfs dorssel \ - schweikh2 schnitzi chaos schweikh3 -ALT_NAMES= schweikh2.orig banks.orig dlowe.orig df.orig schweikh1.orig \ - chaos_nohalf -DATA_FILES= banks_files chaos_files fanf_files schweikh1_files schweikh3_files - - -all: ${WINNERS} - -schweikh1: schweikh1.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh1.orig: schweikh1.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh1_files: info - -df: df.c - ${CC} ${CFLAGS} $? -o $@ - -df.orig: prog.c - ${CC} ${CFLAGS} $? -o $@ - -prog.c : df.c - ${RM} -f prog.c - ${CP} $? prog.c - -dloweneil: dloweneil.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - -# See note about use of -L/path/to/X11/lib/dir above this rule fails to link +ENTRY= chaos +PROG= ${ENTRY} # -banks: banks.c - ${CC} ${CFLAGS} $? -DIT=XK_Page_Up -DDT=XK_Page_Down \ - -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \ - -DCS=XK_Return -Ddt=0.02 -lm -lX11 -o $@ - -# See note about use of -L/path/to/X11/lib/dir above this rule fails to link +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} # -banks.orig: banks.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -DIT=XK_Page_Up -DDT=XK_Page_Down \ - -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \ - -DCS=XK_Return -Ddt=0.02 -lm -lX11 -o $@ +ALT_OBJ= +ALT_TARGET= -banks_files: bb.sc horizon.sc mountains.sc pittsburgh.sc pyramids.sc river.sc -dlowe: dlowe.c - ${CC} ${CFLAGS} $? -o $@ - -dlowe.orig: dlowe.orig.c - ${CC} ${CFLAGS} $? -o $@ - -bas2: bas2.c - ${CC} ${CFLAGS} $? -o $@ - -fanf: fanf.c - ${RM} -f fanftmp1.c fanftmp2.c - ${MAY_NEED_GCC} ${CFLAGS} -E $? > fanftmp1.c - ${MAY_NEED_GCC} ${CFLAGS} -E fanftmp1.c > fanftmp2.c - ${MAY_NEED_GCC} ${CFLAGS} fanftmp2.c ${LDFLAGS} -o $@ - -fanf_files: fanf.lambda - -bas1: bas1.c - ${CC} ${CFLAGS} $? -o $@ - -tomtorfs: tomtorfs.c - ${CC} ${CFLAGS} $? -o $@ - -dorssel: dorssel.c - ${CC} ${CFLAGS} $? -o $@ - -schweikh2: schweikh2.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh2.orig: schweikh2.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh3: schweikh3.c - ${MAY_NEED_GCC} ${CFLAGS} $? -DM0=sizeof -DM1=long -DM2=void \ - -DM3=realloc -DM4=calloc -DM5=free -o $@ - -schweikh3_files: samefile.1 - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} $? -o $@ - -chaos: chaos.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - -# some libcurses do not have halfdelay(). This rule is for those systems +################# +# build the entry +################# # -chaos_nohalf: chaos_nohalf.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - ${CP} -f $@ chaos - -chaos_nohalf.c: chaos.c - ${RM} -f $@ - ${SED} -e 's/halfdelay([^)]*);//' < $? > $@ - -chaos_files: cube.data desk.data ioccc.data pyramid.data xwing.data - -everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES} - -clean: - ${RM} -f *.o a.out core ${WINNERS} - ${RM} -f prog.c fanftmp1.c fanftmp2.c chaos_nohalf.c - -clobber: clean - ${RM} -f ${WINNERS} - ${RM} -f ${ALT_NAMES} - -nuke: clobber +all: data ${TARGET} @${TRUE} -install: all - ${CAT} ${WINNERS} ${ALT_NAMES} > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1998/df/Makefile b/1998/df/Makefile index c939c82aa..19b3d51e4 100644 --- a/1998/df/Makefile +++ b/1998/df/Makefile @@ -1,43 +1,435 @@ -#!/bin/make -# 1998 makefile +#!/usr/bin/env make # -# Copyright (c) Landon Curt Noll, Jeremy Horn, Peter Seebach -# and Leonid A. Broukhis, 1999. -# 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 the contest judges. +# IOCCC 1998 winning entry - df -SHELL=/bin/sh -CAT=cat -CHMOD=chmod -CP=cp -MV=mv -LN=ln -RM=rm -SED=sed -TRUE=true +################################################################################ +# +# 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 +# +################################################################################ -# flags for ANSI compiles +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: # -# 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. +# Creative Commons Attribution-ShareAlike 3.0 Unported License. # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +# See: http://creativecommons.org/licenses/by-sa/3.0/ + + +############################# +# shell used by this Makefile +############################# # -# NOTE: On some systems, the library path does not include the location -# of the X11 libraries. You might need to use a -L/path/to/X11/lib/dir -# in order to compile with these libs. +SHELL= bash + +####################### +# common tool locations +####################### # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -CFLAGS= -ansi -#CFLAGS= -ansi -O -#CFLAGS= -#CFLAGS= -ansi -L/usr/X11R6/lib +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 +# +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside +# +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # @@ -51,124 +443,175 @@ CFLAGS= -ansi # to disable such programs. # CC= cc +#CC=clang MAY_NEED_GCC= gcc -# winners that compile under ANSI C + +############################## +# Special flags for this entry +############################## # -WINNERS= schweikh1 df dloweneil banks dlowe bas2 fanf bas1 tomtorfs dorssel \ - schweikh2 schnitzi chaos schweikh3 -ALT_NAMES= schweikh2.orig banks.orig dlowe.orig df.orig schweikh1.orig \ - chaos_nohalf -DATA_FILES= banks_files chaos_files fanf_files schweikh1_files schweikh3_files - - -all: ${WINNERS} - -schweikh1: schweikh1.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh1.orig: schweikh1.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh1_files: info - -df: df.c - ${CC} ${CFLAGS} $? -o $@ - -df.orig: prog.c - ${CC} ${CFLAGS} $? -o $@ - -prog.c : df.c - ${RM} -f prog.c - ${CP} $? prog.c - -dloweneil: dloweneil.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - -# See note about use of -L/path/to/X11/lib/dir above this rule fails to link +ENTRY= df +PROG= ${ENTRY} # -banks: banks.c - ${CC} ${CFLAGS} $? -DIT=XK_Page_Up -DDT=XK_Page_Down \ - -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \ - -DCS=XK_Return -Ddt=0.02 -lm -lX11 -o $@ - -# See note about use of -L/path/to/X11/lib/dir above this rule fails to link +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} # -banks.orig: banks.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -DIT=XK_Page_Up -DDT=XK_Page_Down \ - -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \ - -DCS=XK_Return -Ddt=0.02 -lm -lX11 -o $@ +ALT_OBJ= +ALT_TARGET= -banks_files: bb.sc horizon.sc mountains.sc pittsburgh.sc pyramids.sc river.sc -dlowe: dlowe.c - ${CC} ${CFLAGS} $? -o $@ - -dlowe.orig: dlowe.orig.c - ${CC} ${CFLAGS} $? -o $@ - -bas2: bas2.c - ${CC} ${CFLAGS} $? -o $@ - -fanf: fanf.c - ${RM} -f fanftmp1.c fanftmp2.c - ${MAY_NEED_GCC} ${CFLAGS} -E $? > fanftmp1.c - ${MAY_NEED_GCC} ${CFLAGS} -E fanftmp1.c > fanftmp2.c - ${MAY_NEED_GCC} ${CFLAGS} fanftmp2.c ${LDFLAGS} -o $@ - -fanf_files: fanf.lambda - -bas1: bas1.c - ${CC} ${CFLAGS} $? -o $@ - -tomtorfs: tomtorfs.c - ${CC} ${CFLAGS} $? -o $@ - -dorssel: dorssel.c - ${CC} ${CFLAGS} $? -o $@ - -schweikh2: schweikh2.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh2.orig: schweikh2.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh3: schweikh3.c - ${MAY_NEED_GCC} ${CFLAGS} $? -DM0=sizeof -DM1=long -DM2=void \ - -DM3=realloc -DM4=calloc -DM5=free -o $@ - -schweikh3_files: samefile.1 - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} $? -o $@ - -chaos: chaos.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - -# some libcurses do not have halfdelay(). This rule is for those systems +################# +# build the entry +################# # -chaos_nohalf: chaos_nohalf.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - ${CP} -f $@ chaos - -chaos_nohalf.c: chaos.c - ${RM} -f $@ - ${SED} -e 's/halfdelay([^)]*);//' < $? > $@ - -chaos_files: cube.data desk.data ioccc.data pyramid.data xwing.data - -everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES} - -clean: - ${RM} -f *.o a.out core ${WINNERS} - ${RM} -f prog.c fanftmp1.c fanftmp2.c chaos_nohalf.c - -clobber: clean - ${RM} -f ${WINNERS} - ${RM} -f ${ALT_NAMES} - -nuke: clobber +all: data ${TARGET} @${TRUE} -install: all - ${CAT} ${WINNERS} ${ALT_NAMES} > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1998/dlowe/Makefile b/1998/dlowe/Makefile index c939c82aa..715692373 100644 --- a/1998/dlowe/Makefile +++ b/1998/dlowe/Makefile @@ -1,43 +1,435 @@ -#!/bin/make -# 1998 makefile +#!/usr/bin/env make # -# Copyright (c) Landon Curt Noll, Jeremy Horn, Peter Seebach -# and Leonid A. Broukhis, 1999. -# 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 the contest judges. +# IOCCC 1998 winning entry - dlowe -SHELL=/bin/sh -CAT=cat -CHMOD=chmod -CP=cp -MV=mv -LN=ln -RM=rm -SED=sed -TRUE=true +################################################################################ +# +# 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 +# +################################################################################ -# flags for ANSI compiles +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: # -# 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. +# Creative Commons Attribution-ShareAlike 3.0 Unported License. # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +# See: http://creativecommons.org/licenses/by-sa/3.0/ + + +############################# +# shell used by this Makefile +############################# # -# NOTE: On some systems, the library path does not include the location -# of the X11 libraries. You might need to use a -L/path/to/X11/lib/dir -# in order to compile with these libs. +SHELL= bash + +####################### +# common tool locations +####################### # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -CFLAGS= -ansi -#CFLAGS= -ansi -O -#CFLAGS= -#CFLAGS= -ansi -L/usr/X11R6/lib +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 +# +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside +# +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # @@ -51,124 +443,175 @@ CFLAGS= -ansi # to disable such programs. # CC= cc +#CC=clang MAY_NEED_GCC= gcc -# winners that compile under ANSI C + +############################## +# Special flags for this entry +############################## # -WINNERS= schweikh1 df dloweneil banks dlowe bas2 fanf bas1 tomtorfs dorssel \ - schweikh2 schnitzi chaos schweikh3 -ALT_NAMES= schweikh2.orig banks.orig dlowe.orig df.orig schweikh1.orig \ - chaos_nohalf -DATA_FILES= banks_files chaos_files fanf_files schweikh1_files schweikh3_files - - -all: ${WINNERS} - -schweikh1: schweikh1.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh1.orig: schweikh1.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh1_files: info - -df: df.c - ${CC} ${CFLAGS} $? -o $@ - -df.orig: prog.c - ${CC} ${CFLAGS} $? -o $@ - -prog.c : df.c - ${RM} -f prog.c - ${CP} $? prog.c - -dloweneil: dloweneil.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - -# See note about use of -L/path/to/X11/lib/dir above this rule fails to link +ENTRY= dlowe +PROG= ${ENTRY} # -banks: banks.c - ${CC} ${CFLAGS} $? -DIT=XK_Page_Up -DDT=XK_Page_Down \ - -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \ - -DCS=XK_Return -Ddt=0.02 -lm -lX11 -o $@ - -# See note about use of -L/path/to/X11/lib/dir above this rule fails to link +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} # -banks.orig: banks.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -DIT=XK_Page_Up -DDT=XK_Page_Down \ - -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \ - -DCS=XK_Return -Ddt=0.02 -lm -lX11 -o $@ +ALT_OBJ= +ALT_TARGET= -banks_files: bb.sc horizon.sc mountains.sc pittsburgh.sc pyramids.sc river.sc -dlowe: dlowe.c - ${CC} ${CFLAGS} $? -o $@ - -dlowe.orig: dlowe.orig.c - ${CC} ${CFLAGS} $? -o $@ - -bas2: bas2.c - ${CC} ${CFLAGS} $? -o $@ - -fanf: fanf.c - ${RM} -f fanftmp1.c fanftmp2.c - ${MAY_NEED_GCC} ${CFLAGS} -E $? > fanftmp1.c - ${MAY_NEED_GCC} ${CFLAGS} -E fanftmp1.c > fanftmp2.c - ${MAY_NEED_GCC} ${CFLAGS} fanftmp2.c ${LDFLAGS} -o $@ - -fanf_files: fanf.lambda - -bas1: bas1.c - ${CC} ${CFLAGS} $? -o $@ - -tomtorfs: tomtorfs.c - ${CC} ${CFLAGS} $? -o $@ - -dorssel: dorssel.c - ${CC} ${CFLAGS} $? -o $@ - -schweikh2: schweikh2.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh2.orig: schweikh2.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh3: schweikh3.c - ${MAY_NEED_GCC} ${CFLAGS} $? -DM0=sizeof -DM1=long -DM2=void \ - -DM3=realloc -DM4=calloc -DM5=free -o $@ - -schweikh3_files: samefile.1 - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} $? -o $@ - -chaos: chaos.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - -# some libcurses do not have halfdelay(). This rule is for those systems +################# +# build the entry +################# # -chaos_nohalf: chaos_nohalf.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - ${CP} -f $@ chaos - -chaos_nohalf.c: chaos.c - ${RM} -f $@ - ${SED} -e 's/halfdelay([^)]*);//' < $? > $@ - -chaos_files: cube.data desk.data ioccc.data pyramid.data xwing.data - -everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES} - -clean: - ${RM} -f *.o a.out core ${WINNERS} - ${RM} -f prog.c fanftmp1.c fanftmp2.c chaos_nohalf.c - -clobber: clean - ${RM} -f ${WINNERS} - ${RM} -f ${ALT_NAMES} - -nuke: clobber +all: data ${TARGET} @${TRUE} -install: all - ${CAT} ${WINNERS} ${ALT_NAMES} > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1998/dloweneil/Makefile b/1998/dloweneil/Makefile index c939c82aa..426330829 100644 --- a/1998/dloweneil/Makefile +++ b/1998/dloweneil/Makefile @@ -1,43 +1,435 @@ -#!/bin/make -# 1998 makefile +#!/usr/bin/env make # -# Copyright (c) Landon Curt Noll, Jeremy Horn, Peter Seebach -# and Leonid A. Broukhis, 1999. -# 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 the contest judges. +# IOCCC 1998 winning entry - dloweneil -SHELL=/bin/sh -CAT=cat -CHMOD=chmod -CP=cp -MV=mv -LN=ln -RM=rm -SED=sed -TRUE=true +################################################################################ +# +# 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 +# +################################################################################ -# flags for ANSI compiles +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: # -# 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. +# Creative Commons Attribution-ShareAlike 3.0 Unported License. # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +# See: http://creativecommons.org/licenses/by-sa/3.0/ + + +############################# +# shell used by this Makefile +############################# # -# NOTE: On some systems, the library path does not include the location -# of the X11 libraries. You might need to use a -L/path/to/X11/lib/dir -# in order to compile with these libs. +SHELL= bash + +####################### +# common tool locations +####################### # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -CFLAGS= -ansi -#CFLAGS= -ansi -O -#CFLAGS= -#CFLAGS= -ansi -L/usr/X11R6/lib +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 +# +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside +# +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # @@ -51,124 +443,175 @@ CFLAGS= -ansi # to disable such programs. # CC= cc +#CC=clang MAY_NEED_GCC= gcc -# winners that compile under ANSI C + +############################## +# Special flags for this entry +############################## # -WINNERS= schweikh1 df dloweneil banks dlowe bas2 fanf bas1 tomtorfs dorssel \ - schweikh2 schnitzi chaos schweikh3 -ALT_NAMES= schweikh2.orig banks.orig dlowe.orig df.orig schweikh1.orig \ - chaos_nohalf -DATA_FILES= banks_files chaos_files fanf_files schweikh1_files schweikh3_files - - -all: ${WINNERS} - -schweikh1: schweikh1.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh1.orig: schweikh1.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh1_files: info - -df: df.c - ${CC} ${CFLAGS} $? -o $@ - -df.orig: prog.c - ${CC} ${CFLAGS} $? -o $@ - -prog.c : df.c - ${RM} -f prog.c - ${CP} $? prog.c - -dloweneil: dloweneil.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - -# See note about use of -L/path/to/X11/lib/dir above this rule fails to link +ENTRY= dloweneil +PROG= ${ENTRY} # -banks: banks.c - ${CC} ${CFLAGS} $? -DIT=XK_Page_Up -DDT=XK_Page_Down \ - -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \ - -DCS=XK_Return -Ddt=0.02 -lm -lX11 -o $@ - -# See note about use of -L/path/to/X11/lib/dir above this rule fails to link +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} # -banks.orig: banks.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -DIT=XK_Page_Up -DDT=XK_Page_Down \ - -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \ - -DCS=XK_Return -Ddt=0.02 -lm -lX11 -o $@ +ALT_OBJ= +ALT_TARGET= -banks_files: bb.sc horizon.sc mountains.sc pittsburgh.sc pyramids.sc river.sc -dlowe: dlowe.c - ${CC} ${CFLAGS} $? -o $@ - -dlowe.orig: dlowe.orig.c - ${CC} ${CFLAGS} $? -o $@ - -bas2: bas2.c - ${CC} ${CFLAGS} $? -o $@ - -fanf: fanf.c - ${RM} -f fanftmp1.c fanftmp2.c - ${MAY_NEED_GCC} ${CFLAGS} -E $? > fanftmp1.c - ${MAY_NEED_GCC} ${CFLAGS} -E fanftmp1.c > fanftmp2.c - ${MAY_NEED_GCC} ${CFLAGS} fanftmp2.c ${LDFLAGS} -o $@ - -fanf_files: fanf.lambda - -bas1: bas1.c - ${CC} ${CFLAGS} $? -o $@ - -tomtorfs: tomtorfs.c - ${CC} ${CFLAGS} $? -o $@ - -dorssel: dorssel.c - ${CC} ${CFLAGS} $? -o $@ - -schweikh2: schweikh2.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh2.orig: schweikh2.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh3: schweikh3.c - ${MAY_NEED_GCC} ${CFLAGS} $? -DM0=sizeof -DM1=long -DM2=void \ - -DM3=realloc -DM4=calloc -DM5=free -o $@ - -schweikh3_files: samefile.1 - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} $? -o $@ - -chaos: chaos.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - -# some libcurses do not have halfdelay(). This rule is for those systems +################# +# build the entry +################# # -chaos_nohalf: chaos_nohalf.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - ${CP} -f $@ chaos - -chaos_nohalf.c: chaos.c - ${RM} -f $@ - ${SED} -e 's/halfdelay([^)]*);//' < $? > $@ - -chaos_files: cube.data desk.data ioccc.data pyramid.data xwing.data - -everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES} - -clean: - ${RM} -f *.o a.out core ${WINNERS} - ${RM} -f prog.c fanftmp1.c fanftmp2.c chaos_nohalf.c - -clobber: clean - ${RM} -f ${WINNERS} - ${RM} -f ${ALT_NAMES} - -nuke: clobber +all: data ${TARGET} @${TRUE} -install: all - ${CAT} ${WINNERS} ${ALT_NAMES} > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1998/dorssel/Makefile b/1998/dorssel/Makefile index c939c82aa..0c0534b3e 100644 --- a/1998/dorssel/Makefile +++ b/1998/dorssel/Makefile @@ -1,43 +1,435 @@ -#!/bin/make -# 1998 makefile +#!/usr/bin/env make # -# Copyright (c) Landon Curt Noll, Jeremy Horn, Peter Seebach -# and Leonid A. Broukhis, 1999. -# 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 the contest judges. +# IOCCC 1998 winning entry - dorssel -SHELL=/bin/sh -CAT=cat -CHMOD=chmod -CP=cp -MV=mv -LN=ln -RM=rm -SED=sed -TRUE=true +################################################################################ +# +# 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 +# +################################################################################ -# flags for ANSI compiles +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: # -# 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. +# Creative Commons Attribution-ShareAlike 3.0 Unported License. # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +# See: http://creativecommons.org/licenses/by-sa/3.0/ + + +############################# +# shell used by this Makefile +############################# # -# NOTE: On some systems, the library path does not include the location -# of the X11 libraries. You might need to use a -L/path/to/X11/lib/dir -# in order to compile with these libs. +SHELL= bash + +####################### +# common tool locations +####################### # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -CFLAGS= -ansi -#CFLAGS= -ansi -O -#CFLAGS= -#CFLAGS= -ansi -L/usr/X11R6/lib +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 +# +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside +# +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # @@ -51,124 +443,175 @@ CFLAGS= -ansi # to disable such programs. # CC= cc +#CC=clang MAY_NEED_GCC= gcc -# winners that compile under ANSI C + +############################## +# Special flags for this entry +############################## # -WINNERS= schweikh1 df dloweneil banks dlowe bas2 fanf bas1 tomtorfs dorssel \ - schweikh2 schnitzi chaos schweikh3 -ALT_NAMES= schweikh2.orig banks.orig dlowe.orig df.orig schweikh1.orig \ - chaos_nohalf -DATA_FILES= banks_files chaos_files fanf_files schweikh1_files schweikh3_files - - -all: ${WINNERS} - -schweikh1: schweikh1.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh1.orig: schweikh1.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh1_files: info - -df: df.c - ${CC} ${CFLAGS} $? -o $@ - -df.orig: prog.c - ${CC} ${CFLAGS} $? -o $@ - -prog.c : df.c - ${RM} -f prog.c - ${CP} $? prog.c - -dloweneil: dloweneil.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - -# See note about use of -L/path/to/X11/lib/dir above this rule fails to link +ENTRY= dorssel +PROG= ${ENTRY} # -banks: banks.c - ${CC} ${CFLAGS} $? -DIT=XK_Page_Up -DDT=XK_Page_Down \ - -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \ - -DCS=XK_Return -Ddt=0.02 -lm -lX11 -o $@ - -# See note about use of -L/path/to/X11/lib/dir above this rule fails to link +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} # -banks.orig: banks.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -DIT=XK_Page_Up -DDT=XK_Page_Down \ - -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \ - -DCS=XK_Return -Ddt=0.02 -lm -lX11 -o $@ +ALT_OBJ= +ALT_TARGET= -banks_files: bb.sc horizon.sc mountains.sc pittsburgh.sc pyramids.sc river.sc -dlowe: dlowe.c - ${CC} ${CFLAGS} $? -o $@ - -dlowe.orig: dlowe.orig.c - ${CC} ${CFLAGS} $? -o $@ - -bas2: bas2.c - ${CC} ${CFLAGS} $? -o $@ - -fanf: fanf.c - ${RM} -f fanftmp1.c fanftmp2.c - ${MAY_NEED_GCC} ${CFLAGS} -E $? > fanftmp1.c - ${MAY_NEED_GCC} ${CFLAGS} -E fanftmp1.c > fanftmp2.c - ${MAY_NEED_GCC} ${CFLAGS} fanftmp2.c ${LDFLAGS} -o $@ - -fanf_files: fanf.lambda - -bas1: bas1.c - ${CC} ${CFLAGS} $? -o $@ - -tomtorfs: tomtorfs.c - ${CC} ${CFLAGS} $? -o $@ - -dorssel: dorssel.c - ${CC} ${CFLAGS} $? -o $@ - -schweikh2: schweikh2.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh2.orig: schweikh2.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh3: schweikh3.c - ${MAY_NEED_GCC} ${CFLAGS} $? -DM0=sizeof -DM1=long -DM2=void \ - -DM3=realloc -DM4=calloc -DM5=free -o $@ - -schweikh3_files: samefile.1 - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} $? -o $@ - -chaos: chaos.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - -# some libcurses do not have halfdelay(). This rule is for those systems +################# +# build the entry +################# # -chaos_nohalf: chaos_nohalf.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - ${CP} -f $@ chaos - -chaos_nohalf.c: chaos.c - ${RM} -f $@ - ${SED} -e 's/halfdelay([^)]*);//' < $? > $@ - -chaos_files: cube.data desk.data ioccc.data pyramid.data xwing.data - -everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES} - -clean: - ${RM} -f *.o a.out core ${WINNERS} - ${RM} -f prog.c fanftmp1.c fanftmp2.c chaos_nohalf.c - -clobber: clean - ${RM} -f ${WINNERS} - ${RM} -f ${ALT_NAMES} - -nuke: clobber +all: data ${TARGET} @${TRUE} -install: all - ${CAT} ${WINNERS} ${ALT_NAMES} > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1998/fanf/Makefile b/1998/fanf/Makefile index c939c82aa..f37175b11 100644 --- a/1998/fanf/Makefile +++ b/1998/fanf/Makefile @@ -1,43 +1,435 @@ -#!/bin/make -# 1998 makefile +#!/usr/bin/env make # -# Copyright (c) Landon Curt Noll, Jeremy Horn, Peter Seebach -# and Leonid A. Broukhis, 1999. -# 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 the contest judges. +# IOCCC 1998 winning entry - fanf -SHELL=/bin/sh -CAT=cat -CHMOD=chmod -CP=cp -MV=mv -LN=ln -RM=rm -SED=sed -TRUE=true +################################################################################ +# +# 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 +# +################################################################################ -# flags for ANSI compiles +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: # -# 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. +# Creative Commons Attribution-ShareAlike 3.0 Unported License. # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +# See: http://creativecommons.org/licenses/by-sa/3.0/ + + +############################# +# shell used by this Makefile +############################# # -# NOTE: On some systems, the library path does not include the location -# of the X11 libraries. You might need to use a -L/path/to/X11/lib/dir -# in order to compile with these libs. +SHELL= bash + +####################### +# common tool locations +####################### # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -CFLAGS= -ansi -#CFLAGS= -ansi -O -#CFLAGS= -#CFLAGS= -ansi -L/usr/X11R6/lib +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 +# +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside +# +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # @@ -51,124 +443,175 @@ CFLAGS= -ansi # to disable such programs. # CC= cc +#CC=clang MAY_NEED_GCC= gcc -# winners that compile under ANSI C + +############################## +# Special flags for this entry +############################## # -WINNERS= schweikh1 df dloweneil banks dlowe bas2 fanf bas1 tomtorfs dorssel \ - schweikh2 schnitzi chaos schweikh3 -ALT_NAMES= schweikh2.orig banks.orig dlowe.orig df.orig schweikh1.orig \ - chaos_nohalf -DATA_FILES= banks_files chaos_files fanf_files schweikh1_files schweikh3_files - - -all: ${WINNERS} - -schweikh1: schweikh1.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh1.orig: schweikh1.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh1_files: info - -df: df.c - ${CC} ${CFLAGS} $? -o $@ - -df.orig: prog.c - ${CC} ${CFLAGS} $? -o $@ - -prog.c : df.c - ${RM} -f prog.c - ${CP} $? prog.c - -dloweneil: dloweneil.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - -# See note about use of -L/path/to/X11/lib/dir above this rule fails to link +ENTRY= fanf +PROG= ${ENTRY} # -banks: banks.c - ${CC} ${CFLAGS} $? -DIT=XK_Page_Up -DDT=XK_Page_Down \ - -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \ - -DCS=XK_Return -Ddt=0.02 -lm -lX11 -o $@ - -# See note about use of -L/path/to/X11/lib/dir above this rule fails to link +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} # -banks.orig: banks.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -DIT=XK_Page_Up -DDT=XK_Page_Down \ - -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \ - -DCS=XK_Return -Ddt=0.02 -lm -lX11 -o $@ +ALT_OBJ= +ALT_TARGET= -banks_files: bb.sc horizon.sc mountains.sc pittsburgh.sc pyramids.sc river.sc -dlowe: dlowe.c - ${CC} ${CFLAGS} $? -o $@ - -dlowe.orig: dlowe.orig.c - ${CC} ${CFLAGS} $? -o $@ - -bas2: bas2.c - ${CC} ${CFLAGS} $? -o $@ - -fanf: fanf.c - ${RM} -f fanftmp1.c fanftmp2.c - ${MAY_NEED_GCC} ${CFLAGS} -E $? > fanftmp1.c - ${MAY_NEED_GCC} ${CFLAGS} -E fanftmp1.c > fanftmp2.c - ${MAY_NEED_GCC} ${CFLAGS} fanftmp2.c ${LDFLAGS} -o $@ - -fanf_files: fanf.lambda - -bas1: bas1.c - ${CC} ${CFLAGS} $? -o $@ - -tomtorfs: tomtorfs.c - ${CC} ${CFLAGS} $? -o $@ - -dorssel: dorssel.c - ${CC} ${CFLAGS} $? -o $@ - -schweikh2: schweikh2.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh2.orig: schweikh2.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh3: schweikh3.c - ${MAY_NEED_GCC} ${CFLAGS} $? -DM0=sizeof -DM1=long -DM2=void \ - -DM3=realloc -DM4=calloc -DM5=free -o $@ - -schweikh3_files: samefile.1 - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} $? -o $@ - -chaos: chaos.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - -# some libcurses do not have halfdelay(). This rule is for those systems +################# +# build the entry +################# # -chaos_nohalf: chaos_nohalf.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - ${CP} -f $@ chaos - -chaos_nohalf.c: chaos.c - ${RM} -f $@ - ${SED} -e 's/halfdelay([^)]*);//' < $? > $@ - -chaos_files: cube.data desk.data ioccc.data pyramid.data xwing.data - -everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES} - -clean: - ${RM} -f *.o a.out core ${WINNERS} - ${RM} -f prog.c fanftmp1.c fanftmp2.c chaos_nohalf.c - -clobber: clean - ${RM} -f ${WINNERS} - ${RM} -f ${ALT_NAMES} - -nuke: clobber +all: data ${TARGET} @${TRUE} -install: all - ${CAT} ${WINNERS} ${ALT_NAMES} > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1998/schnitzi/Makefile b/1998/schnitzi/Makefile index c939c82aa..3c8365234 100644 --- a/1998/schnitzi/Makefile +++ b/1998/schnitzi/Makefile @@ -1,43 +1,435 @@ -#!/bin/make -# 1998 makefile +#!/usr/bin/env make # -# Copyright (c) Landon Curt Noll, Jeremy Horn, Peter Seebach -# and Leonid A. Broukhis, 1999. -# 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 the contest judges. +# IOCCC 1998 winning entry - schnitzi -SHELL=/bin/sh -CAT=cat -CHMOD=chmod -CP=cp -MV=mv -LN=ln -RM=rm -SED=sed -TRUE=true +################################################################################ +# +# 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 +# +################################################################################ -# flags for ANSI compiles +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: # -# 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. +# Creative Commons Attribution-ShareAlike 3.0 Unported License. # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +# See: http://creativecommons.org/licenses/by-sa/3.0/ + + +############################# +# shell used by this Makefile +############################# # -# NOTE: On some systems, the library path does not include the location -# of the X11 libraries. You might need to use a -L/path/to/X11/lib/dir -# in order to compile with these libs. +SHELL= bash + +####################### +# common tool locations +####################### # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -CFLAGS= -ansi -#CFLAGS= -ansi -O -#CFLAGS= -#CFLAGS= -ansi -L/usr/X11R6/lib +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 +# +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside +# +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # @@ -51,124 +443,175 @@ CFLAGS= -ansi # to disable such programs. # CC= cc +#CC=clang MAY_NEED_GCC= gcc -# winners that compile under ANSI C + +############################## +# Special flags for this entry +############################## # -WINNERS= schweikh1 df dloweneil banks dlowe bas2 fanf bas1 tomtorfs dorssel \ - schweikh2 schnitzi chaos schweikh3 -ALT_NAMES= schweikh2.orig banks.orig dlowe.orig df.orig schweikh1.orig \ - chaos_nohalf -DATA_FILES= banks_files chaos_files fanf_files schweikh1_files schweikh3_files - - -all: ${WINNERS} - -schweikh1: schweikh1.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh1.orig: schweikh1.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh1_files: info - -df: df.c - ${CC} ${CFLAGS} $? -o $@ - -df.orig: prog.c - ${CC} ${CFLAGS} $? -o $@ - -prog.c : df.c - ${RM} -f prog.c - ${CP} $? prog.c - -dloweneil: dloweneil.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - -# See note about use of -L/path/to/X11/lib/dir above this rule fails to link +ENTRY= schnitzi +PROG= ${ENTRY} # -banks: banks.c - ${CC} ${CFLAGS} $? -DIT=XK_Page_Up -DDT=XK_Page_Down \ - -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \ - -DCS=XK_Return -Ddt=0.02 -lm -lX11 -o $@ - -# See note about use of -L/path/to/X11/lib/dir above this rule fails to link +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} # -banks.orig: banks.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -DIT=XK_Page_Up -DDT=XK_Page_Down \ - -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \ - -DCS=XK_Return -Ddt=0.02 -lm -lX11 -o $@ +ALT_OBJ= +ALT_TARGET= -banks_files: bb.sc horizon.sc mountains.sc pittsburgh.sc pyramids.sc river.sc -dlowe: dlowe.c - ${CC} ${CFLAGS} $? -o $@ - -dlowe.orig: dlowe.orig.c - ${CC} ${CFLAGS} $? -o $@ - -bas2: bas2.c - ${CC} ${CFLAGS} $? -o $@ - -fanf: fanf.c - ${RM} -f fanftmp1.c fanftmp2.c - ${MAY_NEED_GCC} ${CFLAGS} -E $? > fanftmp1.c - ${MAY_NEED_GCC} ${CFLAGS} -E fanftmp1.c > fanftmp2.c - ${MAY_NEED_GCC} ${CFLAGS} fanftmp2.c ${LDFLAGS} -o $@ - -fanf_files: fanf.lambda - -bas1: bas1.c - ${CC} ${CFLAGS} $? -o $@ - -tomtorfs: tomtorfs.c - ${CC} ${CFLAGS} $? -o $@ - -dorssel: dorssel.c - ${CC} ${CFLAGS} $? -o $@ - -schweikh2: schweikh2.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh2.orig: schweikh2.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh3: schweikh3.c - ${MAY_NEED_GCC} ${CFLAGS} $? -DM0=sizeof -DM1=long -DM2=void \ - -DM3=realloc -DM4=calloc -DM5=free -o $@ - -schweikh3_files: samefile.1 - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} $? -o $@ - -chaos: chaos.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - -# some libcurses do not have halfdelay(). This rule is for those systems +################# +# build the entry +################# # -chaos_nohalf: chaos_nohalf.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - ${CP} -f $@ chaos - -chaos_nohalf.c: chaos.c - ${RM} -f $@ - ${SED} -e 's/halfdelay([^)]*);//' < $? > $@ - -chaos_files: cube.data desk.data ioccc.data pyramid.data xwing.data - -everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES} - -clean: - ${RM} -f *.o a.out core ${WINNERS} - ${RM} -f prog.c fanftmp1.c fanftmp2.c chaos_nohalf.c - -clobber: clean - ${RM} -f ${WINNERS} - ${RM} -f ${ALT_NAMES} - -nuke: clobber +all: data ${TARGET} @${TRUE} -install: all - ${CAT} ${WINNERS} ${ALT_NAMES} > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1998/schweikh1/Makefile b/1998/schweikh1/Makefile index c939c82aa..ead90ebbb 100644 --- a/1998/schweikh1/Makefile +++ b/1998/schweikh1/Makefile @@ -1,43 +1,435 @@ -#!/bin/make -# 1998 makefile +#!/usr/bin/env make # -# Copyright (c) Landon Curt Noll, Jeremy Horn, Peter Seebach -# and Leonid A. Broukhis, 1999. -# 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 the contest judges. +# IOCCC 1998 winning entry - schweikh1 -SHELL=/bin/sh -CAT=cat -CHMOD=chmod -CP=cp -MV=mv -LN=ln -RM=rm -SED=sed -TRUE=true +################################################################################ +# +# 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 +# +################################################################################ -# flags for ANSI compiles +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: # -# 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. +# Creative Commons Attribution-ShareAlike 3.0 Unported License. # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +# See: http://creativecommons.org/licenses/by-sa/3.0/ + + +############################# +# shell used by this Makefile +############################# # -# NOTE: On some systems, the library path does not include the location -# of the X11 libraries. You might need to use a -L/path/to/X11/lib/dir -# in order to compile with these libs. +SHELL= bash + +####################### +# common tool locations +####################### # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -CFLAGS= -ansi -#CFLAGS= -ansi -O -#CFLAGS= -#CFLAGS= -ansi -L/usr/X11R6/lib +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 +# +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside +# +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # @@ -51,124 +443,175 @@ CFLAGS= -ansi # to disable such programs. # CC= cc +#CC=clang MAY_NEED_GCC= gcc -# winners that compile under ANSI C + +############################## +# Special flags for this entry +############################## # -WINNERS= schweikh1 df dloweneil banks dlowe bas2 fanf bas1 tomtorfs dorssel \ - schweikh2 schnitzi chaos schweikh3 -ALT_NAMES= schweikh2.orig banks.orig dlowe.orig df.orig schweikh1.orig \ - chaos_nohalf -DATA_FILES= banks_files chaos_files fanf_files schweikh1_files schweikh3_files - - -all: ${WINNERS} - -schweikh1: schweikh1.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh1.orig: schweikh1.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh1_files: info - -df: df.c - ${CC} ${CFLAGS} $? -o $@ - -df.orig: prog.c - ${CC} ${CFLAGS} $? -o $@ - -prog.c : df.c - ${RM} -f prog.c - ${CP} $? prog.c - -dloweneil: dloweneil.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - -# See note about use of -L/path/to/X11/lib/dir above this rule fails to link +ENTRY= schweikh1 +PROG= ${ENTRY} # -banks: banks.c - ${CC} ${CFLAGS} $? -DIT=XK_Page_Up -DDT=XK_Page_Down \ - -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \ - -DCS=XK_Return -Ddt=0.02 -lm -lX11 -o $@ - -# See note about use of -L/path/to/X11/lib/dir above this rule fails to link +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} # -banks.orig: banks.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -DIT=XK_Page_Up -DDT=XK_Page_Down \ - -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \ - -DCS=XK_Return -Ddt=0.02 -lm -lX11 -o $@ +ALT_OBJ= +ALT_TARGET= -banks_files: bb.sc horizon.sc mountains.sc pittsburgh.sc pyramids.sc river.sc -dlowe: dlowe.c - ${CC} ${CFLAGS} $? -o $@ - -dlowe.orig: dlowe.orig.c - ${CC} ${CFLAGS} $? -o $@ - -bas2: bas2.c - ${CC} ${CFLAGS} $? -o $@ - -fanf: fanf.c - ${RM} -f fanftmp1.c fanftmp2.c - ${MAY_NEED_GCC} ${CFLAGS} -E $? > fanftmp1.c - ${MAY_NEED_GCC} ${CFLAGS} -E fanftmp1.c > fanftmp2.c - ${MAY_NEED_GCC} ${CFLAGS} fanftmp2.c ${LDFLAGS} -o $@ - -fanf_files: fanf.lambda - -bas1: bas1.c - ${CC} ${CFLAGS} $? -o $@ - -tomtorfs: tomtorfs.c - ${CC} ${CFLAGS} $? -o $@ - -dorssel: dorssel.c - ${CC} ${CFLAGS} $? -o $@ - -schweikh2: schweikh2.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh2.orig: schweikh2.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh3: schweikh3.c - ${MAY_NEED_GCC} ${CFLAGS} $? -DM0=sizeof -DM1=long -DM2=void \ - -DM3=realloc -DM4=calloc -DM5=free -o $@ - -schweikh3_files: samefile.1 - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} $? -o $@ - -chaos: chaos.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - -# some libcurses do not have halfdelay(). This rule is for those systems +################# +# build the entry +################# # -chaos_nohalf: chaos_nohalf.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - ${CP} -f $@ chaos - -chaos_nohalf.c: chaos.c - ${RM} -f $@ - ${SED} -e 's/halfdelay([^)]*);//' < $? > $@ - -chaos_files: cube.data desk.data ioccc.data pyramid.data xwing.data - -everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES} - -clean: - ${RM} -f *.o a.out core ${WINNERS} - ${RM} -f prog.c fanftmp1.c fanftmp2.c chaos_nohalf.c - -clobber: clean - ${RM} -f ${WINNERS} - ${RM} -f ${ALT_NAMES} - -nuke: clobber +all: data ${TARGET} @${TRUE} -install: all - ${CAT} ${WINNERS} ${ALT_NAMES} > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1998/schweikh2/Makefile b/1998/schweikh2/Makefile index c939c82aa..91cb74787 100644 --- a/1998/schweikh2/Makefile +++ b/1998/schweikh2/Makefile @@ -1,43 +1,435 @@ -#!/bin/make -# 1998 makefile +#!/usr/bin/env make # -# Copyright (c) Landon Curt Noll, Jeremy Horn, Peter Seebach -# and Leonid A. Broukhis, 1999. -# 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 the contest judges. +# IOCCC 1998 winning entry - schweikh2 -SHELL=/bin/sh -CAT=cat -CHMOD=chmod -CP=cp -MV=mv -LN=ln -RM=rm -SED=sed -TRUE=true +################################################################################ +# +# 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 +# +################################################################################ -# flags for ANSI compiles +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: # -# 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. +# Creative Commons Attribution-ShareAlike 3.0 Unported License. # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +# See: http://creativecommons.org/licenses/by-sa/3.0/ + + +############################# +# shell used by this Makefile +############################# # -# NOTE: On some systems, the library path does not include the location -# of the X11 libraries. You might need to use a -L/path/to/X11/lib/dir -# in order to compile with these libs. +SHELL= bash + +####################### +# common tool locations +####################### # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -CFLAGS= -ansi -#CFLAGS= -ansi -O -#CFLAGS= -#CFLAGS= -ansi -L/usr/X11R6/lib +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 +# +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside +# +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # @@ -51,124 +443,175 @@ CFLAGS= -ansi # to disable such programs. # CC= cc +#CC=clang MAY_NEED_GCC= gcc -# winners that compile under ANSI C + +############################## +# Special flags for this entry +############################## # -WINNERS= schweikh1 df dloweneil banks dlowe bas2 fanf bas1 tomtorfs dorssel \ - schweikh2 schnitzi chaos schweikh3 -ALT_NAMES= schweikh2.orig banks.orig dlowe.orig df.orig schweikh1.orig \ - chaos_nohalf -DATA_FILES= banks_files chaos_files fanf_files schweikh1_files schweikh3_files - - -all: ${WINNERS} - -schweikh1: schweikh1.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh1.orig: schweikh1.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh1_files: info - -df: df.c - ${CC} ${CFLAGS} $? -o $@ - -df.orig: prog.c - ${CC} ${CFLAGS} $? -o $@ - -prog.c : df.c - ${RM} -f prog.c - ${CP} $? prog.c - -dloweneil: dloweneil.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - -# See note about use of -L/path/to/X11/lib/dir above this rule fails to link +ENTRY= schweikh2 +PROG= ${ENTRY} # -banks: banks.c - ${CC} ${CFLAGS} $? -DIT=XK_Page_Up -DDT=XK_Page_Down \ - -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \ - -DCS=XK_Return -Ddt=0.02 -lm -lX11 -o $@ - -# See note about use of -L/path/to/X11/lib/dir above this rule fails to link +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} # -banks.orig: banks.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -DIT=XK_Page_Up -DDT=XK_Page_Down \ - -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \ - -DCS=XK_Return -Ddt=0.02 -lm -lX11 -o $@ +ALT_OBJ= +ALT_TARGET= -banks_files: bb.sc horizon.sc mountains.sc pittsburgh.sc pyramids.sc river.sc -dlowe: dlowe.c - ${CC} ${CFLAGS} $? -o $@ - -dlowe.orig: dlowe.orig.c - ${CC} ${CFLAGS} $? -o $@ - -bas2: bas2.c - ${CC} ${CFLAGS} $? -o $@ - -fanf: fanf.c - ${RM} -f fanftmp1.c fanftmp2.c - ${MAY_NEED_GCC} ${CFLAGS} -E $? > fanftmp1.c - ${MAY_NEED_GCC} ${CFLAGS} -E fanftmp1.c > fanftmp2.c - ${MAY_NEED_GCC} ${CFLAGS} fanftmp2.c ${LDFLAGS} -o $@ - -fanf_files: fanf.lambda - -bas1: bas1.c - ${CC} ${CFLAGS} $? -o $@ - -tomtorfs: tomtorfs.c - ${CC} ${CFLAGS} $? -o $@ - -dorssel: dorssel.c - ${CC} ${CFLAGS} $? -o $@ - -schweikh2: schweikh2.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh2.orig: schweikh2.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh3: schweikh3.c - ${MAY_NEED_GCC} ${CFLAGS} $? -DM0=sizeof -DM1=long -DM2=void \ - -DM3=realloc -DM4=calloc -DM5=free -o $@ - -schweikh3_files: samefile.1 - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} $? -o $@ - -chaos: chaos.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - -# some libcurses do not have halfdelay(). This rule is for those systems +################# +# build the entry +################# # -chaos_nohalf: chaos_nohalf.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - ${CP} -f $@ chaos - -chaos_nohalf.c: chaos.c - ${RM} -f $@ - ${SED} -e 's/halfdelay([^)]*);//' < $? > $@ - -chaos_files: cube.data desk.data ioccc.data pyramid.data xwing.data - -everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES} - -clean: - ${RM} -f *.o a.out core ${WINNERS} - ${RM} -f prog.c fanftmp1.c fanftmp2.c chaos_nohalf.c - -clobber: clean - ${RM} -f ${WINNERS} - ${RM} -f ${ALT_NAMES} - -nuke: clobber +all: data ${TARGET} @${TRUE} -install: all - ${CAT} ${WINNERS} ${ALT_NAMES} > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1998/schweikh3/Makefile b/1998/schweikh3/Makefile index c939c82aa..497eceeaf 100644 --- a/1998/schweikh3/Makefile +++ b/1998/schweikh3/Makefile @@ -1,43 +1,435 @@ -#!/bin/make -# 1998 makefile +#!/usr/bin/env make # -# Copyright (c) Landon Curt Noll, Jeremy Horn, Peter Seebach -# and Leonid A. Broukhis, 1999. -# 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 the contest judges. +# IOCCC 1998 winning entry - schweikh3 -SHELL=/bin/sh -CAT=cat -CHMOD=chmod -CP=cp -MV=mv -LN=ln -RM=rm -SED=sed -TRUE=true +################################################################################ +# +# 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 +# +################################################################################ -# flags for ANSI compiles +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: # -# 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. +# Creative Commons Attribution-ShareAlike 3.0 Unported License. # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +# See: http://creativecommons.org/licenses/by-sa/3.0/ + + +############################# +# shell used by this Makefile +############################# # -# NOTE: On some systems, the library path does not include the location -# of the X11 libraries. You might need to use a -L/path/to/X11/lib/dir -# in order to compile with these libs. +SHELL= bash + +####################### +# common tool locations +####################### # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -CFLAGS= -ansi -#CFLAGS= -ansi -O -#CFLAGS= -#CFLAGS= -ansi -L/usr/X11R6/lib +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 +# +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside +# +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # @@ -51,124 +443,175 @@ CFLAGS= -ansi # to disable such programs. # CC= cc +#CC=clang MAY_NEED_GCC= gcc -# winners that compile under ANSI C + +############################## +# Special flags for this entry +############################## # -WINNERS= schweikh1 df dloweneil banks dlowe bas2 fanf bas1 tomtorfs dorssel \ - schweikh2 schnitzi chaos schweikh3 -ALT_NAMES= schweikh2.orig banks.orig dlowe.orig df.orig schweikh1.orig \ - chaos_nohalf -DATA_FILES= banks_files chaos_files fanf_files schweikh1_files schweikh3_files - - -all: ${WINNERS} - -schweikh1: schweikh1.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh1.orig: schweikh1.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh1_files: info - -df: df.c - ${CC} ${CFLAGS} $? -o $@ - -df.orig: prog.c - ${CC} ${CFLAGS} $? -o $@ - -prog.c : df.c - ${RM} -f prog.c - ${CP} $? prog.c - -dloweneil: dloweneil.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - -# See note about use of -L/path/to/X11/lib/dir above this rule fails to link +ENTRY= schweikh3 +PROG= ${ENTRY} # -banks: banks.c - ${CC} ${CFLAGS} $? -DIT=XK_Page_Up -DDT=XK_Page_Down \ - -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \ - -DCS=XK_Return -Ddt=0.02 -lm -lX11 -o $@ - -# See note about use of -L/path/to/X11/lib/dir above this rule fails to link +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} # -banks.orig: banks.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -DIT=XK_Page_Up -DDT=XK_Page_Down \ - -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \ - -DCS=XK_Return -Ddt=0.02 -lm -lX11 -o $@ +ALT_OBJ= +ALT_TARGET= -banks_files: bb.sc horizon.sc mountains.sc pittsburgh.sc pyramids.sc river.sc -dlowe: dlowe.c - ${CC} ${CFLAGS} $? -o $@ - -dlowe.orig: dlowe.orig.c - ${CC} ${CFLAGS} $? -o $@ - -bas2: bas2.c - ${CC} ${CFLAGS} $? -o $@ - -fanf: fanf.c - ${RM} -f fanftmp1.c fanftmp2.c - ${MAY_NEED_GCC} ${CFLAGS} -E $? > fanftmp1.c - ${MAY_NEED_GCC} ${CFLAGS} -E fanftmp1.c > fanftmp2.c - ${MAY_NEED_GCC} ${CFLAGS} fanftmp2.c ${LDFLAGS} -o $@ - -fanf_files: fanf.lambda - -bas1: bas1.c - ${CC} ${CFLAGS} $? -o $@ - -tomtorfs: tomtorfs.c - ${CC} ${CFLAGS} $? -o $@ - -dorssel: dorssel.c - ${CC} ${CFLAGS} $? -o $@ - -schweikh2: schweikh2.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh2.orig: schweikh2.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh3: schweikh3.c - ${MAY_NEED_GCC} ${CFLAGS} $? -DM0=sizeof -DM1=long -DM2=void \ - -DM3=realloc -DM4=calloc -DM5=free -o $@ - -schweikh3_files: samefile.1 - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} $? -o $@ - -chaos: chaos.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - -# some libcurses do not have halfdelay(). This rule is for those systems +################# +# build the entry +################# # -chaos_nohalf: chaos_nohalf.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - ${CP} -f $@ chaos - -chaos_nohalf.c: chaos.c - ${RM} -f $@ - ${SED} -e 's/halfdelay([^)]*);//' < $? > $@ - -chaos_files: cube.data desk.data ioccc.data pyramid.data xwing.data - -everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES} - -clean: - ${RM} -f *.o a.out core ${WINNERS} - ${RM} -f prog.c fanftmp1.c fanftmp2.c chaos_nohalf.c - -clobber: clean - ${RM} -f ${WINNERS} - ${RM} -f ${ALT_NAMES} - -nuke: clobber +all: data ${TARGET} @${TRUE} -install: all - ${CAT} ${WINNERS} ${ALT_NAMES} > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/1998/tomtorfs/Makefile b/1998/tomtorfs/Makefile index c939c82aa..ffb05b911 100644 --- a/1998/tomtorfs/Makefile +++ b/1998/tomtorfs/Makefile @@ -1,43 +1,435 @@ -#!/bin/make -# 1998 makefile +#!/usr/bin/env make # -# Copyright (c) Landon Curt Noll, Jeremy Horn, Peter Seebach -# and Leonid A. Broukhis, 1999. -# 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 the contest judges. +# IOCCC 1998 winning entry - tomtorfs -SHELL=/bin/sh -CAT=cat -CHMOD=chmod -CP=cp -MV=mv -LN=ln -RM=rm -SED=sed -TRUE=true +################################################################################ +# +# 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 +# +################################################################################ -# flags for ANSI compiles +# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under: # -# 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. +# Creative Commons Attribution-ShareAlike 3.0 Unported License. # -# NOTE: Some compilers cannot optimize, or optimize some entries -# incorrectly. You might want to turn on -O to see if your -# compiler can handle them. +# See: http://creativecommons.org/licenses/by-sa/3.0/ + + +############################# +# shell used by this Makefile +############################# # -# NOTE: On some systems, the library path does not include the location -# of the X11 libraries. You might need to use a -L/path/to/X11/lib/dir -# in order to compile with these libs. +SHELL= bash + +####################### +# common tool locations +####################### # -#CFLAGS=-O -Xa -#CFLAGS=-Xa -CFLAGS= -ansi -#CFLAGS= -ansi -O -#CFLAGS= -#CFLAGS= -ansi -L/usr/X11R6/lib +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 +# +#X11_LIBDIR= /usr/X11R6/lib +#X11_LIBDIR= /usr/X11/lib +X11_LIBDIR= /opt/X11/lib + +# Set X11_INCLUDEDIR to the directory where the X11 include files reside +# +#X11_INCDIR= /usr/X11R6/include +#X11_INCDIR= /usr/X11/include +X11_INCDIR= /opt/X11/include + +# CWARN - Silence warnings that ${CWARN} would normally complain about +# CSILENCE -Compiler warnings +# +ifeq ($(CC),clang) + +# clang CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +else +ifeq ($(CC),gcc) + +# gcc CSILENCE and CWARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +else + +# default CSILENCE and WARN +# +CSILENCE= +#CSILENCE= -Wno-implicit-int +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything ${CSILENCE} +#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} + +endif +endif + +# 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=26 + +# 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 # ANSI compiler # @@ -51,124 +443,175 @@ CFLAGS= -ansi # to disable such programs. # CC= cc +#CC=clang MAY_NEED_GCC= gcc -# winners that compile under ANSI C + +############################## +# Special flags for this entry +############################## # -WINNERS= schweikh1 df dloweneil banks dlowe bas2 fanf bas1 tomtorfs dorssel \ - schweikh2 schnitzi chaos schweikh3 -ALT_NAMES= schweikh2.orig banks.orig dlowe.orig df.orig schweikh1.orig \ - chaos_nohalf -DATA_FILES= banks_files chaos_files fanf_files schweikh1_files schweikh3_files - - -all: ${WINNERS} - -schweikh1: schweikh1.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh1.orig: schweikh1.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh1_files: info - -df: df.c - ${CC} ${CFLAGS} $? -o $@ - -df.orig: prog.c - ${CC} ${CFLAGS} $? -o $@ - -prog.c : df.c - ${RM} -f prog.c - ${CP} $? prog.c - -dloweneil: dloweneil.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - -# See note about use of -L/path/to/X11/lib/dir above this rule fails to link +ENTRY= tomtorfs +PROG= ${ENTRY} # -banks: banks.c - ${CC} ${CFLAGS} $? -DIT=XK_Page_Up -DDT=XK_Page_Down \ - -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \ - -DCS=XK_Return -Ddt=0.02 -lm -lX11 -o $@ - -# See note about use of -L/path/to/X11/lib/dir above this rule fails to link +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} # -banks.orig: banks.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -DIT=XK_Page_Up -DDT=XK_Page_Down \ - -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \ - -DCS=XK_Return -Ddt=0.02 -lm -lX11 -o $@ +ALT_OBJ= +ALT_TARGET= -banks_files: bb.sc horizon.sc mountains.sc pittsburgh.sc pyramids.sc river.sc -dlowe: dlowe.c - ${CC} ${CFLAGS} $? -o $@ - -dlowe.orig: dlowe.orig.c - ${CC} ${CFLAGS} $? -o $@ - -bas2: bas2.c - ${CC} ${CFLAGS} $? -o $@ - -fanf: fanf.c - ${RM} -f fanftmp1.c fanftmp2.c - ${MAY_NEED_GCC} ${CFLAGS} -E $? > fanftmp1.c - ${MAY_NEED_GCC} ${CFLAGS} -E fanftmp1.c > fanftmp2.c - ${MAY_NEED_GCC} ${CFLAGS} fanftmp2.c ${LDFLAGS} -o $@ - -fanf_files: fanf.lambda - -bas1: bas1.c - ${CC} ${CFLAGS} $? -o $@ - -tomtorfs: tomtorfs.c - ${CC} ${CFLAGS} $? -o $@ - -dorssel: dorssel.c - ${CC} ${CFLAGS} $? -o $@ - -schweikh2: schweikh2.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh2.orig: schweikh2.orig.c - ${MAY_NEED_GCC} ${CFLAGS} $? -o $@ - -schweikh3: schweikh3.c - ${MAY_NEED_GCC} ${CFLAGS} $? -DM0=sizeof -DM1=long -DM2=void \ - -DM3=realloc -DM4=calloc -DM5=free -o $@ - -schweikh3_files: samefile.1 - -schnitzi: schnitzi.c - ${CC} ${CFLAGS} $? -o $@ - -chaos: chaos.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - -# some libcurses do not have halfdelay(). This rule is for those systems +################# +# build the entry +################# # -chaos_nohalf: chaos_nohalf.c - ${CC} ${CFLAGS} $? -lcurses -o $@ - ${CP} -f $@ chaos - -chaos_nohalf.c: chaos.c - ${RM} -f $@ - ${SED} -e 's/halfdelay([^)]*);//' < $? > $@ - -chaos_files: cube.data desk.data ioccc.data pyramid.data xwing.data - -everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES} - -clean: - ${RM} -f *.o a.out core ${WINNERS} - ${RM} -f prog.c fanftmp1.c fanftmp2.c chaos_nohalf.c - -clobber: clean - ${RM} -f ${WINNERS} - ${RM} -f ${ALT_NAMES} - -nuke: clobber +all: data ${TARGET} @${TRUE} -install: all - ${CAT} ${WINNERS} ${ALT_NAMES} > /dev/null +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto + +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + +# alternative executable +# +alt: data ${ALT_TARGET} + @${TRUE} + +# data files +# +data: ${DATA} + @${TRUE} + +# both all and alt +# +everything: all alt + + +############### +# utility rules +############### +# +clean: + ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + +clobber: clean + ${RM} -f ${TARGET} ${ALT_TARGET} + @-if [ -e sandwich ]; then \ + ${RM} -f sandwich; \ + echo 'ate sandwich'; \ + fi + +install: + @echo "Dr. Spock says that is not logical!" + @${TRUE} + +# you may be able to misunderstand the source by reading indent.c +# +indent.c: ${PROG}.c + @if which "${GINDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${GINDENT} < $< > $@"; \ + ${GINDENT} < $< > $@; \ + elif which "${INDENT}" >/dev/null 2>&1; then \ + echo ${RM} -f $@; \ + ${RM} -f $@; \ + echo "${INDENT} < $< > $@"; \ + ${INDENT} < $< > $@; \ + else \ + echo "no intent tool found, ident $< yourself, sorry"; \ + echo "exit 1"; \ + exit 1; \ + fi + + +################## +# 133t hacker rulz +################## +# +love: + @echo 'not war?' + @${TRUE} + +haste: + $(MAKE) waste + @${TRUE} + +waste: + @echo 'haste' + @${TRUE} + +maker: + @echo 'Participate in a maker faire' + @${TRUE} + +easter_egg: + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" + +sandwich: easter_egg + @if [ `id -u` -eq 0 ]; then \ + echo 'Okay.'; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ + else \ + echo 'What? Make it yourself.'; \ + exit 1; \ + fi + +# Understand the history of the Homebrew Computer Club +# as well as the West Coast Computer Faire and +# you might be confused different. :-) +# +supernova: sandwich + @-if [ -r .code_anal ]; then \ + ${RM} -f .code_anal_v6; \ + else \ + echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \ + fi + @echo "A $@ helps ${MAKE} the elements that help form planets" + @${TRUE} + +deep_magic: supernova + @-if [ -r .code_anal ]; then \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + sleep 2; \ + echo "Wrong! Do it again!"; \ + fi + @${TRUE} + +magic: deep_magic + @-if [ -r .code_anal ]; then \ + ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ + else \ + echo "If you don't eat yer meat, you can't have any pudding!"; \ + echo "How can you have any pudding if you don't eat yer meat?!"; \ + fi + @${TRUE} + +# The IOCCC resident astronomer states +# +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" + +pluto: charon + ${MAKE} charon + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore, $@ is a planet" + @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" diff --git a/2000/Makefile b/2000/Makefile index 2f6d462f7..f4b9ca767 100644 --- a/2000/Makefile +++ b/2000/Makefile @@ -50,7 +50,7 @@ # tool locations ################ # -SHELL= /bin/bash +SHELL= bash MAKE= make diff --git a/2000/anderson/Makefile b/2000/anderson/Makefile index 25524921d..6ff709d00 100644 --- a/2000/anderson/Makefile +++ b/2000/anderson/Makefile @@ -8,14 +8,14 @@ # entirety and remains unaltered. All other uses must receive prior permission # from the contest judges. -SHELL= /bin/sh +SHELL= bash CAT= cat RM= rm SED= sed TRUE= true #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O. # A few compilers have broken optimizers and thus you may diff --git a/2000/bellard/Makefile b/2000/bellard/Makefile index 25524921d..6ff709d00 100644 --- a/2000/bellard/Makefile +++ b/2000/bellard/Makefile @@ -8,14 +8,14 @@ # entirety and remains unaltered. All other uses must receive prior permission # from the contest judges. -SHELL= /bin/sh +SHELL= bash CAT= cat RM= rm SED= sed TRUE= true #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O. # A few compilers have broken optimizers and thus you may diff --git a/2000/bmeyer/Makefile b/2000/bmeyer/Makefile index 25524921d..6ff709d00 100644 --- a/2000/bmeyer/Makefile +++ b/2000/bmeyer/Makefile @@ -8,14 +8,14 @@ # entirety and remains unaltered. All other uses must receive prior permission # from the contest judges. -SHELL= /bin/sh +SHELL= bash CAT= cat RM= rm SED= sed TRUE= true #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O. # A few compilers have broken optimizers and thus you may diff --git a/2000/briddlebane/Makefile b/2000/briddlebane/Makefile index 25524921d..6ff709d00 100644 --- a/2000/briddlebane/Makefile +++ b/2000/briddlebane/Makefile @@ -8,14 +8,14 @@ # entirety and remains unaltered. All other uses must receive prior permission # from the contest judges. -SHELL= /bin/sh +SHELL= bash CAT= cat RM= rm SED= sed TRUE= true #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O. # A few compilers have broken optimizers and thus you may diff --git a/2000/dhyang/Makefile b/2000/dhyang/Makefile index 25524921d..6ff709d00 100644 --- a/2000/dhyang/Makefile +++ b/2000/dhyang/Makefile @@ -8,14 +8,14 @@ # entirety and remains unaltered. All other uses must receive prior permission # from the contest judges. -SHELL= /bin/sh +SHELL= bash CAT= cat RM= rm SED= sed TRUE= true #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O. # A few compilers have broken optimizers and thus you may diff --git a/2000/dlowe/Makefile b/2000/dlowe/Makefile index 25524921d..6ff709d00 100644 --- a/2000/dlowe/Makefile +++ b/2000/dlowe/Makefile @@ -8,14 +8,14 @@ # entirety and remains unaltered. All other uses must receive prior permission # from the contest judges. -SHELL= /bin/sh +SHELL= bash CAT= cat RM= rm SED= sed TRUE= true #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O. # A few compilers have broken optimizers and thus you may diff --git a/2000/jarijyrki/Makefile b/2000/jarijyrki/Makefile index 25524921d..6ff709d00 100644 --- a/2000/jarijyrki/Makefile +++ b/2000/jarijyrki/Makefile @@ -8,14 +8,14 @@ # entirety and remains unaltered. All other uses must receive prior permission # from the contest judges. -SHELL= /bin/sh +SHELL= bash CAT= cat RM= rm SED= sed TRUE= true #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O. # A few compilers have broken optimizers and thus you may diff --git a/2000/natori/Makefile b/2000/natori/Makefile index 25524921d..6ff709d00 100644 --- a/2000/natori/Makefile +++ b/2000/natori/Makefile @@ -8,14 +8,14 @@ # entirety and remains unaltered. All other uses must receive prior permission # from the contest judges. -SHELL= /bin/sh +SHELL= bash CAT= cat RM= rm SED= sed TRUE= true #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O. # A few compilers have broken optimizers and thus you may diff --git a/2000/primenum/Makefile b/2000/primenum/Makefile index 25524921d..6ff709d00 100644 --- a/2000/primenum/Makefile +++ b/2000/primenum/Makefile @@ -8,14 +8,14 @@ # entirety and remains unaltered. All other uses must receive prior permission # from the contest judges. -SHELL= /bin/sh +SHELL= bash CAT= cat RM= rm SED= sed TRUE= true #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O. # A few compilers have broken optimizers and thus you may diff --git a/2000/rince/Makefile b/2000/rince/Makefile index 25524921d..6ff709d00 100644 --- a/2000/rince/Makefile +++ b/2000/rince/Makefile @@ -8,14 +8,14 @@ # entirety and remains unaltered. All other uses must receive prior permission # from the contest judges. -SHELL= /bin/sh +SHELL= bash CAT= cat RM= rm SED= sed TRUE= true #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O. # A few compilers have broken optimizers and thus you may diff --git a/2000/robison/Makefile b/2000/robison/Makefile index 25524921d..6ff709d00 100644 --- a/2000/robison/Makefile +++ b/2000/robison/Makefile @@ -8,14 +8,14 @@ # entirety and remains unaltered. All other uses must receive prior permission # from the contest judges. -SHELL= /bin/sh +SHELL= bash CAT= cat RM= rm SED= sed TRUE= true #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O. # A few compilers have broken optimizers and thus you may diff --git a/2000/schneiderwent/Makefile b/2000/schneiderwent/Makefile index 25524921d..6ff709d00 100644 --- a/2000/schneiderwent/Makefile +++ b/2000/schneiderwent/Makefile @@ -8,14 +8,14 @@ # entirety and remains unaltered. All other uses must receive prior permission # from the contest judges. -SHELL= /bin/sh +SHELL= bash CAT= cat RM= rm SED= sed TRUE= true #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O. # A few compilers have broken optimizers and thus you may diff --git a/2000/thadgavin/Makefile b/2000/thadgavin/Makefile index 25524921d..6ff709d00 100644 --- a/2000/thadgavin/Makefile +++ b/2000/thadgavin/Makefile @@ -8,14 +8,14 @@ # entirety and remains unaltered. All other uses must receive prior permission # from the contest judges. -SHELL= /bin/sh +SHELL= bash CAT= cat RM= rm SED= sed TRUE= true #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O. # A few compilers have broken optimizers and thus you may diff --git a/2000/tomx/Makefile b/2000/tomx/Makefile index 25524921d..6ff709d00 100644 --- a/2000/tomx/Makefile +++ b/2000/tomx/Makefile @@ -8,14 +8,14 @@ # entirety and remains unaltered. All other uses must receive prior permission # from the contest judges. -SHELL= /bin/sh +SHELL= bash CAT= cat RM= rm SED= sed TRUE= true #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O. # A few compilers have broken optimizers and thus you may diff --git a/2001/Makefile b/2001/Makefile index f1a40acf6..81dd8693a 100644 --- a/2001/Makefile +++ b/2001/Makefile @@ -50,7 +50,7 @@ # tool locations ################ # -SHELL= /bin/bash +SHELL= bash MAKE= make diff --git a/2001/anonymous/Makefile b/2001/anonymous/Makefile index 49e7cf5a9..4e5458226 100644 --- a/2001/anonymous/Makefile +++ b/2001/anonymous/Makefile @@ -45,14 +45,14 @@ # See: http://creativecommons.org/licenses/by-sa/3.0/ -SHELL= /bin/sh +SHELL= bash CAT= cat RM= rm SED= sed TRUE= true #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O. # A few compilers have broken optimizers and thus you may diff --git a/2001/bellard/Makefile b/2001/bellard/Makefile index 49e7cf5a9..4e5458226 100644 --- a/2001/bellard/Makefile +++ b/2001/bellard/Makefile @@ -45,14 +45,14 @@ # See: http://creativecommons.org/licenses/by-sa/3.0/ -SHELL= /bin/sh +SHELL= bash CAT= cat RM= rm SED= sed TRUE= true #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O. # A few compilers have broken optimizers and thus you may diff --git a/2001/cheong/Makefile b/2001/cheong/Makefile index 49e7cf5a9..4e5458226 100644 --- a/2001/cheong/Makefile +++ b/2001/cheong/Makefile @@ -45,14 +45,14 @@ # See: http://creativecommons.org/licenses/by-sa/3.0/ -SHELL= /bin/sh +SHELL= bash CAT= cat RM= rm SED= sed TRUE= true #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O. # A few compilers have broken optimizers and thus you may diff --git a/2001/coupard/Makefile b/2001/coupard/Makefile index 49e7cf5a9..4e5458226 100644 --- a/2001/coupard/Makefile +++ b/2001/coupard/Makefile @@ -45,14 +45,14 @@ # See: http://creativecommons.org/licenses/by-sa/3.0/ -SHELL= /bin/sh +SHELL= bash CAT= cat RM= rm SED= sed TRUE= true #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O. # A few compilers have broken optimizers and thus you may diff --git a/2001/ctk/Makefile b/2001/ctk/Makefile index 49e7cf5a9..4e5458226 100644 --- a/2001/ctk/Makefile +++ b/2001/ctk/Makefile @@ -45,14 +45,14 @@ # See: http://creativecommons.org/licenses/by-sa/3.0/ -SHELL= /bin/sh +SHELL= bash CAT= cat RM= rm SED= sed TRUE= true #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O. # A few compilers have broken optimizers and thus you may diff --git a/2001/dgbeards/Makefile b/2001/dgbeards/Makefile index 49e7cf5a9..4e5458226 100644 --- a/2001/dgbeards/Makefile +++ b/2001/dgbeards/Makefile @@ -45,14 +45,14 @@ # See: http://creativecommons.org/licenses/by-sa/3.0/ -SHELL= /bin/sh +SHELL= bash CAT= cat RM= rm SED= sed TRUE= true #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O. # A few compilers have broken optimizers and thus you may diff --git a/2001/herrmann1/Makefile b/2001/herrmann1/Makefile index 49e7cf5a9..4e5458226 100644 --- a/2001/herrmann1/Makefile +++ b/2001/herrmann1/Makefile @@ -45,14 +45,14 @@ # See: http://creativecommons.org/licenses/by-sa/3.0/ -SHELL= /bin/sh +SHELL= bash CAT= cat RM= rm SED= sed TRUE= true #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O. # A few compilers have broken optimizers and thus you may diff --git a/2001/herrmann2/Makefile b/2001/herrmann2/Makefile index 49e7cf5a9..4e5458226 100644 --- a/2001/herrmann2/Makefile +++ b/2001/herrmann2/Makefile @@ -45,14 +45,14 @@ # See: http://creativecommons.org/licenses/by-sa/3.0/ -SHELL= /bin/sh +SHELL= bash CAT= cat RM= rm SED= sed TRUE= true #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O. # A few compilers have broken optimizers and thus you may diff --git a/2001/jason/Makefile b/2001/jason/Makefile index 49e7cf5a9..4e5458226 100644 --- a/2001/jason/Makefile +++ b/2001/jason/Makefile @@ -45,14 +45,14 @@ # See: http://creativecommons.org/licenses/by-sa/3.0/ -SHELL= /bin/sh +SHELL= bash CAT= cat RM= rm SED= sed TRUE= true #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O. # A few compilers have broken optimizers and thus you may diff --git a/2001/kev/Makefile b/2001/kev/Makefile index 49e7cf5a9..4e5458226 100644 --- a/2001/kev/Makefile +++ b/2001/kev/Makefile @@ -45,14 +45,14 @@ # See: http://creativecommons.org/licenses/by-sa/3.0/ -SHELL= /bin/sh +SHELL= bash CAT= cat RM= rm SED= sed TRUE= true #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O. # A few compilers have broken optimizers and thus you may diff --git a/2001/ollinger/Makefile b/2001/ollinger/Makefile index 49e7cf5a9..4e5458226 100644 --- a/2001/ollinger/Makefile +++ b/2001/ollinger/Makefile @@ -45,14 +45,14 @@ # See: http://creativecommons.org/licenses/by-sa/3.0/ -SHELL= /bin/sh +SHELL= bash CAT= cat RM= rm SED= sed TRUE= true #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O. # A few compilers have broken optimizers and thus you may diff --git a/2001/rosten/Makefile b/2001/rosten/Makefile index 49e7cf5a9..4e5458226 100644 --- a/2001/rosten/Makefile +++ b/2001/rosten/Makefile @@ -45,14 +45,14 @@ # See: http://creativecommons.org/licenses/by-sa/3.0/ -SHELL= /bin/sh +SHELL= bash CAT= cat RM= rm SED= sed TRUE= true #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O. # A few compilers have broken optimizers and thus you may diff --git a/2001/schweikh/Makefile b/2001/schweikh/Makefile index 49e7cf5a9..4e5458226 100644 --- a/2001/schweikh/Makefile +++ b/2001/schweikh/Makefile @@ -45,14 +45,14 @@ # See: http://creativecommons.org/licenses/by-sa/3.0/ -SHELL= /bin/sh +SHELL= bash CAT= cat RM= rm SED= sed TRUE= true #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O. # A few compilers have broken optimizers and thus you may diff --git a/2001/westley/Makefile b/2001/westley/Makefile index 49e7cf5a9..4e5458226 100644 --- a/2001/westley/Makefile +++ b/2001/westley/Makefile @@ -45,14 +45,14 @@ # See: http://creativecommons.org/licenses/by-sa/3.0/ -SHELL= /bin/sh +SHELL= bash CAT= cat RM= rm SED= sed TRUE= true #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O. # A few compilers have broken optimizers and thus you may diff --git a/2001/williams/Makefile b/2001/williams/Makefile index 49e7cf5a9..4e5458226 100644 --- a/2001/williams/Makefile +++ b/2001/williams/Makefile @@ -45,14 +45,14 @@ # See: http://creativecommons.org/licenses/by-sa/3.0/ -SHELL= /bin/sh +SHELL= bash CAT= cat RM= rm SED= sed TRUE= true #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O. # A few compilers have broken optimizers and thus you may diff --git a/2004/Makefile b/2004/Makefile index 69964d36a..d81d5b978 100644 --- a/2004/Makefile +++ b/2004/Makefile @@ -50,7 +50,7 @@ # tool locations ################ # -SHELL= /bin/bash +SHELL= bash MAKE= make diff --git a/2004/anonymous/Makefile b/2004/anonymous/Makefile index 84ef098e4..88591c66d 100644 --- a/2004/anonymous/Makefile +++ b/2004/anonymous/Makefile @@ -11,7 +11,7 @@ # tool locations # -SHELL= /bin/sh +SHELL= bash CP= cp CPP= cpp GUNZIP= gunzip @@ -45,7 +45,7 @@ X11_LIBDIR= /usr/X11R6/lib #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O1 or -O. # A few compilers have broken optimizers and thus you may diff --git a/2004/arachnid/Makefile b/2004/arachnid/Makefile index 84ef098e4..88591c66d 100644 --- a/2004/arachnid/Makefile +++ b/2004/arachnid/Makefile @@ -11,7 +11,7 @@ # tool locations # -SHELL= /bin/sh +SHELL= bash CP= cp CPP= cpp GUNZIP= gunzip @@ -45,7 +45,7 @@ X11_LIBDIR= /usr/X11R6/lib #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O1 or -O. # A few compilers have broken optimizers and thus you may diff --git a/2004/burley/Makefile b/2004/burley/Makefile index 84ef098e4..88591c66d 100644 --- a/2004/burley/Makefile +++ b/2004/burley/Makefile @@ -11,7 +11,7 @@ # tool locations # -SHELL= /bin/sh +SHELL= bash CP= cp CPP= cpp GUNZIP= gunzip @@ -45,7 +45,7 @@ X11_LIBDIR= /usr/X11R6/lib #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O1 or -O. # A few compilers have broken optimizers and thus you may diff --git a/2004/gavare/Makefile b/2004/gavare/Makefile index 84ef098e4..88591c66d 100644 --- a/2004/gavare/Makefile +++ b/2004/gavare/Makefile @@ -11,7 +11,7 @@ # tool locations # -SHELL= /bin/sh +SHELL= bash CP= cp CPP= cpp GUNZIP= gunzip @@ -45,7 +45,7 @@ X11_LIBDIR= /usr/X11R6/lib #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O1 or -O. # A few compilers have broken optimizers and thus you may diff --git a/2004/gavin/Makefile b/2004/gavin/Makefile index 84ef098e4..88591c66d 100644 --- a/2004/gavin/Makefile +++ b/2004/gavin/Makefile @@ -11,7 +11,7 @@ # tool locations # -SHELL= /bin/sh +SHELL= bash CP= cp CPP= cpp GUNZIP= gunzip @@ -45,7 +45,7 @@ X11_LIBDIR= /usr/X11R6/lib #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O1 or -O. # A few compilers have broken optimizers and thus you may diff --git a/2004/hibachi/Makefile b/2004/hibachi/Makefile index 84ef098e4..88591c66d 100644 --- a/2004/hibachi/Makefile +++ b/2004/hibachi/Makefile @@ -11,7 +11,7 @@ # tool locations # -SHELL= /bin/sh +SHELL= bash CP= cp CPP= cpp GUNZIP= gunzip @@ -45,7 +45,7 @@ X11_LIBDIR= /usr/X11R6/lib #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O1 or -O. # A few compilers have broken optimizers and thus you may diff --git a/2004/hoyle/Makefile b/2004/hoyle/Makefile index 84ef098e4..88591c66d 100644 --- a/2004/hoyle/Makefile +++ b/2004/hoyle/Makefile @@ -11,7 +11,7 @@ # tool locations # -SHELL= /bin/sh +SHELL= bash CP= cp CPP= cpp GUNZIP= gunzip @@ -45,7 +45,7 @@ X11_LIBDIR= /usr/X11R6/lib #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O1 or -O. # A few compilers have broken optimizers and thus you may diff --git a/2004/jdalbec/Makefile b/2004/jdalbec/Makefile index 84ef098e4..88591c66d 100644 --- a/2004/jdalbec/Makefile +++ b/2004/jdalbec/Makefile @@ -11,7 +11,7 @@ # tool locations # -SHELL= /bin/sh +SHELL= bash CP= cp CPP= cpp GUNZIP= gunzip @@ -45,7 +45,7 @@ X11_LIBDIR= /usr/X11R6/lib #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O1 or -O. # A few compilers have broken optimizers and thus you may diff --git a/2004/kopczynski/Makefile b/2004/kopczynski/Makefile index 84ef098e4..88591c66d 100644 --- a/2004/kopczynski/Makefile +++ b/2004/kopczynski/Makefile @@ -11,7 +11,7 @@ # tool locations # -SHELL= /bin/sh +SHELL= bash CP= cp CPP= cpp GUNZIP= gunzip @@ -45,7 +45,7 @@ X11_LIBDIR= /usr/X11R6/lib #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O1 or -O. # A few compilers have broken optimizers and thus you may diff --git a/2004/newbern/Makefile b/2004/newbern/Makefile index 84ef098e4..88591c66d 100644 --- a/2004/newbern/Makefile +++ b/2004/newbern/Makefile @@ -11,7 +11,7 @@ # tool locations # -SHELL= /bin/sh +SHELL= bash CP= cp CPP= cpp GUNZIP= gunzip @@ -45,7 +45,7 @@ X11_LIBDIR= /usr/X11R6/lib #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O1 or -O. # A few compilers have broken optimizers and thus you may diff --git a/2004/omoikane/Makefile b/2004/omoikane/Makefile index 84ef098e4..88591c66d 100644 --- a/2004/omoikane/Makefile +++ b/2004/omoikane/Makefile @@ -11,7 +11,7 @@ # tool locations # -SHELL= /bin/sh +SHELL= bash CP= cp CPP= cpp GUNZIP= gunzip @@ -45,7 +45,7 @@ X11_LIBDIR= /usr/X11R6/lib #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O1 or -O. # A few compilers have broken optimizers and thus you may diff --git a/2004/schnitzi/Makefile b/2004/schnitzi/Makefile index 84ef098e4..88591c66d 100644 --- a/2004/schnitzi/Makefile +++ b/2004/schnitzi/Makefile @@ -11,7 +11,7 @@ # tool locations # -SHELL= /bin/sh +SHELL= bash CP= cp CPP= cpp GUNZIP= gunzip @@ -45,7 +45,7 @@ X11_LIBDIR= /usr/X11R6/lib #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O1 or -O. # A few compilers have broken optimizers and thus you may diff --git a/2004/sds/Makefile b/2004/sds/Makefile index 84ef098e4..88591c66d 100644 --- a/2004/sds/Makefile +++ b/2004/sds/Makefile @@ -11,7 +11,7 @@ # tool locations # -SHELL= /bin/sh +SHELL= bash CP= cp CPP= cpp GUNZIP= gunzip @@ -45,7 +45,7 @@ X11_LIBDIR= /usr/X11R6/lib #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O1 or -O. # A few compilers have broken optimizers and thus you may diff --git a/2004/vik1/Makefile b/2004/vik1/Makefile index 84ef098e4..88591c66d 100644 --- a/2004/vik1/Makefile +++ b/2004/vik1/Makefile @@ -11,7 +11,7 @@ # tool locations # -SHELL= /bin/sh +SHELL= bash CP= cp CPP= cpp GUNZIP= gunzip @@ -45,7 +45,7 @@ X11_LIBDIR= /usr/X11R6/lib #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O1 or -O. # A few compilers have broken optimizers and thus you may diff --git a/2004/vik2/Makefile b/2004/vik2/Makefile index 84ef098e4..88591c66d 100644 --- a/2004/vik2/Makefile +++ b/2004/vik2/Makefile @@ -11,7 +11,7 @@ # tool locations # -SHELL= /bin/sh +SHELL= bash CP= cp CPP= cpp GUNZIP= gunzip @@ -45,7 +45,7 @@ X11_LIBDIR= /usr/X11R6/lib #CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O1 or -O. # A few compilers have broken optimizers and thus you may diff --git a/2005/Makefile b/2005/Makefile index 56e789e1a..3a8556bfd 100644 --- a/2005/Makefile +++ b/2005/Makefile @@ -11,7 +11,7 @@ # tool locations # -SHELL= /bin/sh +SHELL= bash CP= cp CPP= cpp GUNZIP= gunzip @@ -31,7 +31,7 @@ X11_LIBDIR= /usr/X11R6/lib # X11_INCLUDEDIR= /usr/X11R6/include -# optimization +# Optimization # # Most compiles will safely use -O2. Some can use only -O1 or -O. # A few compilers have broken optimizers and thus you may diff --git a/2006/Makefile b/2006/Makefile index 0a6e2679e..d5ad3e1c9 100644 --- a/2006/Makefile +++ b/2006/Makefile @@ -10,7 +10,7 @@ # tool locations # -SHELL= /bin/sh +SHELL= bash CP= cp CPP= cpp GUNZIP= gunzip @@ -31,7 +31,7 @@ X11_LIBDIR= /usr/X11R6/lib X11_INCDIR= /usr/X11R6/include -# optimization +# Optimization # # Most compiles will safely use -O3. Some can use only -O2 or -O1 or -O. # A few compilers have broken optimizers and thus you may diff --git a/2011/Makefile b/2011/Makefile index 724734525..2180caf09 100644 --- a/2011/Makefile +++ b/2011/Makefile @@ -14,7 +14,7 @@ # tool locations ################ # -SHELL= /bin/bash +SHELL= bash CP= cp CPP= cpp GUNZIP= gunzip diff --git a/2011/akari/Makefile b/2011/akari/Makefile index 4beb27453..df5581c03 100644 --- a/2011/akari/Makefile +++ b/2011/akari/Makefile @@ -29,12 +29,12 @@ TRUE= true # CWARN= -Wall -W -pedantic -# compiler standard +# Compiler standard # CSTD= -std=c99 CSTD2= -ansi -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness, # other entries require 64-bitess. @@ -42,7 +42,7 @@ CSTD2= -ansi # ARCH= -# optimization +# 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 diff --git a/2011/blakely/Makefile b/2011/blakely/Makefile index 0288d8eb3..6003bcd01 100644 --- a/2011/blakely/Makefile +++ b/2011/blakely/Makefile @@ -23,7 +23,7 @@ SED= sed TAR= tar TRUE= true -# optimization +# 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 diff --git a/2011/borsanyi/Makefile b/2011/borsanyi/Makefile index 7e4fefa56..729b08650 100644 --- a/2011/borsanyi/Makefile +++ b/2011/borsanyi/Makefile @@ -23,7 +23,7 @@ SED= sed TAR= tar TRUE= true -# optimization +# 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 diff --git a/2011/dlowe/Makefile b/2011/dlowe/Makefile index 485aa7a9f..0d3e4d986 100644 --- a/2011/dlowe/Makefile +++ b/2011/dlowe/Makefile @@ -29,11 +29,11 @@ TRUE= true # CWARN= -Wall -W -# compiler standard +# Compiler standard # CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness, # other entries require 64-bitess. @@ -41,7 +41,7 @@ CSTD= -std=c99 # ARCH= -# optimization +# 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 diff --git a/2011/eastman/Makefile b/2011/eastman/Makefile index c8a1242f9..330a76273 100644 --- a/2011/eastman/Makefile +++ b/2011/eastman/Makefile @@ -23,7 +23,7 @@ SED= sed TAR= tar TRUE= true -# optimization +# 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 diff --git a/2011/fredriksson/Makefile b/2011/fredriksson/Makefile index 6c7db428f..58adc07b1 100644 --- a/2011/fredriksson/Makefile +++ b/2011/fredriksson/Makefile @@ -23,7 +23,7 @@ SED= sed TAR= tar TRUE= true -# optimization +# 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 diff --git a/2011/goren/Makefile b/2011/goren/Makefile index 06a6f3e2a..80e8935b7 100644 --- a/2011/goren/Makefile +++ b/2011/goren/Makefile @@ -29,11 +29,11 @@ TRUE= true # CWARN= -# compiler standard +# Compiler standard # CSTD= -ansi -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness, # other entries require 64-bitess. @@ -52,7 +52,7 @@ else ARCH= endif -# optimization +# 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 diff --git a/2011/hamaji/Makefile b/2011/hamaji/Makefile index 634f939bd..8df412612 100644 --- a/2011/hamaji/Makefile +++ b/2011/hamaji/Makefile @@ -29,11 +29,11 @@ TRUE= true # CWARN= -Wall -W -# compiler standard +# Compiler standard # CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness, # other entries require 64-bitess. @@ -41,7 +41,7 @@ CSTD= -std=c99 # ARCH= -# optimization +# 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 diff --git a/2011/hou/Makefile b/2011/hou/Makefile index dc122f5c1..36af73f6e 100644 --- a/2011/hou/Makefile +++ b/2011/hou/Makefile @@ -23,7 +23,7 @@ SED= sed TAR= tar TRUE= true -# optimization +# 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 diff --git a/2011/konno/Makefile b/2011/konno/Makefile index e6b9ad1fd..4babec4c7 100644 --- a/2011/konno/Makefile +++ b/2011/konno/Makefile @@ -29,11 +29,11 @@ TRUE= true # CWARN= -Wall -W -# compiler standard +# Compiler standard # CSTD= -ansi -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness, # other entries require 64-bitess. @@ -41,7 +41,7 @@ CSTD= -ansi # ARCH= -# optimization +# 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 diff --git a/2011/richards/Makefile b/2011/richards/Makefile index e0119c054..4feaaac1d 100644 --- a/2011/richards/Makefile +++ b/2011/richards/Makefile @@ -23,7 +23,7 @@ SED= sed TAR= tar TRUE= true -# optimization +# 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 diff --git a/2011/toledo/Makefile b/2011/toledo/Makefile index aa683b755..a35d50577 100644 --- a/2011/toledo/Makefile +++ b/2011/toledo/Makefile @@ -31,7 +31,7 @@ X11_LIBDIR= /usr/X11R6/lib # X11_INCDIR= /usr/X11R6/include -# optimization +# 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 diff --git a/2011/vik/Makefile b/2011/vik/Makefile index 590383e84..61b657726 100644 --- a/2011/vik/Makefile +++ b/2011/vik/Makefile @@ -23,7 +23,7 @@ SED= sed TAR= tar TRUE= true -# optimization +# 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 diff --git a/2011/zucker/Makefile b/2011/zucker/Makefile index d30ac2418..5ac52ede9 100644 --- a/2011/zucker/Makefile +++ b/2011/zucker/Makefile @@ -23,7 +23,7 @@ SED= sed TAR= tar TRUE= true -# optimization +# 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 diff --git a/2012/Makefile b/2012/Makefile index 279365de3..b96108de0 100644 --- a/2012/Makefile +++ b/2012/Makefile @@ -14,7 +14,7 @@ # tool locations ################ # -SHELL= /bin/bash +SHELL= bash CP= cp CPP= cpp GUNZIP= gunzip diff --git a/2012/blakely/Makefile b/2012/blakely/Makefile index dea22c76c..dbf04de7f 100644 --- a/2012/blakely/Makefile +++ b/2012/blakely/Makefile @@ -39,13 +39,13 @@ X11_INCDIR= /usr/X11R6/include #CWARN= -Wall -W CWARN= -Wall -W -pedantic -Wno-unused-parameter -# compiler standard +# Compiler standard # #CSTD= CSTD= -ansi #CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -57,7 +57,7 @@ CSTD= -ansi # ARCH= -# optimization +# 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 diff --git a/2012/deckmyn/Makefile b/2012/deckmyn/Makefile index 6ee3a28aa..b84e68efc 100644 --- a/2012/deckmyn/Makefile +++ b/2012/deckmyn/Makefile @@ -39,13 +39,13 @@ X11_INCDIR= /usr/X11R6/include CWARN= -Wall -W #CWARN= -Wall -W -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -57,7 +57,7 @@ CSTD= -std=c99 # ARCH= -# optimization +# 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 diff --git a/2012/dlowe/Makefile b/2012/dlowe/Makefile index 9586f32ac..531a9c9f5 100644 --- a/2012/dlowe/Makefile +++ b/2012/dlowe/Makefile @@ -39,13 +39,13 @@ X11_INCDIR= /usr/X11R6/include CWARN= -Wall -W #CWARN= -Wall -W -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -57,7 +57,7 @@ CSTD= -std=c99 # ARCH= -# optimization +# 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 diff --git a/2012/endoh1/Makefile b/2012/endoh1/Makefile index 9e3a9eed8..25df4593d 100644 --- a/2012/endoh1/Makefile +++ b/2012/endoh1/Makefile @@ -39,13 +39,13 @@ X11_INCDIR= /usr/X11R6/include #CWARN= -Wall -W CWARN= -Wall -W -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -57,7 +57,7 @@ CSTD= -std=c99 # ARCH= -# optimization +# 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 diff --git a/2012/endoh2/Makefile b/2012/endoh2/Makefile index 18af5f651..674bc15a8 100644 --- a/2012/endoh2/Makefile +++ b/2012/endoh2/Makefile @@ -39,13 +39,13 @@ X11_INCDIR= /usr/X11R6/include #CWARN= -Wall -W CWARN= -Wall -W -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -57,7 +57,7 @@ CSTD= -std=c99 # ARCH= -# optimization +# 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 diff --git a/2012/grothe/Makefile b/2012/grothe/Makefile index d01f60606..16417fe42 100644 --- a/2012/grothe/Makefile +++ b/2012/grothe/Makefile @@ -39,13 +39,13 @@ X11_INCDIR= /usr/X11R6/include CWARN= -Wall -W #CWARN= -Wall -W -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -57,7 +57,7 @@ CSTD= -std=c99 # ARCH= -# optimization +# 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 diff --git a/2012/hamano/Makefile b/2012/hamano/Makefile index 02f95839c..e46f03b08 100644 --- a/2012/hamano/Makefile +++ b/2012/hamano/Makefile @@ -39,13 +39,13 @@ X11_INCDIR= /usr/X11R6/include CWARN= -Wall -W #CWARN= -Wall -W -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -57,7 +57,7 @@ CSTD= -std=c99 # ARCH= -# optimization +# 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 diff --git a/2012/hou/Makefile b/2012/hou/Makefile index d5f290f35..78f2c057e 100644 --- a/2012/hou/Makefile +++ b/2012/hou/Makefile @@ -39,13 +39,13 @@ CWARN= #CWARN= -Wall -W #CWARN= -Wall -W -pedantic -# compiler standard +# Compiler standard # #CSTD= CSTD= -ansi #CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -57,7 +57,7 @@ CSTD= -ansi # ARCH= -# optimization +# 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 diff --git a/2012/kang/Makefile b/2012/kang/Makefile index 9eda71558..70c6b469f 100644 --- a/2012/kang/Makefile +++ b/2012/kang/Makefile @@ -39,13 +39,13 @@ X11_INCDIR= /usr/X11R6/include CWARN= -Wall -W #CWARN= -Wall -W -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -57,7 +57,7 @@ CSTD= -std=c99 # ARCH= -# optimization +# 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 diff --git a/2012/konno/Makefile b/2012/konno/Makefile index 72fa7c7ff..334a21848 100644 --- a/2012/konno/Makefile +++ b/2012/konno/Makefile @@ -39,13 +39,13 @@ X11_INCDIR= /usr/X11R6/include CWARN= -Wall -W #CWARN= -Wall -W -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -57,7 +57,7 @@ CSTD= -std=c99 # ARCH= -# optimization +# 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 diff --git a/2012/omoikane/Makefile b/2012/omoikane/Makefile index cbf27d424..cc0e15799 100644 --- a/2012/omoikane/Makefile +++ b/2012/omoikane/Makefile @@ -39,13 +39,13 @@ X11_INCDIR= /usr/X11R6/include CWARN= -Wall -W #CWARN= -Wall -W -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -57,7 +57,7 @@ CSTD= -std=c99 # ARCH= -# optimization +# 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 diff --git a/2012/tromp/Makefile b/2012/tromp/Makefile index 1e52debf9..11ade5e25 100644 --- a/2012/tromp/Makefile +++ b/2012/tromp/Makefile @@ -39,13 +39,13 @@ X11_INCDIR= /usr/X11R6/include CWARN= -Wall -W #CWARN= -Wall -W -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -57,7 +57,7 @@ CSTD= -std=c99 # ARCH= -# optimization +# 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 diff --git a/2012/vik/Makefile b/2012/vik/Makefile index e6df7b9aa..7089d4e17 100644 --- a/2012/vik/Makefile +++ b/2012/vik/Makefile @@ -39,13 +39,13 @@ X11_INCDIR= /usr/X11R6/include CWARN= -Wall -W #CWARN= -Wall -W -pedantic -# compiler standard +# Compiler standard # #CSTD= CSTD= -ansi #CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -57,7 +57,7 @@ CSTD= -ansi # ARCH= -# optimization +# 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 diff --git a/2012/zeitak/Makefile b/2012/zeitak/Makefile index 723cccaf3..e6f380bf8 100644 --- a/2012/zeitak/Makefile +++ b/2012/zeitak/Makefile @@ -39,13 +39,13 @@ X11_INCDIR= /usr/X11R6/include CWARN= -Wall -W #CWARN= -Wall -W -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -57,7 +57,7 @@ CSTD= -std=c99 # ARCH= -# optimization +# 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 diff --git a/2013/Makefile b/2013/Makefile index 54116250c..ca975c282 100644 --- a/2013/Makefile +++ b/2013/Makefile @@ -14,7 +14,7 @@ # tool locations ################ # -SHELL= /bin/bash +SHELL= bash CP= cp CPP= cpp GUNZIP= gunzip diff --git a/2013/birken/Makefile b/2013/birken/Makefile index 65753350b..a6ccf9f56 100644 --- a/2013/birken/Makefile +++ b/2013/birken/Makefile @@ -39,13 +39,13 @@ X11_INCDIR= /usr/X11R6/include #CWARN= -Wall -W CWARN= -Wall -pedantic -Wno-newline-eof -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -57,7 +57,7 @@ CSTD= -std=c99 # ARCH= -# optimization +# 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 diff --git a/2013/cable1/Makefile b/2013/cable1/Makefile index ea81d080e..1b93ac852 100644 --- a/2013/cable1/Makefile +++ b/2013/cable1/Makefile @@ -39,13 +39,13 @@ X11_INCDIR= /usr/X11R6/include CWARN= -Wall -W -Wno-implicit-int -Wno-implicit-function-declaration #CWARN= -Wall -W -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -57,7 +57,7 @@ CSTD= -std=c99 # ARCH= -# optimization +# 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 diff --git a/2013/cable2/Makefile b/2013/cable2/Makefile index e94d2dfd5..138a86140 100644 --- a/2013/cable2/Makefile +++ b/2013/cable2/Makefile @@ -42,13 +42,13 @@ CWARN= -Wall -Wno-bitwise-op-parentheses -Wno-unsequenced \ -Wno-implicit-int #CWARN= -Wall -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -60,7 +60,7 @@ CSTD= -std=c99 # ARCH= -# optimization +# 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 diff --git a/2013/cable3/Makefile b/2013/cable3/Makefile index 0c932f8d2..780498b59 100644 --- a/2013/cable3/Makefile +++ b/2013/cable3/Makefile @@ -42,13 +42,13 @@ CWARN= -Wall -Wno-implicit-int -Wno-implicit-function-declaration \ -Wno-incompatible-pointer-types #CWARN= -Wall -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -60,7 +60,7 @@ CSTD= -std=c99 # ARCH= -# optimization +# 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 diff --git a/2013/dlowe/Makefile b/2013/dlowe/Makefile index 5a00000e3..c7e8943c7 100644 --- a/2013/dlowe/Makefile +++ b/2013/dlowe/Makefile @@ -40,13 +40,13 @@ X11_INCDIR= /usr/X11R6/include CWARN= -Wall -Wno-implicit-int #CWARN= -Wall -W -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -58,7 +58,7 @@ CSTD= -std=c99 # ARCH= -# optimization +# 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 diff --git a/2013/endoh1/Makefile b/2013/endoh1/Makefile index 767fbbcb7..621cdda01 100644 --- a/2013/endoh1/Makefile +++ b/2013/endoh1/Makefile @@ -39,13 +39,13 @@ X11_INCDIR= /usr/X11R6/include CWARN= -Wall -W #CWARN= -Wall -W -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -57,7 +57,7 @@ CSTD= -std=c99 # ARCH= -# optimization +# 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 diff --git a/2013/endoh2/Makefile b/2013/endoh2/Makefile index 3396488e0..69a30c06f 100644 --- a/2013/endoh2/Makefile +++ b/2013/endoh2/Makefile @@ -39,13 +39,13 @@ X11_INCDIR= /usr/X11R6/include CWARN= -Wall -W -Wno-empty-body #CWARN= -Wall -W -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -57,7 +57,7 @@ CSTD= -std=c99 # ARCH= -# optimization +# 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 diff --git a/2013/endoh3/Makefile b/2013/endoh3/Makefile index 43c72d420..0b59ffd32 100644 --- a/2013/endoh3/Makefile +++ b/2013/endoh3/Makefile @@ -39,13 +39,13 @@ X11_INCDIR= /usr/X11R6/include CWARN= -Wall -Wno-implicit-int -Wno-main -Wno-implicit-function-declaration #CWARN= -Wall -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -57,7 +57,7 @@ CSTD= -std=c99 # ARCH= -# optimization +# 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 diff --git a/2013/endoh4/Makefile b/2013/endoh4/Makefile index 4af07a573..82fe0d2a3 100644 --- a/2013/endoh4/Makefile +++ b/2013/endoh4/Makefile @@ -39,13 +39,13 @@ X11_INCDIR= /usr/X11R6/include CWARN= -Wall #CWARN= -Wall -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -57,7 +57,7 @@ CSTD= -std=c99 # ARCH= -# optimization +# 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 diff --git a/2013/hou/Makefile b/2013/hou/Makefile index f9e23438e..782102482 100644 --- a/2013/hou/Makefile +++ b/2013/hou/Makefile @@ -39,13 +39,13 @@ X11_INCDIR= /usr/X11R6/include CWARN= -Wall #CWARN= -Wall -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -57,7 +57,7 @@ CSTD= -std=c99 # ARCH= -# optimization +# 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 diff --git a/2013/mills/Makefile b/2013/mills/Makefile index 029e3f493..19d4add75 100644 --- a/2013/mills/Makefile +++ b/2013/mills/Makefile @@ -39,13 +39,13 @@ X11_INCDIR= /usr/X11R6/include CWARN= -Wall #CWARN= -Wall -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -57,7 +57,7 @@ CSTD= -std=c99 # ARCH= -# optimization +# 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 diff --git a/2013/misaka/Makefile b/2013/misaka/Makefile index 01711cc46..10429a6ed 100644 --- a/2013/misaka/Makefile +++ b/2013/misaka/Makefile @@ -40,13 +40,13 @@ X11_INCDIR= /usr/X11R6/include CWARN= -Wall -W -Wno-comment -Wno-empty-body #CWARN= -Wall -W -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -58,7 +58,7 @@ CSTD= -std=c99 # ARCH= -# optimization +# 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 diff --git a/2013/morgan1/Makefile b/2013/morgan1/Makefile index af794a76a..bd9b681d7 100644 --- a/2013/morgan1/Makefile +++ b/2013/morgan1/Makefile @@ -40,13 +40,13 @@ CWARN= -Wall -W -Wall -Wextra -Wshadow -Wno-logical-op-parentheses \ -Wno-shift-op-parentheses #CWARN= -Wall -W -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -58,7 +58,7 @@ CSTD= -std=c99 # ARCH= -# optimization +# 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 diff --git a/2013/morgan2/Makefile b/2013/morgan2/Makefile index 3627728f7..5e7efad59 100644 --- a/2013/morgan2/Makefile +++ b/2013/morgan2/Makefile @@ -40,13 +40,13 @@ X11_INCDIR= /usr/X11R6/include CWARN= -Wall -Wextra -Wshadow -pedantic \ -Wno-variadic-macros -Wno-string-plus-int -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -58,7 +58,7 @@ CSTD= -std=c99 # ARCH= -# optimization +# 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 diff --git a/2013/robison/Makefile b/2013/robison/Makefile index f7f898fd6..185ff3ba1 100644 --- a/2013/robison/Makefile +++ b/2013/robison/Makefile @@ -39,13 +39,13 @@ X11_INCDIR= /usr/X11R6/include CWARN= -Wall -W -Wno-unused-variable -Wno-parentheses -Wno-unused-value -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 #CWARN= -Wall -W -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -57,7 +57,7 @@ CSTD= -std=c99 # ARCH= -# optimization +# 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 diff --git a/2014/Makefile b/2014/Makefile index d5d3ebbfb..dd5383200 100644 --- a/2014/Makefile +++ b/2014/Makefile @@ -14,7 +14,7 @@ # tool locations ################ # -SHELL= /bin/bash +SHELL= bash CP= cp CPP= cpp GUNZIP= gunzip diff --git a/2014/birken/Makefile b/2014/birken/Makefile index 238fbc9ef..bd5fb6a67 100644 --- a/2014/birken/Makefile +++ b/2014/birken/Makefile @@ -39,13 +39,13 @@ X11_INCDIR= /usr/X11R6/include CWARN= -Wall #CWARN= -Wall -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -57,7 +57,7 @@ CSTD= -std=c99 # ARCH= -# optimization +# 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 diff --git a/2014/deak/Makefile b/2014/deak/Makefile index a3e36426d..31592f5e8 100644 --- a/2014/deak/Makefile +++ b/2014/deak/Makefile @@ -39,13 +39,13 @@ X11_INCDIR= /usr/X11R6/include CWARN= -Wall #CWARN= -Wall -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -57,7 +57,7 @@ CSTD= -std=c11 # ARCH= -# optimization +# 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 diff --git a/2014/endoh1/Makefile b/2014/endoh1/Makefile index 33f3a0c45..2b9fed886 100644 --- a/2014/endoh1/Makefile +++ b/2014/endoh1/Makefile @@ -39,13 +39,13 @@ X11_INCDIR= /usr/X11R6/include CWARN= -Wall #CWARN= -Wall -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -57,7 +57,7 @@ CSTD= -std=c11 # ARCH= -# optimization +# 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 diff --git a/2014/endoh2/Makefile b/2014/endoh2/Makefile index c10104156..678da9c4f 100644 --- a/2014/endoh2/Makefile +++ b/2014/endoh2/Makefile @@ -39,13 +39,13 @@ X11_INCDIR= /usr/X11R6/include CWARN= -Wall #CWARN= -Wall -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -57,7 +57,7 @@ CSTD= -std=c11 # ARCH= -# optimization +# 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 diff --git a/2014/maffiodo1/Makefile b/2014/maffiodo1/Makefile index c469e76a4..6b9b46fde 100644 --- a/2014/maffiodo1/Makefile +++ b/2014/maffiodo1/Makefile @@ -47,13 +47,13 @@ SDL_INCDIR= $(shell sdl-config --cflags) CWARN= -Wall #CWARN= -Wall -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -65,7 +65,7 @@ CSTD= -std=c11 # ARCH= -# optimization +# 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 diff --git a/2014/maffiodo2/Makefile b/2014/maffiodo2/Makefile index 9544337ab..d2650aeb0 100644 --- a/2014/maffiodo2/Makefile +++ b/2014/maffiodo2/Makefile @@ -39,13 +39,13 @@ X11_INCDIR= /usr/X11R6/include CWARN= -Wall #CWARN= -Wall -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -57,7 +57,7 @@ CSTD= -std=c11 # ARCH= -# optimization +# 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 diff --git a/2014/morgan/Makefile b/2014/morgan/Makefile index 35c5f5ce2..825cdfb21 100644 --- a/2014/morgan/Makefile +++ b/2014/morgan/Makefile @@ -40,13 +40,13 @@ X11_INCDIR= /usr/X11R6/include #CWARN= -Wall -pedantic CWARM= -Wall -Wextra -pedantic -Wshadow -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -58,7 +58,7 @@ CSTD= -std=c99 # ARCH= -# optimization +# 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 diff --git a/2014/sinon/Makefile b/2014/sinon/Makefile index c5d64274a..86a5e2f28 100644 --- a/2014/sinon/Makefile +++ b/2014/sinon/Makefile @@ -40,13 +40,13 @@ X11_INCDIR= /usr/X11R6/include CWARN= -Wall #CWARN= -Wall -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -58,7 +58,7 @@ CSTD= -std=c11 # ARCH= -# optimization +# 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 diff --git a/2014/skeggs/Makefile b/2014/skeggs/Makefile index 564aa9f7d..bb61da51d 100644 --- a/2014/skeggs/Makefile +++ b/2014/skeggs/Makefile @@ -40,13 +40,13 @@ X11_INCDIR= /usr/X11R6/include #CWARN= -Wall -pedantic CWARN= -Wall -Wno-format-extra-args -Wno-parentheses -Wno-return-type -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -58,7 +58,7 @@ CSTD= -std=c11 # ARCH= -# optimization +# 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 diff --git a/2014/vik/Makefile b/2014/vik/Makefile index 2d8472ce5..d2819b759 100644 --- a/2014/vik/Makefile +++ b/2014/vik/Makefile @@ -40,13 +40,13 @@ X11_INCDIR= /usr/X11R6/include CWARN= -Wall -Wno-bitwise-op-parentheses #CWARN= -Wall -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -58,7 +58,7 @@ CSTD= -std=c11 # ARCH= -# optimization +# 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 diff --git a/2014/wiedijk/Makefile b/2014/wiedijk/Makefile index 6b6ea81e2..d111f8e6f 100644 --- a/2014/wiedijk/Makefile +++ b/2014/wiedijk/Makefile @@ -39,13 +39,13 @@ X11_INCDIR= /usr/X11R6/include CWARN= -Wall #CWARN= -Wall -pedantic -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -57,7 +57,7 @@ CSTD= -std=c11 # ARCH= -# optimization +# 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 diff --git a/2015/Makefile b/2015/Makefile index bb2b69b64..f060968b4 100644 --- a/2015/Makefile +++ b/2015/Makefile @@ -14,7 +14,7 @@ # tool locations ################ # -SHELL= /bin/bash +SHELL= bash CP= cp CPP= cpp GUNZIP= gunzip diff --git a/2015/burton/Makefile b/2015/burton/Makefile index faab51e9d..6221c45cc 100644 --- a/2015/burton/Makefile +++ b/2015/burton/Makefile @@ -63,13 +63,13 @@ CSILENCE= -Wno-return-type -Wno-parentheses -Wno-char-subscripts \ -Wno-shadow -Wno-shorten-64-to-32 -Wno-sign-conversion \ -Wno-unused-parameter -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -81,12 +81,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # #CDEFINE= CDEFINE= -DR=return -DI=typedef -DH=unsigned -DX=long -D"W(x)=for(;x;)" -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -94,7 +94,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2015/dogon/Makefile b/2015/dogon/Makefile index d4dd80cfe..0016ae77f 100644 --- a/2015/dogon/Makefile +++ b/2015/dogon/Makefile @@ -65,13 +65,13 @@ CSILENCE= -Wno-implicit-int -Wno-variadic-macros -Wno-absolute-value \ -Wno-reserved-id-macro -Wno-shadow -Wno-shorten-64-to-32 \ -Wno-sign-conversion -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -83,17 +83,17 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # #CDEFINE= CDEFINE= -DW=1024 -Dp=800 -# include files that are needed to compile +# Include files that are needed to compile # #CINCLUDE= CINCLUDE= -I ${X11_INCDIR} -include stdlib.h -# optimization +# 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 diff --git a/2015/duble/Makefile b/2015/duble/Makefile index b84f45fb1..624664d59 100644 --- a/2015/duble/Makefile +++ b/2015/duble/Makefile @@ -62,7 +62,7 @@ CSILENCE= -Wno-parentheses -Wno-unused-value -Wno-return-type \ clang_CSILENCE=-Wno-string-plus-int -Wno-int-conversion -# compiler standard +# Compiler standard # CSTD= -std=c11 \ -D_BSD_SOURCE \ @@ -70,7 +70,7 @@ CSTD= -std=c11 \ # _BSD_SOURCE needed for function usleep() # _XOPEN_SOURCE needed for function lrand48() -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -82,15 +82,15 @@ CSTD= -std=c11 \ # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= -# optimization +# 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 diff --git a/2015/endoh1/Makefile b/2015/endoh1/Makefile index b660d3424..b64f3f783 100644 --- a/2015/endoh1/Makefile +++ b/2015/endoh1/Makefile @@ -60,14 +60,14 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} CSILENCE= -Wno-conversion -Wno-float-conversion -Wno-missing-prototypes \ -Wno-missing-variable-declarations -Wno-shadow -Wno-sign-conversion -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi #CSTD= -std=c11 CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -79,15 +79,15 @@ CSTD= -std=c99 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= -# optimization +# 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 diff --git a/2015/endoh2/Makefile b/2015/endoh2/Makefile index d484977cd..7c6ef85e8 100644 --- a/2015/endoh2/Makefile +++ b/2015/endoh2/Makefile @@ -59,13 +59,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} #CSILENCE= CSILENCE= -Wno-char-subscripts -Wno-format-nonliteral -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -77,16 +77,16 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= -# include files that are needed to compile +# Include files that are needed to compile # #CINCLUDE= CINCLUDE= -include stdio.h -# optimization +# 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 diff --git a/2015/endoh3/Makefile b/2015/endoh3/Makefile index ea4b15a44..224ee2499 100644 --- a/2015/endoh3/Makefile +++ b/2015/endoh3/Makefile @@ -60,13 +60,13 @@ CSILENCE= -Wno-cast-align -Wno-missing-prototypes \ -Wno-missing-variable-declarations -Wno-shorten-64-to-32 \ -Wno-unreachable-code -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -78,15 +78,15 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= -# optimization +# 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 diff --git a/2015/endoh4/Makefile b/2015/endoh4/Makefile index 8d75a1de0..c24369ad1 100644 --- a/2015/endoh4/Makefile +++ b/2015/endoh4/Makefile @@ -60,13 +60,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} CSILENCE= -Wno-implicit-function-declaration -Wno-implicit-int -Wno-main \ -Wno-missing-prototypes -Wno-pedantic -Wno-return-type -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -78,15 +78,15 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= -# optimization +# 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 diff --git a/2015/hou/Makefile b/2015/hou/Makefile index b404d83e4..56bc9d35c 100644 --- a/2015/hou/Makefile +++ b/2015/hou/Makefile @@ -60,13 +60,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} CSILENCE= -Wno-cast-qual -Wno-missing-prototypes \ -Wno-missing-variable-declarations -Wno-shadow -Wno-ignored-qualifiers -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -78,15 +78,15 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= -# optimization +# 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 diff --git a/2015/howe/Makefile b/2015/howe/Makefile index f73fb185f..00bcd394a 100644 --- a/2015/howe/Makefile +++ b/2015/howe/Makefile @@ -27,7 +27,7 @@ # On OpenBSD # /bin/ksh = /bin/pdksh # -SHELL= /bin/sh +SHELL= bash CP= cp CPP= cpp @@ -75,13 +75,13 @@ CSILENCE= -Wno-sign-compare -Wno-missing-prototypes \ -Wno-padded -Wno-shadow \ -Wno-sign-conversion -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -93,15 +93,15 @@ CSTD= -std=c99 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= -# optimization +# 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 diff --git a/2015/mills1/Makefile b/2015/mills1/Makefile index 50709b36e..9eb3a8011 100644 --- a/2015/mills1/Makefile +++ b/2015/mills1/Makefile @@ -60,13 +60,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} CSILENCE= -Wno-parentheses -Wno-implicit-function-declaration \ -Wno-missing-variable-declarations -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -78,7 +78,7 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # #CDEFINE= CDEFINE= -DU=${DU} -DD=${DD} -DW=${DW} -DH=${DH} -DA=${DA} -DI=${DI} \ @@ -118,11 +118,11 @@ DG='"Tap to Flap!"' # Instruction text. # Change to your native tongue. # NOTE: The string MUST be enclosed inside double quotes. -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= -# optimization +# 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 diff --git a/2015/mills2/Makefile b/2015/mills2/Makefile index 1c1375dc0..2e48ded33 100644 --- a/2015/mills2/Makefile +++ b/2015/mills2/Makefile @@ -61,13 +61,13 @@ CSILENCE= -Wno-shift-op-parentheses -Wno-implicit-function-declaration \ -Wno-unused-parameter -Wno-missing-prototypes \ -Wno-missing-variable-declarations -Wno-shadow -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -79,16 +79,16 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= -# include files that are needed to compile +# Include files that are needed to compile # #CINCLUDE= CINCLUDE= -include stdlib.h -# optimization +# 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 diff --git a/2015/muth/Makefile b/2015/muth/Makefile index e048f8dc0..dbb8c513a 100644 --- a/2015/muth/Makefile +++ b/2015/muth/Makefile @@ -60,14 +60,14 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} #CSILENCE= CSILENCE= -Wno-keyword-macro -Wno-unused-macros -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi #CSTD= -std=c11 CSTD= -std=c1x -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -79,17 +79,17 @@ CSTD= -std=c1x # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # #CDEFINE= CDEFINE= -DX="$(X)" -DV="$(V)" -# include files that are needed to compile +# Include files that are needed to compile # #CINCLUDE= CINCLUDE= -include "${MACHINE}" -include "${TAPE}" -# optimization +# 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 diff --git a/2015/schweikhardt/Makefile b/2015/schweikhardt/Makefile index ef652efff..3990781be 100644 --- a/2015/schweikhardt/Makefile +++ b/2015/schweikhardt/Makefile @@ -58,14 +58,14 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} # CSILENCE= -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 #CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -77,16 +77,16 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # #CDEFINE= CDEFINE= -Dtyp=uint64_t -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= -# optimization +# 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 diff --git a/2015/yang/Makefile b/2015/yang/Makefile index 4645c4b0a..34240281f 100644 --- a/2015/yang/Makefile +++ b/2015/yang/Makefile @@ -62,14 +62,14 @@ CSILENCE= # -Wno-missing-variable-declarations -Wno-old-style-cast \ # -Wno-unreachable-code -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi #CSTD= -std=c11 CSTD= -std=c90 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -81,15 +81,15 @@ CSTD= -std=c90 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= -# optimization +# 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 diff --git a/2018/Makefile b/2018/Makefile index def9b018d..ebe0ae292 100644 --- a/2018/Makefile +++ b/2018/Makefile @@ -14,7 +14,7 @@ # tool locations ################ # -SHELL= /bin/bash +SHELL= bash CP= cp CPP= cpp GUNZIP= gunzip diff --git a/2018/algmyr/Makefile b/2018/algmyr/Makefile index 26a1682c2..4e94317e9 100644 --- a/2018/algmyr/Makefile +++ b/2018/algmyr/Makefile @@ -63,13 +63,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} CSILENCE= -Wno-string-plus-int -Wno-empty-body -Wno-unused-result #CSILENCE= -Wno-implicit-int -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -81,12 +81,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC=25 -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -94,7 +94,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2018/anderson/Makefile b/2018/anderson/Makefile index 8ddf8ce1b..97a29a00c 100644 --- a/2018/anderson/Makefile +++ b/2018/anderson/Makefile @@ -63,13 +63,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} CSILENCE= #CSILENCE= -Wno-implicit-int -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -81,12 +81,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC=25 -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -94,7 +94,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2018/bellard/Makefile b/2018/bellard/Makefile index 866e28aa4..d09e9a884 100644 --- a/2018/bellard/Makefile +++ b/2018/bellard/Makefile @@ -64,13 +64,13 @@ CWARN= -Wall -Wextra ${CSILENCE} #CSILENCE= CSILENCE= -Wno-implicit-int -Wno-parentheses -Wno-return-type -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -82,12 +82,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC=25 -# include files that are needed to compile +# Include files that are needed to compile # #CINCLUDE= #CINCLUDE= -include stdlib.h @@ -95,7 +95,7 @@ CINCLUDE= -include stdio.h #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2018/burton1/Makefile b/2018/burton1/Makefile index 8b6a2313e..e6a13c419 100644 --- a/2018/burton1/Makefile +++ b/2018/burton1/Makefile @@ -63,13 +63,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} CSILENCE= #CSILENCE= -Wno-implicit-int -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -81,12 +81,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC=25 -# include files that are needed to compile +# Include files that are needed to compile # #CINCLUDE= #CINCLUDE= -include stdlib.h @@ -94,7 +94,7 @@ CINCLUDE= -include stdio.h #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2018/burton2/Makefile b/2018/burton2/Makefile index 0277e7188..13d49144f 100644 --- a/2018/burton2/Makefile +++ b/2018/burton2/Makefile @@ -64,13 +64,13 @@ CWARN= -Wall -Wextra ${CSILENCE} CSILENCE= -Wno-empty-body -Wno-parentheses -Wno-pointer-sign -Wno-char-subscripts -Wno-trigraphs -Wno-sign-compare #CSILENCE= -Wno-implicit-int -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -82,12 +82,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= -trigraphs -DW=\"keywords\" -DU=$(USAGE) #CDEFINE= -DIOCCC=25 -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -95,7 +95,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2018/ciura/Makefile b/2018/ciura/Makefile index 289dea417..bbd2b3290 100644 --- a/2018/ciura/Makefile +++ b/2018/ciura/Makefile @@ -65,13 +65,13 @@ CSILENCE= -Wno-unused-value -Wno-shift-op-parentheses -Wno-sign-conversion \ -Wno-comma -Wno-missing-prototypes -Wno-unused-result -Wno-parentheses #CSILENCE= -Wno-implicit-int -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -83,12 +83,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC=25 -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -96,7 +96,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2018/endoh1/Makefile b/2018/endoh1/Makefile index e244d6382..3a87a29d0 100644 --- a/2018/endoh1/Makefile +++ b/2018/endoh1/Makefile @@ -63,13 +63,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} CSILENCE= #CSILENCE= -Wno-implicit-int -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -81,12 +81,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC=25 -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -94,7 +94,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2018/endoh2/Makefile b/2018/endoh2/Makefile index c39e05889..4f8b403fd 100644 --- a/2018/endoh2/Makefile +++ b/2018/endoh2/Makefile @@ -64,13 +64,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} CSILENCE= #CSILENCE= -Wno-implicit-int -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -82,12 +82,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC=25 -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -95,7 +95,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2018/ferguson/Makefile b/2018/ferguson/Makefile index cebe39a28..1f4717ab1 100644 --- a/2018/ferguson/Makefile +++ b/2018/ferguson/Makefile @@ -64,14 +64,14 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} CSILENCE= #CSILENCE= -Wno-implicit-int -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 #CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -83,12 +83,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= -DQ='typedef' -D'g(o)'='goto o;' -D'w(x)'="x:" -D'H(main)'='r(main)' #CDEFINE= -DIOCCC=25 -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -96,7 +96,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2018/giles/Makefile b/2018/giles/Makefile index b2867e4f5..9d6ae8497 100644 --- a/2018/giles/Makefile +++ b/2018/giles/Makefile @@ -64,14 +64,14 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} CSILENCE= #CSILENCE= -Wno-implicit-int -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi #CSTD= -std=c11 CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -83,12 +83,12 @@ CSTD= -std=c99 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC=25 -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= $(shell sdl2-config --cflags) #CINCLUDE= -include stdlib.h @@ -96,7 +96,7 @@ CINCLUDE= $(shell sdl2-config --cflags) #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2018/hou/Makefile b/2018/hou/Makefile index ab03c0d85..f935a381d 100644 --- a/2018/hou/Makefile +++ b/2018/hou/Makefile @@ -64,13 +64,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} CSILENCE= #CSILENCE= -Wno-implicit-int -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -82,12 +82,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= -D_DEFAULT_SOURCE #CDEFINE= -DIOCCC=25 -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -95,7 +95,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2018/mills/Makefile b/2018/mills/Makefile index 0e95c6268..a51fdd3a1 100644 --- a/2018/mills/Makefile +++ b/2018/mills/Makefile @@ -64,13 +64,13 @@ CWARN= -Wall ${CSILENCE} CSILENCE= -Wno-unused-result #CSILENCE= -Wno-implicit-int -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -82,12 +82,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC=25 -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -95,7 +95,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2018/poikola/Makefile b/2018/poikola/Makefile index c3d442668..28c1a5856 100644 --- a/2018/poikola/Makefile +++ b/2018/poikola/Makefile @@ -63,14 +63,14 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} CSILENCE= -Wno-dollar-in-identifier-extension -Wno-comment -Wno-unused-parameter #CSILENCE= -Wno-implicit-int -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi #CSTD= -std=c11 CSTD= -std=gnu11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -82,13 +82,13 @@ CSTD= -std=gnu11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # #CDEFINE= CDEFINE= -Dunix=1 #CDEFINE= -DIOCCC=25 -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -96,7 +96,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2018/vokes/Makefile b/2018/vokes/Makefile index bf9e5a4a5..08704b218 100644 --- a/2018/vokes/Makefile +++ b/2018/vokes/Makefile @@ -64,13 +64,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} CSILENCE= -Wno-missing-prototypes #CSILENCE= -Wno-implicit-int -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -82,12 +82,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC=25 -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -95,7 +95,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2018/yang/Makefile b/2018/yang/Makefile index 284d4722d..11822dee6 100644 --- a/2018/yang/Makefile +++ b/2018/yang/Makefile @@ -64,13 +64,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} CSILENCE= #CSILENCE= -Wno-implicit-int -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -82,12 +82,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC=25 -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -95,7 +95,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2019/Makefile b/2019/Makefile index 9d1b53f37..667c7c3bc 100644 --- a/2019/Makefile +++ b/2019/Makefile @@ -13,7 +13,7 @@ # shell used by this Makefile ############################# # -SHELL= /bin/bash +SHELL= bash # Set X11_LIBDIR to the directory where the X11 library resides # diff --git a/2019/adamovsky/Makefile b/2019/adamovsky/Makefile index 0e4a5be1b..38a01b5d5 100644 --- a/2019/adamovsky/Makefile +++ b/2019/adamovsky/Makefile @@ -305,13 +305,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} #CSILENCE= -Wno-implicit-int CSILENCE=-Wno-format -Wno-implicit-function-declaration -Wno-newline-eof -Wno-shift-op-parentheses -Wno-unsequenced -Wno-trigraphs -Wno-comment -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -323,12 +323,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC=26 -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -336,7 +336,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2019/burton/Makefile b/2019/burton/Makefile index 2b2abc0da..4f74a2501 100644 --- a/2019/burton/Makefile +++ b/2019/burton/Makefile @@ -305,13 +305,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} #CSILENCE= -Wno-implicit-int CSILENCE= -Wno-implicit-int -Wno-missing-variable-declarations -Wno-parentheses -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -323,12 +323,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC=26 -# include files that are needed to compile +# Include files that are needed to compile # #CINCLUDE= #CINCLUDE= -include stdlib.h @@ -336,7 +336,7 @@ CINCLUDE= -include stdio.h #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2019/ciura/Makefile b/2019/ciura/Makefile index db91bf1ce..72778ce2b 100644 --- a/2019/ciura/Makefile +++ b/2019/ciura/Makefile @@ -306,13 +306,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} #CSILENCE= -Wno-implicit-int CSILENCE= -Wno-empty-body -Wno-format-nonliteral -Wno-incompatible-pointer-types-discards-qualifiers -Wno-parentheses -Wno-shorten-64-to-32 -Wno-sign-conversion -Wno-string-plus-int -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -324,12 +324,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC=26 -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -337,7 +337,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2019/diels-grabsch1/Makefile b/2019/diels-grabsch1/Makefile index d7773597e..4c3c80d8c 100644 --- a/2019/diels-grabsch1/Makefile +++ b/2019/diels-grabsch1/Makefile @@ -305,13 +305,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} #CSILENCE= -Wno-implicit-int #CSILENCE= -Wextra -Weverything -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -323,12 +323,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC=26 -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -336,7 +336,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2019/diels-grabsch2/Makefile b/2019/diels-grabsch2/Makefile index 708091954..662e72eee 100644 --- a/2019/diels-grabsch2/Makefile +++ b/2019/diels-grabsch2/Makefile @@ -304,13 +304,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} CSILENCE= #CSILENCE= -Wno-implicit-int -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -322,12 +322,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC=26 -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -335,7 +335,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2019/dogon/Makefile b/2019/dogon/Makefile index f69a3b3ec..f3fd3a463 100644 --- a/2019/dogon/Makefile +++ b/2019/dogon/Makefile @@ -306,14 +306,14 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} CSILENCE= -Wno-bitwise-op-parentheses -Wno-format -Wno-parentheses \ -Wno-shift-op-parentheses -Wno-sign-compare -Wno-unused-variable -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi #CSTD= -std=c11 CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -326,13 +326,13 @@ CSTD= -std=c99 #ARCH= ARCH= -march=native -# defines that are needed to compile +# Defines that are needed to compile # #CDEFINE= #CDEFINE= -DIOCCC=26 CDEFINE= -DX=1280l -DY=1024l -DZ=0x20000000 -# include files that are needed to compile +# Include files that are needed to compile # #CINCLUDE= #CINCLUDE= -include stdlib.h @@ -340,7 +340,7 @@ CDEFINE= -DX=1280l -DY=1024l -DZ=0x20000000 #CINCLUDE= -include stdlib.h -include stdio.h CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2019/duble/Makefile b/2019/duble/Makefile index e916ff456..2aced0a3b 100644 --- a/2019/duble/Makefile +++ b/2019/duble/Makefile @@ -309,13 +309,13 @@ CSILENCE=-Wno-incompatible-pointer-types -Wno-return-type -Wno-format-security \ -Wno-dangling-else -Wno-implicit-int -Wno-unused-value -Wno-pedantic \ -Wno-misleading-indentation -Wno-sequence-point -Wno-unknown-warning-option -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -327,12 +327,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC=26 -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -340,7 +340,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2019/endoh/Makefile b/2019/endoh/Makefile index 96d7ced9a..f16324882 100644 --- a/2019/endoh/Makefile +++ b/2019/endoh/Makefile @@ -304,13 +304,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} CSILENCE= #CSILENCE= -Wno-implicit-int -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -322,12 +322,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC=26 -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -335,7 +335,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2019/giles/Makefile b/2019/giles/Makefile index 1c94112b1..8b538b92d 100644 --- a/2019/giles/Makefile +++ b/2019/giles/Makefile @@ -305,14 +305,14 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} #CSILENCE= -Wno-implicit-int CSILENCE= -Wno-empty-body -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi #CSTD= -std=c11 CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -324,12 +324,12 @@ CSTD= -std=c99 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC=26 -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -337,7 +337,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2019/karns/Makefile b/2019/karns/Makefile index e1a127351..f02692527 100644 --- a/2019/karns/Makefile +++ b/2019/karns/Makefile @@ -305,13 +305,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} #CSILENCE= -Wno-implicit-int CSILENCE=-Wno-implicit-function-declaration -Wno-implicit-int -Wno-incompatible-function-pointer-types -Wno-logical-op-parentheses -Wno-sign-compare -Wno-unused-label -Wno-unused-variable -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -323,12 +323,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC=26 -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -336,7 +336,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2019/lynn/Makefile b/2019/lynn/Makefile index ed6a68a10..a0e37d9d2 100644 --- a/2019/lynn/Makefile +++ b/2019/lynn/Makefile @@ -304,14 +304,14 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} CSILENCE= #CSILENCE= -Wno-implicit-int -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi #CSTD= -std=c11 CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -323,12 +323,12 @@ CSTD= -std=c99 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC=26 -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -336,7 +336,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2019/mills/Makefile b/2019/mills/Makefile index d7a7cba6c..9c64b91bb 100644 --- a/2019/mills/Makefile +++ b/2019/mills/Makefile @@ -305,13 +305,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} #CSILENCE= -Wno-implicit-int CSILENCE= -Wno-missing-field-initializers -Wno-for-loop-analysis -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -323,13 +323,13 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # #CDEFINE= #CDEFINE= -DIOCCC=26 CDEFINE= ${param} -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -337,7 +337,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2019/poikola/Makefile b/2019/poikola/Makefile index 8564a35b3..62481adad 100644 --- a/2019/poikola/Makefile +++ b/2019/poikola/Makefile @@ -306,13 +306,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} CSILENCE= -Wno-gnu-label-as-value -Wno-sign-compare -Wno-unsequenced \ -Wno-dollar-in-identifier-extension -Wno-sometimes-uninitialized -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -324,12 +324,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC=26 -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -337,7 +337,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2019/yang/Makefile b/2019/yang/Makefile index 708091954..662e72eee 100644 --- a/2019/yang/Makefile +++ b/2019/yang/Makefile @@ -304,13 +304,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} CSILENCE= #CSILENCE= -Wno-implicit-int -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -322,12 +322,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC=26 -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -335,7 +335,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2020/Makefile b/2020/Makefile index b2efaf9d0..afabb9df9 100644 --- a/2020/Makefile +++ b/2020/Makefile @@ -14,7 +14,7 @@ # tool locations ################ # -SHELL= /bin/bash +SHELL= bash # BUNZIP2= bunzip2 BZIP2= bzip2 diff --git a/2020/burton/Makefile b/2020/burton/Makefile index 346e2a909..0d853343d 100644 --- a/2020/burton/Makefile +++ b/2020/burton/Makefile @@ -337,13 +337,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} endif endif -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -355,12 +355,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC -# include files that are needed to compile +# Include files that are needed to compile # #CINCLUDE= #CINCLUDE= -include stdlib.h @@ -368,7 +368,7 @@ CDEFINE= CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2020/carlini/Makefile b/2020/carlini/Makefile index df3c8c9d9..6e8eec19e 100644 --- a/2020/carlini/Makefile +++ b/2020/carlini/Makefile @@ -341,13 +341,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} endif endif -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -359,12 +359,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -372,7 +372,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2020/endoh1/Makefile b/2020/endoh1/Makefile index a61f7caad..e9fe3d0bc 100644 --- a/2020/endoh1/Makefile +++ b/2020/endoh1/Makefile @@ -341,13 +341,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} endif endif -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -359,12 +359,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -372,7 +372,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2020/endoh2/Makefile b/2020/endoh2/Makefile index cd3a4045a..6e345fb90 100644 --- a/2020/endoh2/Makefile +++ b/2020/endoh2/Makefile @@ -342,14 +342,14 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} endif endif -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi #CSTD= -std=c11 CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -361,12 +361,12 @@ CSTD= -std=c99 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -374,7 +374,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2020/endoh3/Makefile b/2020/endoh3/Makefile index 6c4eb8ac0..b025b38b3 100644 --- a/2020/endoh3/Makefile +++ b/2020/endoh3/Makefile @@ -339,13 +339,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} endif endif -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -357,12 +357,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -370,7 +370,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2020/ferguson1/Makefile b/2020/ferguson1/Makefile index f236752b1..593605047 100644 --- a/2020/ferguson1/Makefile +++ b/2020/ferguson1/Makefile @@ -341,13 +341,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} endif endif -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -359,7 +359,7 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # #CDEFINE= #CDEFINE= -DIOCCC @@ -367,7 +367,7 @@ CDEFINE= -D_XOPEN_SOURCE -D_POSIX_C_SOURCE -D'f(a,b)'='((a)<(b)?(a):(b))' -DWALL -DHEAD='COLOR_RED' -DBODY='COLOR_GREEN' -DWB='COLOR_BLACK' -DHB='COLOR_BLACK' -DBS='COLOR_BLACK' \ -DBG='COLOR_WHITE' -DBB='COLOR_BLACK' -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -375,7 +375,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2020/ferguson2/Makefile b/2020/ferguson2/Makefile index ae91cfdd9..ffa610b23 100644 --- a/2020/ferguson2/Makefile +++ b/2020/ferguson2/Makefile @@ -344,13 +344,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} endif endif -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -362,13 +362,13 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # #CDEFINE= #CDEFINE= -DIOCCC CDEFINE= -D_POSIX_C_SOURCE=200809L -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -376,7 +376,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2020/giles/Makefile b/2020/giles/Makefile index be8a9a1b8..3ce044a14 100644 --- a/2020/giles/Makefile +++ b/2020/giles/Makefile @@ -342,14 +342,14 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} endif endif -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi #CSTD= -std=c11 CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -361,12 +361,12 @@ CSTD= -std=c99 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -374,7 +374,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2020/kurdyukov1/Makefile b/2020/kurdyukov1/Makefile index 0117fbd17..5ff7de692 100644 --- a/2020/kurdyukov1/Makefile +++ b/2020/kurdyukov1/Makefile @@ -338,13 +338,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} endif endif -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -356,12 +356,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -369,7 +369,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2020/kurdyukov2/Makefile b/2020/kurdyukov2/Makefile index 1dadb3989..c6b1b5db8 100644 --- a/2020/kurdyukov2/Makefile +++ b/2020/kurdyukov2/Makefile @@ -340,13 +340,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} endif endif -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -358,12 +358,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -371,7 +371,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2020/kurdyukov3/Makefile b/2020/kurdyukov3/Makefile index 659bc9e68..479541fac 100644 --- a/2020/kurdyukov3/Makefile +++ b/2020/kurdyukov3/Makefile @@ -338,13 +338,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} endif endif -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -356,12 +356,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -369,7 +369,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2020/kurdyukov4/Makefile b/2020/kurdyukov4/Makefile index 52d31d8f4..d4a69753e 100644 --- a/2020/kurdyukov4/Makefile +++ b/2020/kurdyukov4/Makefile @@ -339,13 +339,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} endif endif -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -357,12 +357,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -370,7 +370,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2020/otterness/Makefile b/2020/otterness/Makefile index a3f33a233..4d9ac77ad 100644 --- a/2020/otterness/Makefile +++ b/2020/otterness/Makefile @@ -340,14 +340,14 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} endif endif -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi #CSTD= -std=c11 CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -359,12 +359,12 @@ CSTD= -std=c99 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -372,7 +372,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2020/tsoj/Makefile b/2020/tsoj/Makefile index ff1da962b..da727a751 100644 --- a/2020/tsoj/Makefile +++ b/2020/tsoj/Makefile @@ -344,14 +344,14 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} endif endif -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi #CSTD= -std=c11 CSTD= -std=c99 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -363,12 +363,12 @@ CSTD= -std=c99 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -376,7 +376,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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 diff --git a/2020/yang/Makefile b/2020/yang/Makefile index 6e1c7392e..131226a14 100644 --- a/2020/yang/Makefile +++ b/2020/yang/Makefile @@ -340,13 +340,13 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} endif endif -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -358,12 +358,12 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -371,7 +371,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# optimization +# 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