fix 1998 Makefiles
This commit is contained in:
1 parent
4ea61e331b
commit
37b80374df
42 files changed
+4560
-2330
No files matched your search
+10
-5
@@ -46,12 +46,17 @@
|
||||
# See: http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
|
||||
################
|
||||
# tool locations
|
||||
################
|
||||
#############################
|
||||
# shell used by this Makefile
|
||||
#############################
|
||||
#
|
||||
SHELL= /bin/bash
|
||||
MAKE= make
|
||||
SHELL= bash
|
||||
|
||||
#######################
|
||||
# common tool locations
|
||||
#######################
|
||||
#
|
||||
include ../var.mk
|
||||
|
||||
|
||||
###############
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
banks
|
||||
banks.alt
|
||||
+320
-151
@@ -1,174 +1,343 @@
|
||||
#!/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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#CFLAGS=-O -Xa
|
||||
#CFLAGS=-Xa
|
||||
CFLAGS= -ansi
|
||||
#CFLAGS= -ansi -O
|
||||
#CFLAGS=
|
||||
#CFLAGS= -ansi -L/usr/X11R6/lib
|
||||
# See: http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
# ANSI compiler
|
||||
|
||||
#############################
|
||||
# shell used by this Makefile
|
||||
#############################
|
||||
#
|
||||
# Set CC to the name of your ANSI compiler.
|
||||
SHELL= bash
|
||||
|
||||
#######################
|
||||
# common tool locations
|
||||
#######################
|
||||
#
|
||||
# Some entries seem to need gcc. If you have gcc, set
|
||||
# both CC and MAY_NEED_GCC to gcc.
|
||||
include ../../var.mk
|
||||
|
||||
# Set X11_LIBDIR to the directory where the X11 library resides
|
||||
#
|
||||
# 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.
|
||||
#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-unsequenced -Wno-incompatible-pointer-types
|
||||
|
||||
# Common C compiler warning flags
|
||||
#
|
||||
#CWARN= ${CSILENCE}
|
||||
#CWARN= -Wall ${CSILENCE}
|
||||
#CWARN= -Wall -Wextra ${CSILENCE}
|
||||
CWARN= -Wall -Wextra -pedantic ${CSILENCE}
|
||||
|
||||
# Compiler standard
|
||||
#
|
||||
#CSTD=
|
||||
#CSTD= -ansi
|
||||
CSTD= -std=gnu90
|
||||
|
||||
# Compiler bit architecture
|
||||
#
|
||||
# Some entries require 32-bitness:
|
||||
# ARCH= -m32
|
||||
#
|
||||
# Some entries require 64-bitness:
|
||||
# ARCH= -m64
|
||||
#
|
||||
# By default we assume nothing:
|
||||
#
|
||||
ARCH=
|
||||
|
||||
# Defines that are needed to compile
|
||||
#
|
||||
#CDEFINE=
|
||||
CDEFINE= -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
|
||||
|
||||
# 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
|
||||
MAY_NEED_GCC= gcc
|
||||
#CC=clang
|
||||
#CC=gcc
|
||||
|
||||
# winners that compile under ANSI C
|
||||
# Compiler add-ons or replacements for clang only
|
||||
#
|
||||
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
|
||||
ifeq ($(CC),clang)
|
||||
#
|
||||
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
|
||||
CSILENCE+= -Wno-comma -Wno-float-conversion -Wno-float-equal \
|
||||
-Wno-missing-variable-declarations -Wno-poison-system-directories \
|
||||
-Wno-shadow -Wno-shorten-64-to-32
|
||||
#
|
||||
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 $@
|
||||
|
||||
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
|
||||
CWARN+= -Weverything
|
||||
#
|
||||
chaos_nohalf: chaos_nohalf.c
|
||||
${CC} ${CFLAGS} $? -lcurses -o $@
|
||||
${CP} -f $@ chaos
|
||||
endif
|
||||
|
||||
chaos_nohalf.c: chaos.c
|
||||
${RM} -f $@
|
||||
${SED} -e 's/halfdelay([^)]*);//' < $? > $@
|
||||
# Specific add-ons or replacements for gcc only
|
||||
#
|
||||
ifeq ($(CC),gcc)
|
||||
#
|
||||
#CSILENCE+=
|
||||
#
|
||||
#CWARN+=
|
||||
#
|
||||
endif
|
||||
|
||||
chaos_files: cube.data desk.data ioccc.data pyramid.data xwing.data
|
||||
|
||||
everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES}
|
||||
##############################
|
||||
# Special flags for this entry
|
||||
##############################
|
||||
#
|
||||
ENTRY= banks
|
||||
PROG= ${ENTRY}
|
||||
#
|
||||
OBJ= ${PROG}.o
|
||||
DATA= bb.sc horizon.sc mountains.sc pittsburgh.sc pyramids.sc river.sc
|
||||
TARGET= ${PROG} ${PROG}.alt
|
||||
#
|
||||
ALT_OBJ= ${PROG}.alt.o
|
||||
ALT_TARGET= ${PROG}.alt
|
||||
|
||||
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
|
||||
#################
|
||||
# build the entry
|
||||
#################
|
||||
#
|
||||
all: data ${TARGET}
|
||||
@${TRUE}
|
||||
|
||||
install: all
|
||||
${CAT} ${WINNERS} ${ALT_NAMES} > /dev/null
|
||||
.PHONY: all alt data everything clean clobber install \
|
||||
love haste waste maker easter_egg sandwich \
|
||||
supernova deep_magic magic charon pluto
|
||||
|
||||
${PROG}: ${PROG}.c
|
||||
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
||||
|
||||
${PROG}.alt: ${PROG}.alt.c
|
||||
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
||||
|
||||
# alternative executable
|
||||
#
|
||||
alt: data ${ALT_TARGET}
|
||||
@${TRUE}
|
||||
|
||||
# data files
|
||||
#
|
||||
data: ${DATA}
|
||||
@${TRUE}
|
||||
|
||||
# both all and alt
|
||||
#
|
||||
everything: all alt
|
||||
|
||||
|
||||
###############
|
||||
# utility rules
|
||||
###############
|
||||
#
|
||||
clean:
|
||||
${RM} -f ${OBJ} ${ALT_OBJ}
|
||||
@-if [ -f indent.c ]; then \
|
||||
echo ${RM} -f indent.c; \
|
||||
${RM} -f indent.c; \
|
||||
fi
|
||||
|
||||
clobber: clean
|
||||
${RM} -f ${TARGET} ${ALT_TARGET}
|
||||
@-if [ -e sandwich ]; then \
|
||||
${RM} -f sandwich; \
|
||||
echo 'ate sandwich'; \
|
||||
fi
|
||||
|
||||
install:
|
||||
@echo "Dr. Spock says that is not logical!"
|
||||
@${TRUE}
|
||||
|
||||
# you may be able to misunderstand the source by reading indent.c
|
||||
#
|
||||
indent.c: ${PROG}.c
|
||||
@if which "${GINDENT}" >/dev/null 2>&1; then \
|
||||
echo ${RM} -f $@; \
|
||||
${RM} -f $@; \
|
||||
echo "${GINDENT} < $< > $@"; \
|
||||
${GINDENT} < $< > $@; \
|
||||
elif which "${INDENT}" >/dev/null 2>&1; then \
|
||||
echo ${RM} -f $@; \
|
||||
${RM} -f $@; \
|
||||
echo "${INDENT} < $< > $@"; \
|
||||
${INDENT} < $< > $@; \
|
||||
else \
|
||||
echo "no intent tool found, ident $< yourself, sorry"; \
|
||||
echo "exit 1"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
|
||||
##################
|
||||
# 133t hacker rulz
|
||||
##################
|
||||
#
|
||||
love:
|
||||
@echo 'not war?'
|
||||
@${TRUE}
|
||||
|
||||
haste:
|
||||
$(MAKE) waste
|
||||
@${TRUE}
|
||||
|
||||
waste:
|
||||
@echo 'haste'
|
||||
@${TRUE}
|
||||
|
||||
maker:
|
||||
@echo 'Participate in a maker faire'
|
||||
@${TRUE}
|
||||
|
||||
easter_egg:
|
||||
@echo "you expected to often misunderstand this $${RANDOM} magic"
|
||||
@echo "chongo '<was here>' /\\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"
|
||||
+8
-10
@@ -1,4 +1,4 @@
|
||||
Best of Show:
|
||||
# Best of Show:
|
||||
|
||||
Carl Banks
|
||||
Penn State Department of Aerospace Engineering
|
||||
@@ -8,17 +8,16 @@ Best of Show:
|
||||
|
||||
http://www.personal.psu.edu/users/c/w/cwb129/
|
||||
|
||||
## To build:
|
||||
|
||||
Judge's Comments:
|
||||
make all
|
||||
|
||||
To build:
|
||||
|
||||
make banks
|
||||
|
||||
To use:
|
||||
### To run
|
||||
|
||||
cat horizon.sc pittsburgh.sc | ./banks
|
||||
|
||||
## Judges' comments
|
||||
|
||||
What can we say? It's a flight sim done in 1536 bytes of real code.
|
||||
This one is a real marvel. When people say the size limits are too
|
||||
tight, well, we can just point them at this one. This program really
|
||||
@@ -31,10 +30,9 @@ Judge's Comments:
|
||||
the altitude and airspeed. These problems have been fixed. One can
|
||||
still build the original program by:
|
||||
|
||||
make banks.orig
|
||||
make banks.alt
|
||||
|
||||
|
||||
Selected Author's Comments:
|
||||
## Author's comments
|
||||
|
||||
You have just stepped out of the real world and into the
|
||||
virtual. You are now sitting in the cockpit of a Piper Cherokee
|
||||
|
||||
File renamed without changes.
+317
-151
@@ -1,174 +1,340 @@
|
||||
#!/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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#CFLAGS=-O -Xa
|
||||
#CFLAGS=-Xa
|
||||
CFLAGS= -ansi
|
||||
#CFLAGS= -ansi -O
|
||||
#CFLAGS=
|
||||
#CFLAGS= -ansi -L/usr/X11R6/lib
|
||||
# See: http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
# ANSI compiler
|
||||
|
||||
#############################
|
||||
# shell used by this Makefile
|
||||
#############################
|
||||
#
|
||||
# Set CC to the name of your ANSI compiler.
|
||||
SHELL= bash
|
||||
|
||||
#######################
|
||||
# common tool locations
|
||||
#######################
|
||||
#
|
||||
# Some entries seem to need gcc. If you have gcc, set
|
||||
# both CC and MAY_NEED_GCC to gcc.
|
||||
include ../../var.mk
|
||||
|
||||
# Set X11_LIBDIR to the directory where the X11 library resides
|
||||
#
|
||||
# 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.
|
||||
#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-bitwise-conditional-parentheses -Wno-bitwise-op-parentheses \
|
||||
-Wno-empty-body -Wno-invalid-source-encoding -Wno-main -Wno-parentheses \
|
||||
-Wno-shift-op-parentheses
|
||||
|
||||
# Common C compiler warning flags
|
||||
#
|
||||
#CWARN= ${CSILENCE}
|
||||
#CWARN= -Wall ${CSILENCE}
|
||||
CWARN= -Wall -Wextra ${CSILENCE}
|
||||
#CWARN= -Wall -Wextra -pedantic ${CSILENCE}
|
||||
|
||||
# Compiler standard
|
||||
#
|
||||
#CSTD=
|
||||
#CSTD= -ansi
|
||||
CSTD= -std=gnu90
|
||||
|
||||
# Compiler bit architecture
|
||||
#
|
||||
# Some entries require 32-bitness:
|
||||
# ARCH= -m32
|
||||
#
|
||||
# Some entries require 64-bitness:
|
||||
# ARCH= -m64
|
||||
#
|
||||
# By default we assume nothing:
|
||||
#
|
||||
ARCH=
|
||||
|
||||
# Defines that are needed to compile
|
||||
#
|
||||
CDEFINE=
|
||||
#CDEFINE= -DIOCCC
|
||||
|
||||
# Include files that are needed to compile
|
||||
#
|
||||
CINCLUDE=
|
||||
#CINCLUDE= -include stdlib.h
|
||||
#CINCLUDE= -include stdio.h
|
||||
#CINCLUDE= -include stdlib.h -include stdio.h
|
||||
#CINCLUDE= -I ${X11_INCDIR}
|
||||
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
|
||||
|
||||
# Optimization
|
||||
#
|
||||
# Most compiles will safely use -O2. Some can use only -O1 or -O.
|
||||
# A few compilers have broken optimizers or this entry make break
|
||||
# under those buggy optimizers and thus you may not want anything.
|
||||
# Reasonable compilers will allow for -O3.
|
||||
#
|
||||
#OPT=
|
||||
#OPT= -O
|
||||
#OPT= -O1
|
||||
#OPT= -O2
|
||||
OPT= -O3
|
||||
|
||||
# Default flags for ANSI C compilation
|
||||
#
|
||||
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
|
||||
|
||||
# Libraries needed to build
|
||||
#
|
||||
LIBS=
|
||||
#LIBS= -lm
|
||||
#LIBS= -L ${X11_LIBDIR} -lX11
|
||||
#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL
|
||||
|
||||
# C compiler to use
|
||||
#
|
||||
CC= cc
|
||||
MAY_NEED_GCC= gcc
|
||||
#CC=clang
|
||||
#CC=gcc
|
||||
|
||||
# winners that compile under ANSI C
|
||||
# Compiler add-ons or replacements for clang only
|
||||
#
|
||||
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
|
||||
ifeq ($(CC),clang)
|
||||
#
|
||||
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
|
||||
CSILENCE+= -Wno-comma -Wno-implicit-int-conversion -Wno-missing-prototypes \
|
||||
-Wno-missing-variable-declarations -Wno-pedantic \
|
||||
-Wno-poison-system-directories -Wno-shorten-64-to-32 -Wno-sign-conversion \
|
||||
-Wno-strict-prototypes
|
||||
#
|
||||
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 $@
|
||||
|
||||
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
|
||||
CWARN+= -Weverything
|
||||
#
|
||||
chaos_nohalf: chaos_nohalf.c
|
||||
${CC} ${CFLAGS} $? -lcurses -o $@
|
||||
${CP} -f $@ chaos
|
||||
endif
|
||||
|
||||
chaos_nohalf.c: chaos.c
|
||||
${RM} -f $@
|
||||
${SED} -e 's/halfdelay([^)]*);//' < $? > $@
|
||||
# Specific add-ons or replacements for gcc only
|
||||
#
|
||||
ifeq ($(CC),gcc)
|
||||
#
|
||||
#CSILENCE+=
|
||||
#
|
||||
#CWARN+=
|
||||
#
|
||||
endif
|
||||
|
||||
chaos_files: cube.data desk.data ioccc.data pyramid.data xwing.data
|
||||
|
||||
everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES}
|
||||
##############################
|
||||
# Special flags for this entry
|
||||
##############################
|
||||
#
|
||||
ENTRY= bas1
|
||||
PROG= ${ENTRY}
|
||||
#
|
||||
OBJ= ${PROG}.o
|
||||
DATA=
|
||||
TARGET= ${PROG}
|
||||
#
|
||||
ALT_OBJ=
|
||||
ALT_TARGET=
|
||||
|
||||
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
|
||||
#################
|
||||
# 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 '<was here>' /\\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"
|
||||
+7
-9
@@ -1,4 +1,4 @@
|
||||
Best Encapsulation:
|
||||
# Best Encapsulation:
|
||||
|
||||
Bas de Bakker
|
||||
Pica, Centre for Library Automation
|
||||
@@ -6,14 +6,11 @@ Best Encapsulation:
|
||||
3039 JN Rotterdam
|
||||
The Netherlands
|
||||
|
||||
## To build:
|
||||
|
||||
Judges' comments:
|
||||
make all
|
||||
|
||||
To build:
|
||||
|
||||
make bas1
|
||||
|
||||
To use:
|
||||
### To run
|
||||
|
||||
If lpr on your system can print PostScript:
|
||||
|
||||
@@ -25,14 +22,15 @@ Judges' comments:
|
||||
or:
|
||||
./bas1 | gunzip | gs -sDEVICE=pgmraw -sOutputFile='|xv -' -
|
||||
|
||||
## Judges' comments
|
||||
|
||||
The output is supposed to be a 3D maze, but it is somewhat more
|
||||
than that. If you've seen any of the Maurits Escher's works,
|
||||
you'll know what we're talking about.
|
||||
|
||||
When trying to run the program with command line arguments, be generous.
|
||||
|
||||
|
||||
Selected Author's Comments:
|
||||
## Author's comments
|
||||
|
||||
BEMAZING
|
||||
========
|
||||
|
||||
+313
-151
@@ -1,174 +1,336 @@
|
||||
#!/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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#CFLAGS=-O -Xa
|
||||
#CFLAGS=-Xa
|
||||
CFLAGS= -ansi
|
||||
#CFLAGS= -ansi -O
|
||||
#CFLAGS=
|
||||
#CFLAGS= -ansi -L/usr/X11R6/lib
|
||||
# See: http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
# ANSI compiler
|
||||
|
||||
#############################
|
||||
# shell used by this Makefile
|
||||
#############################
|
||||
#
|
||||
# Set CC to the name of your ANSI compiler.
|
||||
SHELL= bash
|
||||
|
||||
#######################
|
||||
# common tool locations
|
||||
#######################
|
||||
#
|
||||
# Some entries seem to need gcc. If you have gcc, set
|
||||
# both CC and MAY_NEED_GCC to gcc.
|
||||
include ../../var.mk
|
||||
|
||||
# Set X11_LIBDIR to the directory where the X11 library resides
|
||||
#
|
||||
# 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.
|
||||
#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-main
|
||||
|
||||
# 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
|
||||
MAY_NEED_GCC= gcc
|
||||
#CC=clang
|
||||
#CC=gcc
|
||||
|
||||
# winners that compile under ANSI C
|
||||
# Compiler add-ons or replacements for clang only
|
||||
#
|
||||
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
|
||||
ifeq ($(CC),clang)
|
||||
#
|
||||
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
|
||||
CSILENCE+= -Wno-comma -Wno-missing-variable-declarations -Wno-pedantic \
|
||||
-Wno-poison-system-directories
|
||||
#
|
||||
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 $@
|
||||
|
||||
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
|
||||
CWARN+= -Weverything
|
||||
#
|
||||
chaos_nohalf: chaos_nohalf.c
|
||||
${CC} ${CFLAGS} $? -lcurses -o $@
|
||||
${CP} -f $@ chaos
|
||||
endif
|
||||
|
||||
chaos_nohalf.c: chaos.c
|
||||
${RM} -f $@
|
||||
${SED} -e 's/halfdelay([^)]*);//' < $? > $@
|
||||
# Specific add-ons or replacements for gcc only
|
||||
#
|
||||
ifeq ($(CC),gcc)
|
||||
#
|
||||
#CSILENCE+=
|
||||
#
|
||||
#CWARN+=
|
||||
#
|
||||
endif
|
||||
|
||||
chaos_files: cube.data desk.data ioccc.data pyramid.data xwing.data
|
||||
|
||||
everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES}
|
||||
##############################
|
||||
# Special flags for this entry
|
||||
##############################
|
||||
#
|
||||
ENTRY= bas2
|
||||
PROG= ${ENTRY}
|
||||
#
|
||||
OBJ= ${PROG}.o
|
||||
DATA=
|
||||
TARGET= ${PROG}
|
||||
#
|
||||
ALT_OBJ=
|
||||
ALT_TARGET=
|
||||
|
||||
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
|
||||
#################
|
||||
# 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 '<was here>' /\\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"
|
||||
+7
-9
@@ -1,4 +1,4 @@
|
||||
Best Small Program:
|
||||
# Best Small Program:
|
||||
|
||||
Bas de Bakker
|
||||
Pica, Centre for Library Automation
|
||||
@@ -6,17 +6,16 @@ Best Small Program:
|
||||
3039 JN Rotterdam
|
||||
The Netherlands
|
||||
|
||||
## To build:
|
||||
|
||||
Judges' comments:
|
||||
make all
|
||||
|
||||
To build:
|
||||
|
||||
make bas2
|
||||
|
||||
To use:
|
||||
### To run
|
||||
|
||||
./bas2 < bas2.c
|
||||
|
||||
## Judges' comments
|
||||
|
||||
Questions to ponder:
|
||||
|
||||
Can you determine the relationship between the input and the
|
||||
@@ -33,8 +32,7 @@ Judges' comments:
|
||||
official IOCCC rules. What is the rule and what is the octet
|
||||
value?
|
||||
|
||||
|
||||
Selected Author's Comments:
|
||||
## Author's comments
|
||||
|
||||
The main obfuscation is the way characters are recognized, which is
|
||||
done by matching the bit patterns. Minor obfuscations are:
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
chaos
|
||||
chaos_nohalf
|
||||
chaos_nohalf.c
|
||||
+324
-152
@@ -1,174 +1,346 @@
|
||||
#!/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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#CFLAGS=-O -Xa
|
||||
#CFLAGS=-Xa
|
||||
CFLAGS= -ansi
|
||||
#CFLAGS= -ansi -O
|
||||
#CFLAGS=
|
||||
#CFLAGS= -ansi -L/usr/X11R6/lib
|
||||
# See: http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
# ANSI compiler
|
||||
|
||||
#############################
|
||||
# shell used by this Makefile
|
||||
#############################
|
||||
#
|
||||
# Set CC to the name of your ANSI compiler.
|
||||
SHELL= bash
|
||||
|
||||
#######################
|
||||
# common tool locations
|
||||
#######################
|
||||
#
|
||||
# Some entries seem to need gcc. If you have gcc, set
|
||||
# both CC and MAY_NEED_GCC to gcc.
|
||||
include ../../var.mk
|
||||
|
||||
# Set X11_LIBDIR to the directory where the X11 library resides
|
||||
#
|
||||
# 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.
|
||||
#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-c99-extensions
|
||||
|
||||
# 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= -lcurses
|
||||
#LIBS= -L ${X11_LIBDIR} -lX11
|
||||
#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL
|
||||
|
||||
# C compiler to use
|
||||
#
|
||||
CC= cc
|
||||
MAY_NEED_GCC= gcc
|
||||
#CC=clang
|
||||
#CC=gcc
|
||||
|
||||
# winners that compile under ANSI C
|
||||
# Compiler add-ons or replacements for clang only
|
||||
#
|
||||
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
|
||||
ifeq ($(CC),clang)
|
||||
#
|
||||
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
|
||||
CSILENCE+= -Wno-bad-function-cast -Wno-double-promotion -Wno-float-conversion \
|
||||
-Wno-format-nonliteral -Wno-implicit-float-conversion \
|
||||
-Wno-missing-variable-declarations -Wno-poison-system-directories \
|
||||
-Wno-sign-conversion
|
||||
#
|
||||
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 $@
|
||||
|
||||
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
|
||||
CWARN+= -Weverything
|
||||
#
|
||||
chaos_nohalf: chaos_nohalf.c
|
||||
${CC} ${CFLAGS} $? -lcurses -o $@
|
||||
${CP} -f $@ chaos
|
||||
endif
|
||||
|
||||
chaos_nohalf.c: chaos.c
|
||||
# Specific add-ons or replacements for gcc only
|
||||
#
|
||||
ifeq ($(CC),gcc)
|
||||
#
|
||||
#CSILENCE+=
|
||||
#
|
||||
#CWARN+=
|
||||
#
|
||||
endif
|
||||
|
||||
|
||||
##############################
|
||||
# Special flags for this entry
|
||||
##############################
|
||||
#
|
||||
ENTRY= chaos
|
||||
PROG= ${ENTRY}
|
||||
#
|
||||
OBJ= ${PROG}.o
|
||||
DATA= cube.data desk.data ioccc.data pyramid.data xwing.data
|
||||
TARGET= ${PROG} ${PROG}_nohalf
|
||||
#
|
||||
ALT_OBJ= ${PROG}_nohalf.o
|
||||
ALT_TARGET= ${PROG}_nohalf
|
||||
|
||||
|
||||
#################
|
||||
# build the entry
|
||||
#################
|
||||
#
|
||||
all: data ${TARGET}
|
||||
@${TRUE}
|
||||
|
||||
.PHONY: all alt data everything clean clobber install \
|
||||
love haste waste maker easter_egg sandwich \
|
||||
supernova deep_magic magic charon pluto
|
||||
|
||||
${PROG}: ${PROG}.c
|
||||
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
||||
|
||||
${PROG}_nohalf: ${PROG}_nohalf.c
|
||||
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
||||
|
||||
${PROG}_nohalf.c: ${PROG}.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
|
||||
# alternative executable
|
||||
#
|
||||
alt: data ${ALT_TARGET}
|
||||
@${TRUE}
|
||||
|
||||
install: all
|
||||
${CAT} ${WINNERS} ${ALT_NAMES} > /dev/null
|
||||
# data files
|
||||
#
|
||||
data: ${DATA}
|
||||
@${TRUE}
|
||||
|
||||
# both all and alt
|
||||
#
|
||||
everything: all alt
|
||||
|
||||
|
||||
###############
|
||||
# utility rules
|
||||
###############
|
||||
#
|
||||
clean:
|
||||
${RM} -f ${OBJ} ${ALT_OBJ}
|
||||
@-if [ -f indent.c ]; then \
|
||||
echo ${RM} -f indent.c; \
|
||||
${RM} -f indent.c; \
|
||||
fi
|
||||
|
||||
clobber: clean
|
||||
${RM} -f ${TARGET} ${ALT_TARGET}
|
||||
${RM} -f ${PROG}_nohalf.c
|
||||
@-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 '<was here>' /\\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"
|
||||
+317
-151
@@ -1,174 +1,340 @@
|
||||
#!/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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#CFLAGS=-O -Xa
|
||||
#CFLAGS=-Xa
|
||||
CFLAGS= -ansi
|
||||
#CFLAGS= -ansi -O
|
||||
#CFLAGS=
|
||||
#CFLAGS= -ansi -L/usr/X11R6/lib
|
||||
# See: http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
# ANSI compiler
|
||||
|
||||
#############################
|
||||
# shell used by this Makefile
|
||||
#############################
|
||||
#
|
||||
# Set CC to the name of your ANSI compiler.
|
||||
SHELL= bash
|
||||
|
||||
#######################
|
||||
# common tool locations
|
||||
#######################
|
||||
#
|
||||
# Some entries seem to need gcc. If you have gcc, set
|
||||
# both CC and MAY_NEED_GCC to gcc.
|
||||
include ../../var.mk
|
||||
|
||||
# Set X11_LIBDIR to the directory where the X11 library resides
|
||||
#
|
||||
# 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.
|
||||
#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-bitwise-op-parentheses -Wno-char-subscripts -Wno-pointer-to-int-cast \
|
||||
-Wno-return-type -Wno-unused-parameter -Wno-unused-variable -Wno-typedef-redefinition
|
||||
|
||||
# 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
|
||||
MAY_NEED_GCC= gcc
|
||||
#CC=clang
|
||||
#CC=gcc
|
||||
|
||||
# winners that compile under ANSI C
|
||||
# Compiler add-ons or replacements for clang only
|
||||
#
|
||||
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
|
||||
ifeq ($(CC),clang)
|
||||
#
|
||||
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
|
||||
CSILENCE+= -Wno-array-bounds-pointer-arithmetic -Wno-implicit-int-conversion \
|
||||
-Wno-keyword-macro -Wno-missing-prototypes \
|
||||
-Wno-missing-variable-declarations -Wno-pedantic \
|
||||
-Wno-poison-system-directories -Wno-shadow -Wno-sign-conversion \
|
||||
-Wno-strict-prototypes
|
||||
#
|
||||
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 $@
|
||||
|
||||
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
|
||||
CWARN+= -Weverything
|
||||
#
|
||||
chaos_nohalf: chaos_nohalf.c
|
||||
${CC} ${CFLAGS} $? -lcurses -o $@
|
||||
${CP} -f $@ chaos
|
||||
endif
|
||||
|
||||
chaos_nohalf.c: chaos.c
|
||||
${RM} -f $@
|
||||
${SED} -e 's/halfdelay([^)]*);//' < $? > $@
|
||||
# Specific add-ons or replacements for gcc only
|
||||
#
|
||||
ifeq ($(CC),gcc)
|
||||
#
|
||||
#CSILENCE+=
|
||||
#
|
||||
#CWARN+=
|
||||
#
|
||||
endif
|
||||
|
||||
chaos_files: cube.data desk.data ioccc.data pyramid.data xwing.data
|
||||
|
||||
everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES}
|
||||
##############################
|
||||
# Special flags for this entry
|
||||
##############################
|
||||
#
|
||||
ENTRY= df
|
||||
PROG= ${ENTRY}
|
||||
#
|
||||
OBJ= ${PROG}.o
|
||||
DATA=
|
||||
TARGET= ${PROG}
|
||||
#
|
||||
ALT_OBJ=
|
||||
ALT_TARGET=
|
||||
|
||||
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
|
||||
#################
|
||||
# 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 '<was here>' /\\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"
|
||||
+7
-9
@@ -1,4 +1,4 @@
|
||||
Best Data Hiding:
|
||||
# Best Data Hiding:
|
||||
|
||||
Daniel Fischer
|
||||
VNetx.com GbR
|
||||
@@ -6,17 +6,16 @@ Best Data Hiding:
|
||||
D 72250 Freudenstadt
|
||||
German Federal Republic
|
||||
|
||||
## To build:
|
||||
|
||||
Judge's Comments:
|
||||
make all
|
||||
|
||||
To build:
|
||||
|
||||
make df
|
||||
|
||||
To use:
|
||||
### To run
|
||||
|
||||
./df
|
||||
|
||||
## Judges' comments
|
||||
|
||||
Everyone talks about how data hiding can produce clearer code; I am
|
||||
pleased to offer this charming refutation.
|
||||
|
||||
@@ -38,8 +37,7 @@ Judge's Comments:
|
||||
How many words does this entry use?
|
||||
Can you add more words to the program and still make it work?
|
||||
|
||||
|
||||
Selected Author's Comments:
|
||||
## Author's comments
|
||||
|
||||
This program lets you guess English words. It displays an underscore
|
||||
for each letter in the word; guessing a letter that actually is in
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
#ifndef int
|
||||
typedef int lint;
|
||||
#ifdef while
|
||||
char s[234],d[56],*p=s,m='m';
|
||||
#define int typedef (*define)();\
|
||||
@@ -9,7 +10,7 @@ signed short n(short bz){
|
||||
char o=1,i=1,l,pc=i,b=r+o/2,_f=6,m=7,s=8,g,q,od=o*rs+4^s,js=_f/*3-m*'c',bs='g';
|
||||
return 1; }
|
||||
#y FILE c[a]+s,p[c],r[m]+u[i+4*o|f]-r[wob][wad]+s*f-!w|o,L+x | cut
|
||||
;}int main(i,love_unix){*/;}int main(i,love_unix){/*;}int main(i,love_unix){*\;}| here */
|
||||
;}int main(lint i,char**love_unix){*/;}int main(lint i,char**love_unix){/*;}int main(lint i,char**love_unix){*\;}| here */
|
||||
while(FILE)for(;9-(i=0[O](f)););
|
||||
for(;32-(i=0[O](f));0&& 3[O]("-->%s<--", "gxdgbtgxsxpcctvpixktedhiedcte"));
|
||||
for(;'\n'-(i=O[0](f));)(i>='a'&&i<'z')?*
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
dlowe
|
||||
dlowe.alt
|
||||
+315
-151
@@ -1,174 +1,338 @@
|
||||
#!/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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#CFLAGS=-O -Xa
|
||||
#CFLAGS=-Xa
|
||||
CFLAGS= -ansi
|
||||
#CFLAGS= -ansi -O
|
||||
#CFLAGS=
|
||||
#CFLAGS= -ansi -L/usr/X11R6/lib
|
||||
# See: http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
# ANSI compiler
|
||||
|
||||
#############################
|
||||
# shell used by this Makefile
|
||||
#############################
|
||||
#
|
||||
# Set CC to the name of your ANSI compiler.
|
||||
SHELL= bash
|
||||
|
||||
#######################
|
||||
# common tool locations
|
||||
#######################
|
||||
#
|
||||
# Some entries seem to need gcc. If you have gcc, set
|
||||
# both CC and MAY_NEED_GCC to gcc.
|
||||
include ../../var.mk
|
||||
|
||||
# Set X11_LIBDIR to the directory where the X11 library resides
|
||||
#
|
||||
# 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.
|
||||
#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-main-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
|
||||
MAY_NEED_GCC= gcc
|
||||
#CC=clang
|
||||
#CC=gcc
|
||||
|
||||
# winners that compile under ANSI C
|
||||
# Compiler add-ons or replacements for clang only
|
||||
#
|
||||
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
|
||||
ifeq ($(CC),clang)
|
||||
#
|
||||
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
|
||||
CSILENCE+= -Wno-implicit-int-conversion -Wno-poison-system-directories
|
||||
#
|
||||
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 $@
|
||||
|
||||
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
|
||||
CWARN+= -Weverything
|
||||
#
|
||||
chaos_nohalf: chaos_nohalf.c
|
||||
${CC} ${CFLAGS} $? -lcurses -o $@
|
||||
${CP} -f $@ chaos
|
||||
endif
|
||||
|
||||
chaos_nohalf.c: chaos.c
|
||||
${RM} -f $@
|
||||
${SED} -e 's/halfdelay([^)]*);//' < $? > $@
|
||||
# Specific add-ons or replacements for gcc only
|
||||
#
|
||||
ifeq ($(CC),gcc)
|
||||
#
|
||||
#CSILENCE+=
|
||||
#
|
||||
#CWARN+=
|
||||
#
|
||||
endif
|
||||
|
||||
chaos_files: cube.data desk.data ioccc.data pyramid.data xwing.data
|
||||
|
||||
everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES}
|
||||
##############################
|
||||
# Special flags for this entry
|
||||
##############################
|
||||
#
|
||||
ENTRY= dlowe
|
||||
PROG= ${ENTRY}
|
||||
#
|
||||
OBJ= ${PROG}.o
|
||||
DATA=
|
||||
TARGET= ${PROG} ${PROG}.alt
|
||||
#
|
||||
ALT_OBJ= ${PROG}.alt.o
|
||||
ALT_TARGET= ${PROG}.alt
|
||||
|
||||
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
|
||||
#################
|
||||
# build the entry
|
||||
#################
|
||||
#
|
||||
all: data ${TARGET}
|
||||
@${TRUE}
|
||||
|
||||
install: all
|
||||
${CAT} ${WINNERS} ${ALT_NAMES} > /dev/null
|
||||
.PHONY: all alt data everything clean clobber install \
|
||||
love haste waste maker easter_egg sandwich \
|
||||
supernova deep_magic magic charon pluto
|
||||
|
||||
${PROG}: ${PROG}.c
|
||||
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
||||
|
||||
${PROG}.alt: ${PROG}.alt.c
|
||||
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
||||
|
||||
# alternative executable
|
||||
#
|
||||
alt: data ${ALT_TARGET}
|
||||
@${TRUE}
|
||||
|
||||
# data files
|
||||
#
|
||||
data: ${DATA}
|
||||
@${TRUE}
|
||||
|
||||
# both all and alt
|
||||
#
|
||||
everything: all alt
|
||||
|
||||
|
||||
###############
|
||||
# utility rules
|
||||
###############
|
||||
#
|
||||
clean:
|
||||
${RM} -f ${OBJ} ${ALT_OBJ}
|
||||
@-if [ -f indent.c ]; then \
|
||||
echo ${RM} -f indent.c; \
|
||||
${RM} -f indent.c; \
|
||||
fi
|
||||
|
||||
clobber: clean
|
||||
${RM} -f ${TARGET} ${ALT_TARGET}
|
||||
@-if [ -e sandwich ]; then \
|
||||
${RM} -f sandwich; \
|
||||
echo 'ate sandwich'; \
|
||||
fi
|
||||
|
||||
install:
|
||||
@echo "Dr. Spock says that is not logical!"
|
||||
@${TRUE}
|
||||
|
||||
# you may be able to misunderstand the source by reading indent.c
|
||||
#
|
||||
indent.c: ${PROG}.c
|
||||
@if which "${GINDENT}" >/dev/null 2>&1; then \
|
||||
echo ${RM} -f $@; \
|
||||
${RM} -f $@; \
|
||||
echo "${GINDENT} < $< > $@"; \
|
||||
${GINDENT} < $< > $@; \
|
||||
elif which "${INDENT}" >/dev/null 2>&1; then \
|
||||
echo ${RM} -f $@; \
|
||||
${RM} -f $@; \
|
||||
echo "${INDENT} < $< > $@"; \
|
||||
${INDENT} < $< > $@; \
|
||||
else \
|
||||
echo "no intent tool found, ident $< yourself, sorry"; \
|
||||
echo "exit 1"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
|
||||
##################
|
||||
# 133t hacker rulz
|
||||
##################
|
||||
#
|
||||
love:
|
||||
@echo 'not war?'
|
||||
@${TRUE}
|
||||
|
||||
haste:
|
||||
$(MAKE) waste
|
||||
@${TRUE}
|
||||
|
||||
waste:
|
||||
@echo 'haste'
|
||||
@${TRUE}
|
||||
|
||||
maker:
|
||||
@echo 'Participate in a maker faire'
|
||||
@${TRUE}
|
||||
|
||||
easter_egg:
|
||||
@echo "you expected to often misunderstand this $${RANDOM} magic"
|
||||
@echo "chongo '<was here>' /\\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"
|
||||
+9
-11
@@ -1,4 +1,4 @@
|
||||
Best Utility:
|
||||
# Best Utility:
|
||||
|
||||
David Lowe
|
||||
Pootpoot
|
||||
@@ -8,17 +8,16 @@ Best Utility:
|
||||
|
||||
http://pootpoot.com/
|
||||
|
||||
## To build:
|
||||
|
||||
Judges' Comments:
|
||||
make all
|
||||
|
||||
To build:
|
||||
|
||||
make dlowe
|
||||
|
||||
To use:
|
||||
### To run
|
||||
|
||||
./dlowe < anyfile > pootfile
|
||||
|
||||
## Judges' comments
|
||||
|
||||
Why is this entry would be considered a utility? Well because it
|
||||
is able to convert content-free web pages into useful web pages.
|
||||
|
||||
@@ -63,11 +62,10 @@ Judges' Comments:
|
||||
NOTE: The original entry was just a text based pootifier. To build
|
||||
that version try:
|
||||
|
||||
make dlowe.orig
|
||||
./dlowe.orig < anyfile > pootfile
|
||||
make dlowe.alt
|
||||
./dlowe.alt < anyfile > pootfile
|
||||
|
||||
|
||||
Selected Author's Comments:
|
||||
## Author's comments
|
||||
|
||||
This program is a text filter, it reads stdin and outputs the
|
||||
"corrected" text to stdout.
|
||||
|
||||
File renamed without changes.
@@ -1 +1,2 @@
|
||||
dloweneil
|
||||
pootris
|
||||
+316
-151
@@ -1,174 +1,339 @@
|
||||
#!/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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#CFLAGS=-O -Xa
|
||||
#CFLAGS=-Xa
|
||||
CFLAGS= -ansi
|
||||
#CFLAGS= -ansi -O
|
||||
#CFLAGS=
|
||||
#CFLAGS= -ansi -L/usr/X11R6/lib
|
||||
# See: http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
# ANSI compiler
|
||||
|
||||
#############################
|
||||
# shell used by this Makefile
|
||||
#############################
|
||||
#
|
||||
# Set CC to the name of your ANSI compiler.
|
||||
SHELL= bash
|
||||
|
||||
#######################
|
||||
# common tool locations
|
||||
#######################
|
||||
#
|
||||
# Some entries seem to need gcc. If you have gcc, set
|
||||
# both CC and MAY_NEED_GCC to gcc.
|
||||
include ../../var.mk
|
||||
|
||||
# Set X11_LIBDIR to the directory where the X11 library resides
|
||||
#
|
||||
# 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.
|
||||
#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-dangling-else
|
||||
|
||||
# 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= -lcurses
|
||||
#LIBS= -L ${X11_LIBDIR} -lX11
|
||||
#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL
|
||||
|
||||
# C compiler to use
|
||||
#
|
||||
CC= cc
|
||||
MAY_NEED_GCC= gcc
|
||||
#CC=clang
|
||||
#CC=gcc
|
||||
|
||||
# winners that compile under ANSI C
|
||||
# Compiler add-ons or replacements for clang only
|
||||
#
|
||||
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
|
||||
ifeq ($(CC),clang)
|
||||
#
|
||||
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
|
||||
CSILENCE+= -Wno-comma -Wno-poison-system-directories
|
||||
#
|
||||
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 $@
|
||||
|
||||
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
|
||||
CWARN+= -Weverything
|
||||
#
|
||||
chaos_nohalf: chaos_nohalf.c
|
||||
${CC} ${CFLAGS} $? -lcurses -o $@
|
||||
${CP} -f $@ chaos
|
||||
endif
|
||||
|
||||
chaos_nohalf.c: chaos.c
|
||||
${RM} -f $@
|
||||
${SED} -e 's/halfdelay([^)]*);//' < $? > $@
|
||||
# Specific add-ons or replacements for gcc only
|
||||
#
|
||||
ifeq ($(CC),gcc)
|
||||
#
|
||||
#CSILENCE+=
|
||||
#
|
||||
#CWARN+=
|
||||
#
|
||||
endif
|
||||
|
||||
chaos_files: cube.data desk.data ioccc.data pyramid.data xwing.data
|
||||
|
||||
everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES}
|
||||
##############################
|
||||
# Special flags for this entry
|
||||
##############################
|
||||
#
|
||||
ENTRY= dloweneil
|
||||
PROG= ${ENTRY}
|
||||
#
|
||||
OBJ= ${PROG}.o
|
||||
DATA=
|
||||
TARGET= ${PROG} pootris
|
||||
#
|
||||
ALT_OBJ=
|
||||
ALT_TARGET=
|
||||
|
||||
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
|
||||
#################
|
||||
# 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}
|
||||
|
||||
pootris: ${PROG}
|
||||
${RM} -f $@
|
||||
${CP} $< $@
|
||||
|
||||
# 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 '<was here>' /\\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"
|
||||
@@ -1,4 +1,4 @@
|
||||
Most Fun:
|
||||
# Most Fun:
|
||||
|
||||
David Lowe Neil Mix
|
||||
Pootpoot Pootpoot
|
||||
@@ -8,16 +8,15 @@ Most Fun:
|
||||
|
||||
http://pootpoot.com/
|
||||
|
||||
## To build:
|
||||
|
||||
Judge's Comments:
|
||||
make all
|
||||
|
||||
To build:
|
||||
### To run
|
||||
|
||||
make dloweneil
|
||||
./pootris
|
||||
|
||||
To use:
|
||||
|
||||
./dloweneil
|
||||
## Judges' comments
|
||||
|
||||
Read the Author's comments below. We believe that your experience may
|
||||
mirror one of our experiences:
|
||||
@@ -26,11 +25,11 @@ Judge's Comments:
|
||||
description of the controls. I started playing. I struggled.
|
||||
I spelled my first "poot". I was hooked ...
|
||||
|
||||
|
||||
Selected Author's comments:
|
||||
## Author's comments
|
||||
|
||||
Usage:
|
||||
pootris [X size of board] [Y size of board]
|
||||
|
||||
./pootris [X size of board] [Y size of board]
|
||||
|
||||
Synopsis:
|
||||
The object of this game is to spell "POOT" as much as possible. There
|
||||
|
||||
+315
-151
@@ -1,174 +1,338 @@
|
||||
#!/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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#CFLAGS=-O -Xa
|
||||
#CFLAGS=-Xa
|
||||
CFLAGS= -ansi
|
||||
#CFLAGS= -ansi -O
|
||||
#CFLAGS=
|
||||
#CFLAGS= -ansi -L/usr/X11R6/lib
|
||||
# See: http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
# ANSI compiler
|
||||
|
||||
#############################
|
||||
# shell used by this Makefile
|
||||
#############################
|
||||
#
|
||||
# Set CC to the name of your ANSI compiler.
|
||||
SHELL= bash
|
||||
|
||||
#######################
|
||||
# common tool locations
|
||||
#######################
|
||||
#
|
||||
# Some entries seem to need gcc. If you have gcc, set
|
||||
# both CC and MAY_NEED_GCC to gcc.
|
||||
include ../../var.mk
|
||||
|
||||
# Set X11_LIBDIR to the directory where the X11 library resides
|
||||
#
|
||||
# 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.
|
||||
#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-parentheses \
|
||||
-Wno-shift-op-parentheses
|
||||
|
||||
# Common C compiler warning flags
|
||||
#
|
||||
#CWARN= ${CSILENCE}
|
||||
#CWARN= -Wall ${CSILENCE}
|
||||
#CWARN= -Wall -Wextra ${CSILENCE}
|
||||
CWARN= -Wall -Wextra -pedantic ${CSILENCE}
|
||||
|
||||
# Compiler standard
|
||||
#
|
||||
#CSTD=
|
||||
#CSTD= -ansi
|
||||
CSTD= -std=gnu90
|
||||
|
||||
# Compiler bit architecture
|
||||
#
|
||||
# Some entries require 32-bitness:
|
||||
# ARCH= -m32
|
||||
#
|
||||
# Some entries require 64-bitness:
|
||||
# ARCH= -m64
|
||||
#
|
||||
# By default we assume nothing:
|
||||
#
|
||||
ARCH=
|
||||
|
||||
# Defines that are needed to compile
|
||||
#
|
||||
CDEFINE=
|
||||
#CDEFINE= -DIOCCC
|
||||
|
||||
# Include files that are needed to compile
|
||||
#
|
||||
CINCLUDE=
|
||||
#CINCLUDE= -include stdlib.h
|
||||
#CINCLUDE= -include stdio.h
|
||||
#CINCLUDE= -include stdlib.h -include stdio.h
|
||||
#CINCLUDE= -I ${X11_INCDIR}
|
||||
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
|
||||
|
||||
# Optimization
|
||||
#
|
||||
# Most compiles will safely use -O2. Some can use only -O1 or -O.
|
||||
# A few compilers have broken optimizers or this entry make break
|
||||
# under those buggy optimizers and thus you may not want anything.
|
||||
# Reasonable compilers will allow for -O3.
|
||||
#
|
||||
#OPT=
|
||||
#OPT= -O
|
||||
#OPT= -O1
|
||||
#OPT= -O2
|
||||
OPT= -O3
|
||||
|
||||
# Default flags for ANSI C compilation
|
||||
#
|
||||
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
|
||||
|
||||
# Libraries needed to build
|
||||
#
|
||||
LIBS=
|
||||
#LIBS= -lm
|
||||
#LIBS= -L ${X11_LIBDIR} -lX11
|
||||
#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL
|
||||
|
||||
# C compiler to use
|
||||
#
|
||||
CC= cc
|
||||
MAY_NEED_GCC= gcc
|
||||
#CC=clang
|
||||
#CC=gcc
|
||||
|
||||
# winners that compile under ANSI C
|
||||
# Compiler add-ons or replacements for clang only
|
||||
#
|
||||
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
|
||||
ifeq ($(CC),clang)
|
||||
#
|
||||
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
|
||||
CSILENCE+= -Wno-array-bounds-pointer-arithmetic -Wno-comma \
|
||||
-Wno-implicit-int-conversion -Wno-poison-system-directories -Wno-shadow \
|
||||
-Wno-shorten-64-to-32
|
||||
#
|
||||
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 $@
|
||||
|
||||
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
|
||||
CWARN+= -Weverything
|
||||
#
|
||||
chaos_nohalf: chaos_nohalf.c
|
||||
${CC} ${CFLAGS} $? -lcurses -o $@
|
||||
${CP} -f $@ chaos
|
||||
endif
|
||||
|
||||
chaos_nohalf.c: chaos.c
|
||||
${RM} -f $@
|
||||
${SED} -e 's/halfdelay([^)]*);//' < $? > $@
|
||||
# Specific add-ons or replacements for gcc only
|
||||
#
|
||||
ifeq ($(CC),gcc)
|
||||
#
|
||||
#CSILENCE+=
|
||||
#
|
||||
#CWARN+=
|
||||
#
|
||||
endif
|
||||
|
||||
chaos_files: cube.data desk.data ioccc.data pyramid.data xwing.data
|
||||
|
||||
everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES}
|
||||
##############################
|
||||
# Special flags for this entry
|
||||
##############################
|
||||
#
|
||||
ENTRY= dorssel
|
||||
PROG= ${ENTRY}
|
||||
#
|
||||
OBJ= ${PROG}.o
|
||||
DATA= dorssel.hint2
|
||||
TARGET= ${PROG}
|
||||
#
|
||||
ALT_OBJ=
|
||||
ALT_TARGET=
|
||||
|
||||
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
|
||||
#################
|
||||
# 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 '<was here>' /\\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"
|
||||
+8
-10
@@ -1,4 +1,4 @@
|
||||
Obsolescent Feature:
|
||||
# Obsolescent Feature:
|
||||
|
||||
Frans van Dorsselaer
|
||||
Bakker Industrial Automation
|
||||
@@ -6,17 +6,16 @@ Obsolescent Feature:
|
||||
NL-2311 GP Leiden
|
||||
The Netherlands
|
||||
|
||||
## To build:
|
||||
|
||||
Judges' comments:
|
||||
make all
|
||||
|
||||
To build:
|
||||
|
||||
make dorssel
|
||||
|
||||
To use:
|
||||
### To run
|
||||
|
||||
echo Simple as 123 | ./dorssel
|
||||
echo '.... --- .-- -.. --- . ... .. - -.. --- - .... .- -'|./dorssel
|
||||
echo '.... --- .-- -.. --- . ... .. - -.. --- - .... .- -' | ./dorssel
|
||||
|
||||
## Judges' comments
|
||||
|
||||
How does the program decide which way to convert?
|
||||
|
||||
@@ -37,8 +36,7 @@ Judges' comments:
|
||||
|
||||
You might also want to read the dorssel.hint2 file.
|
||||
|
||||
|
||||
Selected author's notes:
|
||||
## Author's comments
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
fanf
|
||||
fanftmp1.c
|
||||
fanftmp2.c
|
||||
+320
-151
@@ -1,174 +1,343 @@
|
||||
#!/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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#CFLAGS=-O -Xa
|
||||
#CFLAGS=-Xa
|
||||
CFLAGS= -ansi
|
||||
#CFLAGS= -ansi -O
|
||||
#CFLAGS=
|
||||
#CFLAGS= -ansi -L/usr/X11R6/lib
|
||||
# See: http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
# ANSI compiler
|
||||
|
||||
#############################
|
||||
# shell used by this Makefile
|
||||
#############################
|
||||
#
|
||||
# Set CC to the name of your ANSI compiler.
|
||||
SHELL= bash
|
||||
|
||||
#######################
|
||||
# common tool locations
|
||||
#######################
|
||||
#
|
||||
# Some entries seem to need gcc. If you have gcc, set
|
||||
# both CC and MAY_NEED_GCC to gcc.
|
||||
include ../../var.mk
|
||||
|
||||
# Set X11_LIBDIR to the directory where the X11 library resides
|
||||
#
|
||||
# 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.
|
||||
#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-pointer-bool-conversion -Wno-unused-parameter -Wno-main
|
||||
|
||||
# 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
|
||||
MAY_NEED_GCC= gcc
|
||||
#CC=clang
|
||||
#CC=gcc
|
||||
|
||||
# winners that compile under ANSI C
|
||||
# Compiler add-ons or replacements for clang only
|
||||
#
|
||||
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
|
||||
ifeq ($(CC),clang)
|
||||
#
|
||||
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
|
||||
CSILENCE+= -Wno-comma -Wno-disabled-macro-expansion -Wno-missing-prototypes \
|
||||
-Wno-missing-variable-declarations -Wno-padded \
|
||||
-Wno-poison-system-directories -Wno-unused-macros
|
||||
#
|
||||
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 $@
|
||||
|
||||
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
|
||||
CWARN+= -Weverything
|
||||
#
|
||||
chaos_nohalf: chaos_nohalf.c
|
||||
${CC} ${CFLAGS} $? -lcurses -o $@
|
||||
${CP} -f $@ chaos
|
||||
endif
|
||||
|
||||
chaos_nohalf.c: chaos.c
|
||||
${RM} -f $@
|
||||
${SED} -e 's/halfdelay([^)]*);//' < $? > $@
|
||||
# Specific add-ons or replacements for gcc only
|
||||
#
|
||||
ifeq ($(CC),gcc)
|
||||
#
|
||||
#CSILENCE+=
|
||||
#
|
||||
#CWARN+=
|
||||
#
|
||||
endif
|
||||
|
||||
chaos_files: cube.data desk.data ioccc.data pyramid.data xwing.data
|
||||
|
||||
everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES}
|
||||
##############################
|
||||
# Special flags for this entry
|
||||
##############################
|
||||
#
|
||||
ENTRY= fanf
|
||||
PROG= ${ENTRY}
|
||||
#
|
||||
OBJ= ${PROG}.o
|
||||
DATA= fanf.lambda
|
||||
TARGET= ${PROG}
|
||||
#
|
||||
ALT_OBJ=
|
||||
ALT_TARGET=
|
||||
|
||||
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
|
||||
#################
|
||||
# build the entry
|
||||
#################
|
||||
#
|
||||
all: data ${TARGET}
|
||||
@${TRUE}
|
||||
|
||||
install: all
|
||||
${CAT} ${WINNERS} ${ALT_NAMES} > /dev/null
|
||||
.PHONY: all alt data everything clean clobber install \
|
||||
love haste waste maker easter_egg sandwich \
|
||||
supernova deep_magic magic charon pluto
|
||||
|
||||
${PROG}: ${PROG}.c
|
||||
${RM} -f ${PROG}tmp1.c
|
||||
${CC} ${CFLAGS} -E $< > ${PROG}tmp1.c
|
||||
${RM} -f ${PROG}tmp2.c
|
||||
${CC} ${CFLAGS} -E ${PROG}tmp1.c > ${PROG}tmp2.c
|
||||
@echo This next compile may take a whie to complete
|
||||
${CC} ${CFLAGS} ${PROG}tmp2.c ${LIBS} -o $@
|
||||
|
||||
# alternative executable
|
||||
#
|
||||
alt: data ${ALT_TARGET}
|
||||
@${TRUE}
|
||||
|
||||
# data files
|
||||
#
|
||||
data: ${DATA}
|
||||
@${TRUE}
|
||||
|
||||
# both all and alt
|
||||
#
|
||||
everything: all alt
|
||||
|
||||
|
||||
###############
|
||||
# utility rules
|
||||
###############
|
||||
#
|
||||
clean:
|
||||
${RM} -f ${OBJ} ${ALT_OBJ}
|
||||
@-if [ -f indent.c ]; then \
|
||||
echo ${RM} -f indent.c; \
|
||||
${RM} -f indent.c; \
|
||||
fi
|
||||
|
||||
clobber: clean
|
||||
${RM} -f ${TARGET} ${ALT_TARGET}
|
||||
${RM} -f ${PROG}tmp1.c ${PROG}tmp2.c
|
||||
@-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 '<was here>' /\\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"
|
||||
+12
-9
@@ -1,4 +1,4 @@
|
||||
Most Obfuscated Translator:
|
||||
# Most Obfuscated Translator:
|
||||
|
||||
Tony Finch
|
||||
Demon Internet
|
||||
@@ -9,14 +9,18 @@ Most Obfuscated Translator:
|
||||
|
||||
http://www.inch.demon.co.uk/
|
||||
|
||||
## To build:
|
||||
|
||||
Judges' comments:
|
||||
make all
|
||||
|
||||
To build:
|
||||
make fanf
|
||||
NOTE: This may take a while. Some systems may have problems building
|
||||
this entry because of the system resources it requires.
|
||||
|
||||
Some systems may have problems building this entry because
|
||||
of the system resources can require.
|
||||
### To run
|
||||
|
||||
./fanf
|
||||
|
||||
## Judges' comments
|
||||
|
||||
To use:
|
||||
Enter an expression on standard input. Here are some
|
||||
@@ -58,7 +62,7 @@ Judges' comments:
|
||||
|
||||
Look at the first stage of the C pre-processing:
|
||||
|
||||
gcc -ansi fanf.c -E > fanftmp1.c
|
||||
cc fanf.c -E > fanftmp1.c
|
||||
|
||||
Skip to the bottom of fanftmp1.c (after all of the #include header
|
||||
stuff ... look for a line of the form: # 2 "fanf.c" near the bottom)
|
||||
@@ -73,8 +77,7 @@ Judges' comments:
|
||||
What do you have to do to make this program work with an
|
||||
old non-ANSI C preprocessor?
|
||||
|
||||
|
||||
Selected Author's comments:
|
||||
## Author's comments
|
||||
|
||||
My program is a demonstration of some practical applications of
|
||||
theoretical computer science. The application it implements is a program
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
data
|
||||
schnitzi
|
||||
+314
-151
@@ -1,174 +1,337 @@
|
||||
#!/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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#CFLAGS=-O -Xa
|
||||
#CFLAGS=-Xa
|
||||
CFLAGS= -ansi
|
||||
#CFLAGS= -ansi -O
|
||||
#CFLAGS=
|
||||
#CFLAGS= -ansi -L/usr/X11R6/lib
|
||||
# See: http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
# ANSI compiler
|
||||
|
||||
#############################
|
||||
# shell used by this Makefile
|
||||
#############################
|
||||
#
|
||||
# Set CC to the name of your ANSI compiler.
|
||||
SHELL= bash
|
||||
|
||||
#######################
|
||||
# common tool locations
|
||||
#######################
|
||||
#
|
||||
# Some entries seem to need gcc. If you have gcc, set
|
||||
# both CC and MAY_NEED_GCC to gcc.
|
||||
|
||||
# Set X11_LIBDIR to the directory where the X11 library resides
|
||||
#
|
||||
# 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.
|
||||
#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-format-security \
|
||||
-Wno-int-to-pointer-cast -Wno-int-conversion -Wno-unused-parameter
|
||||
|
||||
# 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
|
||||
MAY_NEED_GCC= gcc
|
||||
#CC=clang
|
||||
#CC=gcc
|
||||
|
||||
# winners that compile under ANSI C
|
||||
# Compiler add-ons or replacements for clang only
|
||||
#
|
||||
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
|
||||
ifeq ($(CC),clang)
|
||||
#
|
||||
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
|
||||
CSILENCE+= -Wno-implicit-int-conversion -Wno-missing-prototypes \
|
||||
-Wno-missing-variable-declarations -Wno-pedantic \
|
||||
-Wno-poison-system-directories -Wno-shorten-64-to-32 -Wno-strict-prototypes
|
||||
#
|
||||
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 $@
|
||||
|
||||
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
|
||||
CWARN+= -Weverything
|
||||
#
|
||||
chaos_nohalf: chaos_nohalf.c
|
||||
${CC} ${CFLAGS} $? -lcurses -o $@
|
||||
${CP} -f $@ chaos
|
||||
endif
|
||||
|
||||
chaos_nohalf.c: chaos.c
|
||||
${RM} -f $@
|
||||
${SED} -e 's/halfdelay([^)]*);//' < $? > $@
|
||||
# Specific add-ons or replacements for gcc only
|
||||
#
|
||||
ifeq ($(CC),gcc)
|
||||
#
|
||||
#CSILENCE+=
|
||||
#
|
||||
#CWARN+=
|
||||
#
|
||||
endif
|
||||
|
||||
chaos_files: cube.data desk.data ioccc.data pyramid.data xwing.data
|
||||
|
||||
everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES}
|
||||
##############################
|
||||
# Special flags for this entry
|
||||
##############################
|
||||
#
|
||||
ENTRY= schnitzi
|
||||
PROG= ${ENTRY}
|
||||
#
|
||||
OBJ= ${PROG}.o
|
||||
DATA=
|
||||
TARGET= ${PROG}
|
||||
#
|
||||
ALT_OBJ=
|
||||
ALT_TARGET=
|
||||
|
||||
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
|
||||
#################
|
||||
# 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 '<was here>' /\\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"
|
||||
@@ -1,4 +1,4 @@
|
||||
Best Flow Control:
|
||||
# Best Flow Control:
|
||||
|
||||
Mark Schnitzius
|
||||
ISX Corporation
|
||||
@@ -8,14 +8,11 @@ Best Flow Control:
|
||||
|
||||
http://east.isx.com/~schnitzi/
|
||||
|
||||
## To build:
|
||||
|
||||
Judge's Comments:
|
||||
make all
|
||||
|
||||
To build:
|
||||
|
||||
make schnitzi
|
||||
|
||||
To use:
|
||||
### To run
|
||||
|
||||
./schnitzi 5 > sort.c
|
||||
cc sort.c -o sort
|
||||
@@ -26,14 +23,15 @@ Judge's Comments:
|
||||
echo 324 >> data
|
||||
./sort < data
|
||||
|
||||
## Judges' comments
|
||||
|
||||
This is a beautiful program. How can a program with no conditional
|
||||
behavior at all have output which depends on anything?
|
||||
|
||||
For hints on deciphering this, see below past the Author's Comments;
|
||||
they're a nice summary, but they leave the mystery intact.
|
||||
|
||||
|
||||
Selected Author's Comments:
|
||||
## Author's comments
|
||||
|
||||
In literary circles, there is a poetic form called a "lipogram",
|
||||
which is a poem in which a specific letter has been distinctly
|
||||
|
||||
@@ -52,5 +52,5 @@ void x_(){ O=g; *r=y[k-2]; _=r; j=o_; }
|
||||
void d (){ O=g; *r=y[k]; _=r; k=k+1; m=k<z; w=_t; l=p_; j=p; }
|
||||
void y_(){ O=g; *r=x[17][1]+k; _=r; j=q_; }
|
||||
void r_(){ O=_b; _=x[17]; s=(char**)_d; s=s+1; i=*s; q=0; }
|
||||
main(v,c){ O=r_; _d=c;
|
||||
main(int v,char **c){ O=r_; _d=c;
|
||||
x: (O)(); goto x; }
|
||||
+312
-151
@@ -1,174 +1,335 @@
|
||||
#!/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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#CFLAGS=-O -Xa
|
||||
#CFLAGS=-Xa
|
||||
CFLAGS= -ansi
|
||||
#CFLAGS= -ansi -O
|
||||
#CFLAGS=
|
||||
#CFLAGS= -ansi -L/usr/X11R6/lib
|
||||
# See: http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
# ANSI compiler
|
||||
|
||||
#############################
|
||||
# shell used by this Makefile
|
||||
#############################
|
||||
#
|
||||
# Set CC to the name of your ANSI compiler.
|
||||
SHELL= bash
|
||||
|
||||
#######################
|
||||
# common tool locations
|
||||
#######################
|
||||
#
|
||||
# Some entries seem to need gcc. If you have gcc, set
|
||||
# both CC and MAY_NEED_GCC to gcc.
|
||||
include ../../var.mk
|
||||
|
||||
# Set X11_LIBDIR to the directory where the X11 library resides
|
||||
#
|
||||
# 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.
|
||||
#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-string-plus-int -Wno-switch-bool
|
||||
|
||||
# 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 -include string.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
|
||||
MAY_NEED_GCC= gcc
|
||||
#CC=clang
|
||||
#CC=gcc
|
||||
|
||||
# winners that compile under ANSI C
|
||||
# Compiler add-ons or replacements for clang only
|
||||
#
|
||||
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
|
||||
ifeq ($(CC),clang)
|
||||
#
|
||||
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
|
||||
CSILENCE+= -Wno-poison-system-directories
|
||||
#
|
||||
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 $@
|
||||
|
||||
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
|
||||
CWARN+= -Weverything
|
||||
#
|
||||
chaos_nohalf: chaos_nohalf.c
|
||||
${CC} ${CFLAGS} $? -lcurses -o $@
|
||||
${CP} -f $@ chaos
|
||||
endif
|
||||
|
||||
chaos_nohalf.c: chaos.c
|
||||
${RM} -f $@
|
||||
${SED} -e 's/halfdelay([^)]*);//' < $? > $@
|
||||
# Specific add-ons or replacements for gcc only
|
||||
#
|
||||
ifeq ($(CC),gcc)
|
||||
#
|
||||
#CSILENCE+=
|
||||
#
|
||||
#CWARN+=
|
||||
#
|
||||
endif
|
||||
|
||||
chaos_files: cube.data desk.data ioccc.data pyramid.data xwing.data
|
||||
|
||||
everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES}
|
||||
##############################
|
||||
# Special flags for this entry
|
||||
##############################
|
||||
#
|
||||
ENTRY= schweikh1
|
||||
PROG= ${ENTRY}
|
||||
#
|
||||
OBJ= ${PROG}.o
|
||||
DATA= info
|
||||
TARGET= ${PROG}
|
||||
#
|
||||
ALT_OBJ=
|
||||
ALT_TARGET=
|
||||
|
||||
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
|
||||
#################
|
||||
# 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 '<was here>' /\\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"
|
||||
@@ -1,4 +1,4 @@
|
||||
CPP Abuse:
|
||||
# CPP Abuse:
|
||||
|
||||
Jens Schweikhardt
|
||||
DFN Network Operation Center
|
||||
@@ -8,17 +8,16 @@ CPP Abuse:
|
||||
|
||||
http://www.shuttle.de/schweikh/
|
||||
|
||||
## To build:
|
||||
|
||||
Judge's Comments:
|
||||
make all
|
||||
|
||||
To build:
|
||||
|
||||
make schweikh1
|
||||
|
||||
To use:
|
||||
### To run
|
||||
|
||||
./schweikh1
|
||||
|
||||
## Judges' comments
|
||||
|
||||
What does it do? It seems to print a list of system headers, perhaps
|
||||
with words after them. Curiously, if you look at the list of words
|
||||
defined in a given standard header, they are never printed directly
|
||||
@@ -42,14 +41,7 @@ Judge's Comments:
|
||||
will need to frob the source anyway and can be expected to do the
|
||||
right thing with ${CC}. So use gcc.
|
||||
|
||||
NOTE: One may build the original entry, which incorrectly used
|
||||
^K's and ^L's after a # cpp-directive. While this works under
|
||||
gcc, it is not ISO C89. One may build this original entry by:
|
||||
|
||||
make schweikh1.orig
|
||||
|
||||
|
||||
Selected Author's Comments:
|
||||
## Author's comments
|
||||
|
||||
Important! This program, if it compiles at all, is mis-compiled by many
|
||||
compilers due to compiler bugs. It could be the "least likely
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
%:define H(x) <st%:%:x##.h>
|
||||
#include H(dio)
|
||||
#include H(dlib)
|
||||
#include H(ring)
|
||||
/*#include H(dio)*/
|
||||
/*#include H(dlib)*/
|
||||
/*#include H(ring)*/
|
||||
|
||||
#define x ) == 0 ?__LINE__:0){O =__LINE__;break;} }
|
||||
#define X(x) __LINE__ x __LINE__
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
%:defineH(x) <st%:%:x##.h>
|
||||
#includeH(dio)
|
||||
#includeH(dlib)
|
||||
#includeH(ring)
|
||||
|
||||
#definex)==0?__LINE__:0){O=__LINE__;break;}}
|
||||
#defineX(x)__LINE__x__LINE__
|
||||
#definet(a)\
|
||||
for(c=0;c<n##a; ++c) { \
|
||||
if(strchr (a[c], 0[__FILE__])) { if (*a[c] == 0[__FILE__]) { \
|
||||
if (strcmp (a[c]+__LINE__, I + strlen (I) + __LINE__ - strlen (a[c]) x else { \
|
||||
if (strncmp (a[c], I, strlen (a[c])-__LINE__ x \
|
||||
}else { if (strcmp (a[c], I x }
|
||||
|
||||
#line 4 "info\0r"
|
||||
int
|
||||
main (int C, char **V)
|
||||
{
|
||||
FILE *H;
|
||||
int c, ne, nn, S = C < 2 ? 060 : *V[1];
|
||||
|
||||
char f[__LINE__][X(*)], K[X(*)], L[X(<<)],
|
||||
e[X(<<)][3*__LINE__], n[X(<<)][3*__LINE__], F[__LINE__];
|
||||
|
||||
if (freopen (__FILE__, 5+__FILE__, stdin) == 0) return __LINE__-13;
|
||||
for (c = 0;;) {
|
||||
#line 1 "#\n"
|
||||
if (!fgets (f[c], (int)sizeof *f, stdin)) return __LINE__; if (*f[c] == 0[__FILE__]) continue; if (*f[c] != __LINE__[__FILE__]) { f[c][strlen (f[c]) - __LINE__] = 2[__FILE__];
|
||||
++c;
|
||||
} else
|
||||
break;
|
||||
}
|
||||
for (ne = 0;;) {
|
||||
do {
|
||||
#line 1 "#%s%s"
|
||||
if (!fgets (L, (int)sizeof L, stdin)) return __LINE__; } while (*L == 0[__FILE__]); switch (sscanf (L, __LINE__+__FILE__, F, e[ne])) { default: goto O;
|
||||
case __LINE__: switch (strchr (F, S)!=0) case 1: ++ne;
|
||||
}
|
||||
}
|
||||
|
||||
O:
|
||||
nn = 0;
|
||||
while ((fgets (L, (int) sizeof L, stdin)) != 0) {
|
||||
|
||||
|
||||
char A[__LINE__], f3; if (*L == 0[__FILE__]) continue;
|
||||
#line 1 "%s%s %c"
|
||||
switch (sscanf (L, __FILE__, A, n[nn], &f3)) {
|
||||
case __LINE__: if (strchr (A, S)) ++nn; break;
|
||||
case __LINE__:
|
||||
if (strchr (A, S)) {
|
||||
#line 8 "<%s>:\n"
|
||||
char *I = L + __LINE__;
|
||||
int O = printf (__FILE__, n[nn]) +
|
||||
#line 2 "0gcc -ansi -E -dM -undef %s /usr/include/%s>r\0 ("
|
||||
sprintf (K, 1+__FILE__, f[S-*__FILE__] + __LINE__, n[nn]);
|
||||
O += system (K);
|
||||
if ((H = fopen (__FILE__+44, 44+__FILE__)) == 0) return 1;
|
||||
while ((fgets (L, (int)sizeof L, H)) != 0) {
|
||||
I[strcspn (I, 46+__FILE__)] = O = 0;
|
||||
#line 1 "*r"
|
||||
t (n) t (e)
|
||||
if (0 == O) O = puts (L);
|
||||
}
|
||||
nn = fclose (H);
|
||||
}
|
||||
}
|
||||
}
|
||||
return remove (1+__FILE__);
|
||||
}
|
||||
+315
-151
@@ -1,174 +1,338 @@
|
||||
#!/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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#CFLAGS=-O -Xa
|
||||
#CFLAGS=-Xa
|
||||
CFLAGS= -ansi
|
||||
#CFLAGS= -ansi -O
|
||||
#CFLAGS=
|
||||
#CFLAGS= -ansi -L/usr/X11R6/lib
|
||||
# See: http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
# ANSI compiler
|
||||
|
||||
#############################
|
||||
# shell used by this Makefile
|
||||
#############################
|
||||
#
|
||||
# Set CC to the name of your ANSI compiler.
|
||||
SHELL= bash
|
||||
|
||||
#######################
|
||||
# common tool locations
|
||||
#######################
|
||||
#
|
||||
# Some entries seem to need gcc. If you have gcc, set
|
||||
# both CC and MAY_NEED_GCC to gcc.
|
||||
include ../../var.mk
|
||||
|
||||
# Set X11_LIBDIR to the directory where the X11 library resides
|
||||
#
|
||||
# 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.
|
||||
#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 -Wno-sign-compare -Wno-string-plus-int -Wno-switch-bool
|
||||
|
||||
# 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
|
||||
MAY_NEED_GCC= gcc
|
||||
#CC=clang
|
||||
#CC=gcc
|
||||
|
||||
# winners that compile under ANSI C
|
||||
# Compiler add-ons or replacements for clang only
|
||||
#
|
||||
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
|
||||
ifeq ($(CC),clang)
|
||||
#
|
||||
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
|
||||
CSILENCE+= -Wno-poison-system-directories -Wno-unused-macros -Wno-sign-conversion
|
||||
#
|
||||
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 $@
|
||||
|
||||
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
|
||||
CWARN+= -Weverything
|
||||
#
|
||||
chaos_nohalf: chaos_nohalf.c
|
||||
${CC} ${CFLAGS} $? -lcurses -o $@
|
||||
${CP} -f $@ chaos
|
||||
endif
|
||||
|
||||
chaos_nohalf.c: chaos.c
|
||||
${RM} -f $@
|
||||
${SED} -e 's/halfdelay([^)]*);//' < $? > $@
|
||||
# Specific add-ons or replacements for gcc only
|
||||
#
|
||||
ifeq ($(CC),gcc)
|
||||
#
|
||||
#CSILENCE+=
|
||||
#
|
||||
#CWARN+=
|
||||
#
|
||||
endif
|
||||
|
||||
chaos_files: cube.data desk.data ioccc.data pyramid.data xwing.data
|
||||
|
||||
everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES}
|
||||
##############################
|
||||
# Special flags for this entry
|
||||
##############################
|
||||
#
|
||||
ENTRY= schweikh2
|
||||
PROG= ${ENTRY}
|
||||
#
|
||||
OBJ= ${PROG}.o
|
||||
DATA=
|
||||
TARGET= ${PROG} ${PROG}.alt
|
||||
#
|
||||
ALT_OBJ= ${PROG}.alt.o
|
||||
ALT_TARGET= ${PROG}.alt
|
||||
|
||||
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
|
||||
#################
|
||||
# build the entry
|
||||
#################
|
||||
#
|
||||
all: data ${TARGET}
|
||||
@${TRUE}
|
||||
|
||||
install: all
|
||||
${CAT} ${WINNERS} ${ALT_NAMES} > /dev/null
|
||||
.PHONY: all alt data everything clean clobber install \
|
||||
love haste waste maker easter_egg sandwich \
|
||||
supernova deep_magic magic charon pluto
|
||||
|
||||
${PROG}: ${PROG}.c
|
||||
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
||||
|
||||
${PROG}.alt: ${PROG}.alt.c
|
||||
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
||||
|
||||
# alternative executable
|
||||
#
|
||||
alt: data ${ALT_TARGET}
|
||||
@${TRUE}
|
||||
|
||||
# data files
|
||||
#
|
||||
data: ${DATA}
|
||||
@${TRUE}
|
||||
|
||||
# both all and alt
|
||||
#
|
||||
everything: all alt
|
||||
|
||||
|
||||
###############
|
||||
# utility rules
|
||||
###############
|
||||
#
|
||||
clean:
|
||||
${RM} -f ${OBJ} ${ALT_OBJ}
|
||||
@-if [ -f indent.c ]; then \
|
||||
echo ${RM} -f indent.c; \
|
||||
${RM} -f indent.c; \
|
||||
fi
|
||||
|
||||
clobber: clean
|
||||
${RM} -f ${TARGET} ${ALT_TARGET}
|
||||
@-if [ -e sandwich ]; then \
|
||||
${RM} -f sandwich; \
|
||||
echo 'ate sandwich'; \
|
||||
fi
|
||||
|
||||
install:
|
||||
@echo "Dr. Spock says that is not logical!"
|
||||
@${TRUE}
|
||||
|
||||
# you may be able to misunderstand the source by reading indent.c
|
||||
#
|
||||
indent.c: ${PROG}.c
|
||||
@if which "${GINDENT}" >/dev/null 2>&1; then \
|
||||
echo ${RM} -f $@; \
|
||||
${RM} -f $@; \
|
||||
echo "${GINDENT} < $< > $@"; \
|
||||
${GINDENT} < $< > $@; \
|
||||
elif which "${INDENT}" >/dev/null 2>&1; then \
|
||||
echo ${RM} -f $@; \
|
||||
${RM} -f $@; \
|
||||
echo "${INDENT} < $< > $@"; \
|
||||
${INDENT} < $< > $@; \
|
||||
else \
|
||||
echo "no intent tool found, ident $< yourself, sorry"; \
|
||||
echo "exit 1"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
|
||||
##################
|
||||
# 133t hacker rulz
|
||||
##################
|
||||
#
|
||||
love:
|
||||
@echo 'not war?'
|
||||
@${TRUE}
|
||||
|
||||
haste:
|
||||
$(MAKE) waste
|
||||
@${TRUE}
|
||||
|
||||
waste:
|
||||
@echo 'haste'
|
||||
@${TRUE}
|
||||
|
||||
maker:
|
||||
@echo 'Participate in a maker faire'
|
||||
@${TRUE}
|
||||
|
||||
easter_egg:
|
||||
@echo "you expected to often misunderstand this $${RANDOM} magic"
|
||||
@echo "chongo '<was here>' /\\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"
|
||||
+13
-12
@@ -1,4 +1,4 @@
|
||||
Most Erratic Behavior:
|
||||
# Most Erratic Behavior:
|
||||
|
||||
Jens Schweikhardt
|
||||
DFN Network Operation Center
|
||||
@@ -9,15 +9,15 @@ Most Erratic Behavior:
|
||||
http://www.shuttle.de/schweikh/
|
||||
|
||||
|
||||
Judges' comments:
|
||||
## To build:
|
||||
|
||||
To build:
|
||||
make all
|
||||
|
||||
make schweikh2
|
||||
NOTE: Almost every compiler is supposed to be able to accept the code in
|
||||
schweikh2.c; try compiling schweikh2.alt.c to see if your compiler
|
||||
is fully standard-compliant.
|
||||
|
||||
Almost every compiler is supposed to be able to accept the code in
|
||||
schweikh2.c; try compiling schweikh2.orig.c to see if your compiler
|
||||
is fully standard-compliant.
|
||||
### To run
|
||||
|
||||
To use:
|
||||
|
||||
@@ -25,6 +25,8 @@ Judges' comments:
|
||||
or
|
||||
./schweikh2 integer_number
|
||||
|
||||
## Judges' comments
|
||||
|
||||
Run the program with a small argument, like 5 or 10, several times.
|
||||
Are the results different? Why?
|
||||
|
||||
@@ -34,11 +36,11 @@ Judges' comments:
|
||||
At the time this hint file was written, some gcc and egcs
|
||||
implementations ran into problem when building the original entry:
|
||||
|
||||
make schweikh2.orig
|
||||
make schweikh2.alt
|
||||
|
||||
This program often will produce an error of the form:
|
||||
|
||||
gcc -ansi schweikh2.orig.c -o schweikh2.orig
|
||||
gcc -ansi schweikh2.alt.c -o schweikh2.alt
|
||||
as: Error: cca00NzV.s, line 58: Missing " at end of string
|
||||
"
|
||||
as: Error: cca00NzV.s, line 58: malformed statement
|
||||
@@ -61,7 +63,7 @@ Judges' comments:
|
||||
|
||||
In some cases one must compile using 'gcc -g':
|
||||
|
||||
make schweikh2.orig CFLAGS=-g
|
||||
make schweikh2.alt CFLAGS=-g
|
||||
|
||||
to trigger this error.
|
||||
|
||||
@@ -78,8 +80,7 @@ Judges' comments:
|
||||
If you succeed in doing this (especially on FreeBSD, Linux or Sparc),
|
||||
email the author for a free pat on the back.
|
||||
|
||||
|
||||
Selected author's comments:
|
||||
## Author's comments
|
||||
|
||||
What this program does
|
||||
----------------------
|
||||
|
||||
@@ -6,8 +6,8 @@ static volatile sig_atomic_t One;
|
||||
#include<unistd.h>
|
||||
#define Zero(NULL)#NULL
|
||||
#define ONE(One) Zero(One)
|
||||
in??/
|
||||
t
|
||||
int
|
||||
|
||||
??=line 10 ONE(O(1,1,2,6,0,6))
|
||||
main (register zero, char **ONE)
|
||||
%:
|
||||
@@ -6,8 +6,8 @@ static volatile sig_atomic_t One;
|
||||
#include<unistd.h>
|
||||
#define Zero(NULL)#NULL
|
||||
#define ONE(One) Zero(One)
|
||||
in??/
|
||||
t
|
||||
int
|
||||
|
||||
#line 10 "01\015"
|
||||
main (register zero, char **ONE)
|
||||
%:
|
||||
|
||||
+313
-151
@@ -1,174 +1,336 @@
|
||||
#!/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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#CFLAGS=-O -Xa
|
||||
#CFLAGS=-Xa
|
||||
CFLAGS= -ansi
|
||||
#CFLAGS= -ansi -O
|
||||
#CFLAGS=
|
||||
#CFLAGS= -ansi -L/usr/X11R6/lib
|
||||
# See: http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
# ANSI compiler
|
||||
|
||||
#############################
|
||||
# shell used by this Makefile
|
||||
#############################
|
||||
#
|
||||
# Set CC to the name of your ANSI compiler.
|
||||
SHELL= bash
|
||||
|
||||
#######################
|
||||
# common tool locations
|
||||
#######################
|
||||
#
|
||||
# Some entries seem to need gcc. If you have gcc, set
|
||||
# both CC and MAY_NEED_GCC to gcc.
|
||||
include ../../var.mk
|
||||
|
||||
# Set X11_LIBDIR to the directory where the X11 library resides
|
||||
#
|
||||
# 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.
|
||||
#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= -DM0=sizeof -DM1=long -DM2=void \
|
||||
-DM3=realloc -DM4=calloc -DM5=free
|
||||
|
||||
# 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
|
||||
MAY_NEED_GCC= gcc
|
||||
#CC=clang
|
||||
#CC=gcc
|
||||
|
||||
# winners that compile under ANSI C
|
||||
# Compiler add-ons or replacements for clang only
|
||||
#
|
||||
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
|
||||
ifeq ($(CC),clang)
|
||||
#
|
||||
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
|
||||
#CSILENCE+=
|
||||
#
|
||||
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 $@
|
||||
|
||||
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
|
||||
CWARN+= -Weverything
|
||||
#
|
||||
chaos_nohalf: chaos_nohalf.c
|
||||
${CC} ${CFLAGS} $? -lcurses -o $@
|
||||
${CP} -f $@ chaos
|
||||
endif
|
||||
|
||||
chaos_nohalf.c: chaos.c
|
||||
${RM} -f $@
|
||||
${SED} -e 's/halfdelay([^)]*);//' < $? > $@
|
||||
# Specific add-ons or replacements for gcc only
|
||||
#
|
||||
ifeq ($(CC),gcc)
|
||||
#
|
||||
#CSILENCE+=
|
||||
#
|
||||
#CWARN+=
|
||||
#
|
||||
endif
|
||||
|
||||
chaos_files: cube.data desk.data ioccc.data pyramid.data xwing.data
|
||||
|
||||
everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES}
|
||||
##############################
|
||||
# Special flags for this entry
|
||||
##############################
|
||||
#
|
||||
ENTRY= schweikh3
|
||||
PROG= ${ENTRY}
|
||||
#
|
||||
OBJ= ${PROG}.o
|
||||
DATA= samefile.1
|
||||
TARGET= ${PROG}
|
||||
#
|
||||
ALT_OBJ=
|
||||
ALT_TARGET=
|
||||
|
||||
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
|
||||
#################
|
||||
# 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 '<was here>' /\\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"
|
||||
@@ -1,4 +1,4 @@
|
||||
Most Space Efficient:
|
||||
# Most Space Efficient:
|
||||
|
||||
Jens Schweikhardt
|
||||
DFN Network Operation Center
|
||||
@@ -8,14 +8,11 @@ Most Space Efficient:
|
||||
|
||||
http://www.shuttle.de/schweikh/
|
||||
|
||||
## To build:
|
||||
|
||||
Judges' comments:
|
||||
make all
|
||||
|
||||
To build:
|
||||
|
||||
make schweikh3
|
||||
|
||||
To use:
|
||||
### To run
|
||||
|
||||
If "dir" is the directory (or a directory tree) where you keep
|
||||
all your favorite pictures off the Internet or from
|
||||
@@ -23,6 +20,8 @@ Judges' comments:
|
||||
|
||||
find dir -type f -print | ./schweikh3
|
||||
|
||||
## Judges' comments
|
||||
|
||||
Maybe you will not need to buy another 10 Gb disk to store them. :-)
|
||||
|
||||
Also Try:
|
||||
@@ -40,8 +39,7 @@ Judges' comments:
|
||||
NOTE: Some non-gcc compilers that are not fully ANSI standard do
|
||||
not compile this entry correctly.
|
||||
|
||||
|
||||
Selected author's comments:
|
||||
## Author's comments
|
||||
|
||||
The source is expected to conform to IEEE Std 1003.1-1990 ("POSIX").
|
||||
Thank God the IEEE does not standardize a coding style...
|
||||
|
||||
+313
-151
@@ -1,174 +1,336 @@
|
||||
#!/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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#CFLAGS=-O -Xa
|
||||
#CFLAGS=-Xa
|
||||
CFLAGS= -ansi
|
||||
#CFLAGS= -ansi -O
|
||||
#CFLAGS=
|
||||
#CFLAGS= -ansi -L/usr/X11R6/lib
|
||||
# See: http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
# ANSI compiler
|
||||
|
||||
#############################
|
||||
# shell used by this Makefile
|
||||
#############################
|
||||
#
|
||||
# Set CC to the name of your ANSI compiler.
|
||||
SHELL= bash
|
||||
|
||||
#######################
|
||||
# common tool locations
|
||||
#######################
|
||||
#
|
||||
# Some entries seem to need gcc. If you have gcc, set
|
||||
# both CC and MAY_NEED_GCC to gcc.
|
||||
include ../../var.mk
|
||||
|
||||
# Set X11_LIBDIR to the directory where the X11 library resides
|
||||
#
|
||||
# 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.
|
||||
#X11_LIBDIR= /usr/X11R6/lib
|
||||
#X11_LIBDIR= /usr/X11/lib
|
||||
X11_LIBDIR= /opt/X11/lib
|
||||
|
||||
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
|
||||
#
|
||||
#X11_INCDIR= /usr/X11R6/include
|
||||
#X11_INCDIR= /usr/X11/include
|
||||
X11_INCDIR= /opt/X11/include
|
||||
|
||||
# Common C compiler warnings to silence
|
||||
#
|
||||
CSILENCE=
|
||||
#CSILENCE= -Wno-implicit-int
|
||||
|
||||
# Common C compiler warning flags
|
||||
#
|
||||
#CWARN= ${CSILENCE}
|
||||
#CWARN= -Wall ${CSILENCE}
|
||||
#CWARN= -Wall -Wextra ${CSILENCE}
|
||||
CWARN= -Wall -Wextra -pedantic ${CSILENCE}
|
||||
|
||||
# Compiler standard
|
||||
#
|
||||
#CSTD=
|
||||
#CSTD= -ansi
|
||||
CSTD= -std=gnu90
|
||||
|
||||
# Compiler bit architecture
|
||||
#
|
||||
# Some entries require 32-bitness:
|
||||
# ARCH= -m32
|
||||
#
|
||||
# Some entries require 64-bitness:
|
||||
# ARCH= -m64
|
||||
#
|
||||
# By default we assume nothing:
|
||||
#
|
||||
ARCH=
|
||||
|
||||
# Defines that are needed to compile
|
||||
#
|
||||
CDEFINE=
|
||||
#CDEFINE= -DIOCCC
|
||||
|
||||
# Include files that are needed to compile
|
||||
#
|
||||
CINCLUDE=
|
||||
#CINCLUDE= -include stdlib.h
|
||||
#CINCLUDE= -include stdio.h
|
||||
#CINCLUDE= -include stdlib.h -include stdio.h
|
||||
#CINCLUDE= -I ${X11_INCDIR}
|
||||
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
|
||||
|
||||
# Optimization
|
||||
#
|
||||
# Most compiles will safely use -O2. Some can use only -O1 or -O.
|
||||
# A few compilers have broken optimizers or this entry make break
|
||||
# under those buggy optimizers and thus you may not want anything.
|
||||
# Reasonable compilers will allow for -O3.
|
||||
#
|
||||
#OPT=
|
||||
#OPT= -O
|
||||
#OPT= -O1
|
||||
#OPT= -O2
|
||||
OPT= -O3
|
||||
|
||||
# Default flags for ANSI C compilation
|
||||
#
|
||||
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
|
||||
|
||||
# Libraries needed to build
|
||||
#
|
||||
LIBS=
|
||||
#LIBS= -lm
|
||||
#LIBS= -L ${X11_LIBDIR} -lX11
|
||||
#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL
|
||||
|
||||
# C compiler to use
|
||||
#
|
||||
CC= cc
|
||||
MAY_NEED_GCC= gcc
|
||||
#CC=clang
|
||||
#CC=gcc
|
||||
|
||||
# winners that compile under ANSI C
|
||||
# Compiler add-ons or replacements for clang only
|
||||
#
|
||||
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
|
||||
ifeq ($(CC),clang)
|
||||
#
|
||||
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
|
||||
CSILENCE+= -Wno-conditional-uninitialized -Wno-poison-system-directories \
|
||||
-Wno-sign-conversion -Wno-tautological-value-range-compare
|
||||
#
|
||||
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 $@
|
||||
|
||||
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
|
||||
CWARN+= -Weverything
|
||||
#
|
||||
chaos_nohalf: chaos_nohalf.c
|
||||
${CC} ${CFLAGS} $? -lcurses -o $@
|
||||
${CP} -f $@ chaos
|
||||
endif
|
||||
|
||||
chaos_nohalf.c: chaos.c
|
||||
${RM} -f $@
|
||||
${SED} -e 's/halfdelay([^)]*);//' < $? > $@
|
||||
# Specific add-ons or replacements for gcc only
|
||||
#
|
||||
ifeq ($(CC),gcc)
|
||||
#
|
||||
#CSILENCE+=
|
||||
#
|
||||
#CWARN+=
|
||||
#
|
||||
endif
|
||||
|
||||
chaos_files: cube.data desk.data ioccc.data pyramid.data xwing.data
|
||||
|
||||
everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES}
|
||||
##############################
|
||||
# Special flags for this entry
|
||||
##############################
|
||||
#
|
||||
ENTRY= tomtorfs
|
||||
PROG= ${ENTRY}
|
||||
#
|
||||
OBJ= ${PROG}.o
|
||||
DATA=
|
||||
TARGET= ${PROG}
|
||||
#
|
||||
ALT_OBJ=
|
||||
ALT_TARGET=
|
||||
|
||||
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
|
||||
#################
|
||||
# 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 '<was here>' /\\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"
|
||||
@@ -1,4 +1,4 @@
|
||||
Best Self-Documenting:
|
||||
# Best Self-Documenting:
|
||||
|
||||
Tom Torfs
|
||||
De Nayer Instituut
|
||||
@@ -8,17 +8,16 @@ Best Self-Documenting:
|
||||
|
||||
http://members.xoom.com/tomtorfs
|
||||
|
||||
## To build:
|
||||
|
||||
Judges' comments:
|
||||
make all
|
||||
|
||||
To build:
|
||||
|
||||
make tomtorfs
|
||||
|
||||
To use:
|
||||
### To run
|
||||
|
||||
./tomtorfs tomtorfs.c 32 04C11DB7 1 FFFFFFFF FFFFFFFF
|
||||
|
||||
## Judges' comments
|
||||
|
||||
Also try:
|
||||
|
||||
echo "abscond conferrable" > file.A
|
||||
@@ -32,8 +31,7 @@ Judges' comments:
|
||||
of the program with the value of CRC computed by PKZIP or any other
|
||||
archiver that uses the CRC-32 algorithm.
|
||||
|
||||
|
||||
Selected author's comments:
|
||||
## Author's comments
|
||||
|
||||
Usage:
|
||||
crc filename bitwidth polynom reflected init xor
|
||||
|
||||
Reference in new issue
Block a user