fix 1996 Makefiles

This commit is contained in:
Landon Curt Noll committed 2023-02-27 01:44:19 -08:00
1 parent c4f93bf8f4
commit 5e228ea44d
30 files changed
+3597 -1891

No files matched your search

+10 -5
View File
@@ -46,12 +46,17 @@
# See: http://creativecommons.org/licenses/by-sa/3.0/ # See: http://creativecommons.org/licenses/by-sa/3.0/
################ #############################
# tool locations # shell used by this Makefile
################ #############################
# #
SHELL= /bin/bash SHELL= bash
MAKE= make
#######################
# common tool locations
#######################
#
include ../var.mk
############### ###############
+1
View File
@@ -1 +1,2 @@
august august
august.oc
+327 -136
View File
@@ -1,156 +1,347 @@
# %W% %G% %U% #!/usr/bin/env make
# #
# 1996 makefile # IOCCC 1996 winning entry - august
################################################################################
# #
# Copyright (c) 1997, Landon Curt Noll & Sriram Srinivasan # An Historical Makefile NOTE:
# All Rights Reserved. Permission for personal, educational or non-profit #
# use is granted provided this this copyright and notice are included in its # The orig.Makefile, if it exits, is the original Makefile before this IOCCC
# entirety and remains unaltered. All other uses must receive prior permission # year directory was reworked so that entries are in separate directories.
# from Landon Curt Noll and Sriram Srinivasan. # This also applies to any orig.ansi.mk and orig.common.mk files.
#
# Several Makefiles were modified / formed in 2022, and as such it may have
# elements that are not historically compatible with way entries were built.
# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile.
#
# Regarding individual entries:
#
# IOCCC winning entry code may not work on your system. Even with standards,
# conditions and build environments change, especially when it comes to more
# extreme code such you might find in an IOCCC winner. Moreover, what was
# allowed and liked in one IOCCC contest may no longer be liked/allowed in
# later IOCCC years.
#
# Corrections on winning author and fixing typos in remarks are VERY WELCOME.
#
# GitHub pull requests are welcome:
#
# If you have a patch that might make running an entry work in modern Unix-like
# environments, please create a GitHub pull request for the IOCCC judges to
# consider.
#
# Suggestions and corrections regarding Makefiles, winning author information,
# fixing typos in remarks, and code patches are welcome via opening a GitHub
# issue or better yet, by creating a GitHub pull request for the IOCCC judges
# to consider. To form a GitHub issue or GitHub pull, please visit:
#
# https://github.com/ioccc-src/winner
#
################################################################################
# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under:
#
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
#
# See: http://creativecommons.org/licenses/by-sa/3.0/
SHELL=/bin/sh #############################
CAT=cat # shell used by this Makefile
CHMOD=chmod #############################
CP=cp #
GUNZIP=gunzip SHELL= bash
UUDECODE=uudecode
LN=ln
RM=rm
SED=sed
TRUE=true
# flags for ANSI compiles #######################
# common tool locations
#######################
# #
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode, include ../../var.mk
# others such as gcc may want -ansi, others may want nothing
# at all. Adjust the CFLAGS line as needed.
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# incorrectly. You might want to turn on -O to see if your
# compiler can handle them.
#
#CFLAGS=-O -Xa
#CFLAGS=-Xa
#CFLAGS= -ansi
CFLAGS= -ansi -O
#CFLAGS=
# ANSI compiler # Set X11_LIBDIR to the directory where the X11 library resides
# #
# Set CC to the name of your ANSI compiler. #X11_LIBDIR= /usr/X11R6/lib
CC=cc #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-invalid-source-encoding
# 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= -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)'
# Include files that are needed to compile
#
CINCLUDE=
#CINCLUDE= -include stdlib.h
#CINCLUDE= -include stdio.h
#CINCLUDE= -include stdlib.h -include stdio.h
#CINCLUDE= -I ${X11_INCDIR}
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
# Optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
# Reasonable compilers will allow for -O3.
#
#OPT=
#OPT= -O
#OPT= -O1
#OPT= -O2
OPT= -O3
# Default flags for ANSI C compilation
#
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# Libraries needed to build
#
LIBS=
#LIBS= -lm
#LIBS= -L ${X11_LIBDIR} -lX11
#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL
# C compiler to use
#
CC= cc
#CC=clang
#CC=gcc #CC=gcc
# winners that compile under ANSI C # Compiler add-ons or replacements for clang only
# #
WINNERS= august dalbec eldby gandalf huffman jonth rcm schweikh1 \ ifeq ($(CC),clang)
schweikh2 schweikh3 westley
ALT_NAMES= august.orig
LEVEL=5
all: $(WINNERS)
# NOTE: Some compilers will compile this code into infinite loop
# progs. We have found gcc to work on a number of platforms.
# If the following example does not execute in a very
# short time, try a better compiler:
# #
# cat august.c test.oc | ./august > test.oo CSILENCE+= -Wno-conditional-uninitialized -Wno-missing-variable-declarations \
# -Wno-poison-system-directories
august: august.c fac.oc parse.oc test.oc #
${CC} ${CFLAGS} -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \ CWARN+= -Weverything
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ #
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \ endif
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.c -o august # Specific add-ons or replacements for gcc only
#
ifeq ($(CC),gcc)
#
#CSILENCE+=
#
#CWARN+=
#
endif
##############################
# Special flags for this entry
##############################
#
ENTRY= august
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA= fac.oc parse.oc test.oc
TARGET= ${PROG} ${PROG}.oc
#
ALT_OBJ=
ALT_TARGET=
#################
# build the entry
#################
#
all: data ${TARGET}
@${TRUE}
.PHONY: all alt data everything clean clobber install \
love haste waste maker easter_egg sandwich \
supernova deep_magic magic charon pluto
${PROG}: ${PROG}.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
${CHMOD} +r fac.oc parse.oc test.oc ${CHMOD} +r fac.oc parse.oc test.oc
# This forms a byte code execution engine written in OC # This forms a byte code execution engine written in OC
# #
august.oc: august.c ${PROG}.oc: ${PROG}.c
${RM} -f august.oc ${RM} -f $@
${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \ ${CC} ${CFLAGS} -E $< -o $@ ${LIBS} > $@
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ ${CHMOD} +r $@
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.c > august.oc
${CHMOD} +r august.oc
# NOTE: this is the original source that won # alternative executable
# #
august.orig: august.orig.c fac.oc parse.oc test.oc alt: data ${ALT_TARGET}
${CC} ${CFLAGS} -DZ=60000 -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.orig.c -o august.orig
${RM} -f august.oc
${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.orig.c > august.oc
${CHMOD} +r fac.oc parse.oc test.oc august.oc
dalbec: dalbec.c
${CC} ${CFLAGS} dalbec.c -o dalbec
eldby: eldby.c
${CC} ${CFLAGS} eldby.c -o eldby
gandalf: gandalf.c
${CC} ${CFLAGS} gandalf.c -o gandalf
${RM} -f hatcat cathat
${CP} gandalf hatcat
${CP} gandalf cathat
huffman: huffman.c
${CC} ${CFLAGS} huffman.c -o huffman
# Add -I${X}/include and -L${X}/lib if this doesn't build
# (X is the root of the X Window distribution)
# Solaris users add -lsocket
#
jonth: jonth.c
${CC} ${CFLAGS} jonth.c -o jonth -lX11 -lm
rcm: rcm.c
${CC} ${CFLAGS} -DJ='if(' -Ds='else J O==' -DU='B(' \
-DX='for(' -DH='unsigned' -Dn='struct x' -DA='0,0,0,0,' \
-DT='<stdio.h>' -DY='<stdlib.h>' -DR='malloc(sizeof(n))' \
-DM='%=K' -DK=32768 -DD='getchar()' -DN=putchar rcm.c -o rcm
schweikh1: schweikh1.c errno.h
${CC} ${CFLAGS} -I. schweikh1.c -o schweikh1
schweikh2: schweikh2.c hunni.c hunni.pl
${CC} ${CFLAGS} -D_POSIX_SOURCE schweikh2.c -o schweikh2
# NOTE: On some systems such as SunOS, one may need to compile with:
#
# ${CC} ${CFLAGS} \
# -I. -D_POSIX_SOURCE '-Ddifftime(a,b)=(double)(b-a)' \
# schweikh3.c -o schweikh3
#
schweikh3: schweikh3.c iso646.h
${CC} ${CFLAGS} -I. -D_POSIX_SOURCE schweikh3.c -o schweikh3
westley: westley.c clock1 clock2 clock3
${CC} ${CFLAGS} westley.c -o westley
${CHMOD} +x clock1 clock2 clock3
clean:
${RM} -f *.o a.out core ${WINNERS}
clobber: clean
${RM} -f $(WINNERS)
${RM} -f $(ALT_NAMES)
${RM} -f fac.oo parse.oo test.oo hatcat cathat august.oc
nuke: clobber
@${TRUE} @${TRUE}
install: all # data files
${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null #
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"
+11 -9
View File
@@ -1,4 +1,4 @@
Best of Show: # Best of Show:
Lennart Augustsson Lennart Augustsson
CR&T CR&T
@@ -6,17 +6,20 @@ Best of Show:
S-411 21 Goteborg S-411 21 Goteborg
Sweden Sweden
## To build:
Judges' comments: make all
### To run
To use:
make august
cat august.c test.oc | ./august > test.oo cat august.c test.oc | ./august > test.oo
./august < test.oo ./august < test.oo
NOTE: Some compilers will compile this code into infinite loops! NOTE: Some compilers will compile this code into infinite loops!
If the above cat line does not execute in a very short amount If the above cat line does not execute in a very short amount
of time, then you may need to fix your compiler or use gcc. of time, then you may need to fix your compiler or use gcc.
## Judges' comments
Try: Try:
cat august.c fac.oc | ./august > fac.oo cat august.c fac.oc | ./august > fac.oo
@@ -56,8 +59,7 @@ Judges' comments:
entry as it surely will make the 'best of the IOCCC' list. It was entry as it surely will make the 'best of the IOCCC' list. It was
very well received by those who attended the IOCCC BOF. very well received by those who attended the IOCCC BOF.
## Author's comments
Selected notes from the author:
This program is a bytecode interpreter. This fact is not This program is a bytecode interpreter. This fact is not
particularly obfuscated; any experienced C programmer can see that particularly obfuscated; any experienced C programmer can see that
-321
View File
@@ -1,321 +0,0 @@
/*T } ¶ ;
ˆ
;

;
}
{ 
{ ;  ;
; 1 {
è { !
} {
; é ;
;
{

{ ]- } ; ; |
í ; Q
;
´ë ; ; ; "û }
} Ü; ; -ýl
}
} t dÀ ;
; +
t2 { ì ;
} 1; C
i
; = } ; ;

;
ì ; {
{ ê
} { � { ï } }
; . {
␍ { é } } ; 
{ ;
; /nÈ; 5
} ; Ú␍{ ; 
; { 1 ; } ; ¨ý } {
;  { ; . { ;  } ;  ;
; T ;
{
; ; Ä; ;  {
;
 { { ; ;
ì; ‘ ; ; ï; n!t }
; ì!; G; t;  ø; ¤ }  ;
;
} ; "; è# }
; 
{
; �$ {
;
; &
; d˜
{
¶;  {
; Sé'
{ d; ; è); �c
{
;  ;
; &ï*; ␍ ;
— {
;
$; ¢; ,; ; $ˆd } —; ˆ; ë/Î; Î
; a; Í ; {
} ; j; #è1;
 }
; Ä ; { ê5a; û␍ Ät { ï4a }
}
; £ ;
Û2; -
; 8
} ; }
; è8; ;  Ú6Q ; aÌ { ;  { ˆ
ì }
†; v:
{
?
}
{ ?
{ ; 4r
;
; v=b; Û
;
;
} ; 
; ; ; Þ { ú>
} }
{  ;
{ Õ`
}
;
;
!;
; 1; ; >; Ì } 1; X
; } p ;
;
; ; ; 
; ; 2 } ; vm
2; ;1íJ
;
; ; Ï }
; ÉJc; ›; d }
} ÞG; i }
; ; §F
{ vl¶þV; z
n
¶éOc; s
; ; ÑÞ;
 uh¶ëR } hRs; A cl,;
; ; Z;  {
x
lw¶êUch�{  }
} ; àîVc }
; Ž; >ÈD
; G ; ; †
;
îX; ’ˆ
;
; 2 }  { é[; 
{  }
; Þj; å; ë_; ␍y
; D; T; ; ?j; .n; ; ã {
; Ú]; !; Ë; 0a
} J ;
; ^; .
{ { { îc; ␍X ; ; ´;
J {
; ;
 } — { êf; 
; {
; ; : } { 
{
; (h} ␍ }
{  }
} ; ; { 
; ûD; Tì Cr; ␍; I; WèsÎWQ
; ;
×; W { û }
; ( ; ; }
} ;  {
; ÿn{ k; © ; ‚; ?; %Ùk;  ;
{ ïv;
3{ (; h {
; ; z
; ; ]{ ; ˜ïx; S; { * } ˜; z} ; î; 
{ ; ~
;
U; ö
; { ‡
; í~;
Ob } ; ò; UU; U{ -{ %Ú|1èƒ;
; Q
;
µ{ w{ š;  ;
 { í‡; ‚; ü�
…
} Ù†; ?; u
{
ƒ
} } ; » ; ´ ; ;  }
; è
{
; ;  }
; p ; ; ; Q; Ü�{ ; ; K; $ì“
p; 1}
4; $;
2Q ; }  {
; $î— } ; #;
T; 1
; ; +; ± } 
; ;
. ; { 
{ ; š{
  ;
{
; ;  }
; { [ { ; £{ ; �; 0{ 
{ ôr ; éŸ
;
} =; w
?; ;
ä; B®lwx
; h�h
} ; pj
; ; ; ö { û§; 'n
; ; { ) {
; ú¤;
;
Q
; f; 'r
{
? { ë¬; %lÂf}
; ~©{ qÛ¨; 
{
 { ÿ­; ÂÛ¬{ œÚžl,u
; & ;
{ í; G } 
; k
;  }
; 
{
; hR; ; Wß´; 
} ;
; ; —e; Z; ž{ N; =
} ; <
{ ]- Bšretur; ¡if
else
whil; do; nt
char
{ ; { pu{  }
{ ; =
} B
} {
; ø¿`ˆ; dÀ; ´ } �
} } ; ø`; waÌ { •ma; >
{ ; oJ
} ÈD
{  ; ; ; · ;

; Á ; ; ;  ; ; 
{ 
; ; €Õ; @ë ; Á; L {
; ØÈ ;
*/int m[Z];
#define U(x)s--;T=x
#define C(l,s)I(o==l){s;}E
#define Q(l,o)C(l,r=P;T=T o r)
#define O(l,o)C(l,T=o T)
#define H(l,s)C(l,U(s))
int
main(){int*q,s,f,r,o,l,p,c,b;
char*d;
d=" \t\n;{}\0AÊP€³²‰Š@ɵ�gEÏͱ°Œ0�Ž‹q";
b=256;
q=m;
g;
o=g;
c=g;
c=c+g*b;
p=c;
I(o){W(p){o=g;
C(59,r=2)C('{',r=5)C('}',r=8)r=0;
I(r){r=r+g%4;
l=1-g-r;
W(r--){*q=q[l];
q++;
p--;
}}E{I((o==32)+(o==9)+(o==10)){r=g;
o=o%4+(r+(r==123))%8*3;
I(8<o)o=o+g%4*9;
o=d[o]+b;
}*q++=o%b;
p--;
}}W(g!=12);
g;
}E{W(p--)*q++=g;
}s=Z;
p=0;
W(1){o=L;
O(17,!)O(18,-)Q(12,+)D C(10,r=T;
s=f;
p=X 1];
f=X 2];
l=X 3];
R)C(22,s++)C(27,return T)C(21,r=T;
U(r))C(23,T=m[T])C(19,T=m[T]++)C(25,T=m[T]--){l=o%16;
o=o/16;
I(l==7){l=B;
l=l+B*b;
}E I(7<l)l=l+B*8-1;
H(2,f+l)H(4,f-l-4)H(3,m[f+l])H(5,m[f-l-4])H(6,c+l)H(7,m[c+l])H(12,l)H(8,l)C(9,U(p);
p=p+l)C(11,r=X-l/2];
I(r<3){I(r)r=putchar(T);
E
r=g;
R;
}E{X 1]=p;
X 2]=f;
X 3]=l;
f=s;
s=s-19;
p=r;
})C(13,p=l)C(15,I(P)p=l)C(14,I(!P)p=l);
}}}
+313 -133
View File
@@ -1,156 +1,336 @@
# %W% %G% %U% #!/usr/bin/env make
# #
# 1996 makefile # IOCCC 1996 winning entry - dalbec
################################################################################
# #
# Copyright (c) 1997, Landon Curt Noll & Sriram Srinivasan # An Historical Makefile NOTE:
# All Rights Reserved. Permission for personal, educational or non-profit #
# use is granted provided this this copyright and notice are included in its # The orig.Makefile, if it exits, is the original Makefile before this IOCCC
# entirety and remains unaltered. All other uses must receive prior permission # year directory was reworked so that entries are in separate directories.
# from Landon Curt Noll and Sriram Srinivasan. # This also applies to any orig.ansi.mk and orig.common.mk files.
#
# Several Makefiles were modified / formed in 2022, and as such it may have
# elements that are not historically compatible with way entries were built.
# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile.
#
# Regarding individual entries:
#
# IOCCC winning entry code may not work on your system. Even with standards,
# conditions and build environments change, especially when it comes to more
# extreme code such you might find in an IOCCC winner. Moreover, what was
# allowed and liked in one IOCCC contest may no longer be liked/allowed in
# later IOCCC years.
#
# Corrections on winning author and fixing typos in remarks are VERY WELCOME.
#
# GitHub pull requests are welcome:
#
# If you have a patch that might make running an entry work in modern Unix-like
# environments, please create a GitHub pull request for the IOCCC judges to
# consider.
#
# Suggestions and corrections regarding Makefiles, winning author information,
# fixing typos in remarks, and code patches are welcome via opening a GitHub
# issue or better yet, by creating a GitHub pull request for the IOCCC judges
# to consider. To form a GitHub issue or GitHub pull, please visit:
#
# https://github.com/ioccc-src/winner
#
################################################################################
# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under:
#
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
#
# See: http://creativecommons.org/licenses/by-sa/3.0/
SHELL=/bin/sh #############################
CAT=cat # shell used by this Makefile
CHMOD=chmod #############################
CP=cp #
GUNZIP=gunzip SHELL= bash
UUDECODE=uudecode
LN=ln
RM=rm
SED=sed
TRUE=true
# flags for ANSI compiles #######################
# common tool locations
#######################
# #
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode, include ../../var.mk
# others such as gcc may want -ansi, others may want nothing
# at all. Adjust the CFLAGS line as needed.
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# incorrectly. You might want to turn on -O to see if your
# compiler can handle them.
#
#CFLAGS=-O -Xa
#CFLAGS=-Xa
#CFLAGS= -ansi
CFLAGS= -ansi -O
#CFLAGS=
# ANSI compiler # Set X11_LIBDIR to the directory where the X11 library resides
# #
# Set CC to the name of your ANSI compiler. #X11_LIBDIR= /usr/X11R6/lib
CC=cc #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-logical-not-parentheses
# Common C compiler warning flags
#
#CWARN= ${CSILENCE}
#CWARN= -Wall ${CSILENCE}
#CWARN= -Wall -Wextra ${CSILENCE}
CWARN= -Wall -Wextra -pedantic ${CSILENCE}
# Compiler standard
#
#CSTD=
#CSTD= -ansi
CSTD= -std=gnu90
# Compiler bit architecture
#
# Some entries require 32-bitness:
# ARCH= -m32
#
# Some entries require 64-bitness:
# ARCH= -m64
#
# By default we assume nothing:
#
ARCH=
# Defines that are needed to compile
#
CDEFINE=
#CDEFINE= -DIOCCC
# Include files that are needed to compile
#
CINCLUDE=
#CINCLUDE= -include stdlib.h
#CINCLUDE= -include stdio.h
#CINCLUDE= -include stdlib.h -include stdio.h
#CINCLUDE= -I ${X11_INCDIR}
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
# Optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
# Reasonable compilers will allow for -O3.
#
#OPT=
#OPT= -O
#OPT= -O1
#OPT= -O2
OPT= -O3
# Default flags for ANSI C compilation
#
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# Libraries needed to build
#
LIBS=
#LIBS= -lm
#LIBS= -L ${X11_LIBDIR} -lX11
#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL
# C compiler to use
#
CC= cc
#CC=clang
#CC=gcc #CC=gcc
# winners that compile under ANSI C # Compiler add-ons or replacements for clang only
# #
WINNERS= august dalbec eldby gandalf huffman jonth rcm schweikh1 \ ifeq ($(CC),clang)
schweikh2 schweikh3 westley
ALT_NAMES= august.orig
LEVEL=5
all: $(WINNERS)
# NOTE: Some compilers will compile this code into infinite loop
# progs. We have found gcc to work on a number of platforms.
# If the following example does not execute in a very
# short time, try a better compiler:
# #
# cat august.c test.oc | ./august > test.oo CSILENCE+= -Wno-poison-system-directories
#
august: august.c fac.oc parse.oc test.oc
${CC} ${CFLAGS} -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.c -o august
${CHMOD} +r fac.oc parse.oc test.oc
# This forms a byte code execution engine written in OC
# #
august.oc: august.c CWARN+= -Weverything
${RM} -f august.oc
${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.c > august.oc
${CHMOD} +r august.oc
# NOTE: this is the original source that won
# #
august.orig: august.orig.c fac.oc parse.oc test.oc endif
${CC} ${CFLAGS} -DZ=60000 -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.orig.c -o august.orig
${RM} -f august.oc
${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.orig.c > august.oc
${CHMOD} +r fac.oc parse.oc test.oc august.oc
dalbec: dalbec.c # Specific add-ons or replacements for gcc only
${CC} ${CFLAGS} dalbec.c -o dalbec
eldby: eldby.c
${CC} ${CFLAGS} eldby.c -o eldby
gandalf: gandalf.c
${CC} ${CFLAGS} gandalf.c -o gandalf
${RM} -f hatcat cathat
${CP} gandalf hatcat
${CP} gandalf cathat
huffman: huffman.c
${CC} ${CFLAGS} huffman.c -o huffman
# Add -I${X}/include and -L${X}/lib if this doesn't build
# (X is the root of the X Window distribution)
# Solaris users add -lsocket
# #
jonth: jonth.c ifeq ($(CC),gcc)
${CC} ${CFLAGS} jonth.c -o jonth -lX11 -lm
rcm: rcm.c
${CC} ${CFLAGS} -DJ='if(' -Ds='else J O==' -DU='B(' \
-DX='for(' -DH='unsigned' -Dn='struct x' -DA='0,0,0,0,' \
-DT='<stdio.h>' -DY='<stdlib.h>' -DR='malloc(sizeof(n))' \
-DM='%=K' -DK=32768 -DD='getchar()' -DN=putchar rcm.c -o rcm
schweikh1: schweikh1.c errno.h
${CC} ${CFLAGS} -I. schweikh1.c -o schweikh1
schweikh2: schweikh2.c hunni.c hunni.pl
${CC} ${CFLAGS} -D_POSIX_SOURCE schweikh2.c -o schweikh2
# NOTE: On some systems such as SunOS, one may need to compile with:
# #
# ${CC} ${CFLAGS} \ #CSILENCE+=
# -I. -D_POSIX_SOURCE '-Ddifftime(a,b)=(double)(b-a)' \ #
# schweikh3.c -o schweikh3 #CWARN+=
# #
schweikh3: schweikh3.c iso646.h endif
${CC} ${CFLAGS} -I. -D_POSIX_SOURCE schweikh3.c -o schweikh3
westley: westley.c clock1 clock2 clock3
${CC} ${CFLAGS} westley.c -o westley
${CHMOD} +x clock1 clock2 clock3
clean: ##############################
${RM} -f *.o a.out core ${WINNERS} # Special flags for this entry
##############################
#
ENTRY= dalbec
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
ALT_OBJ=
ALT_TARGET=
clobber: clean
${RM} -f $(WINNERS)
${RM} -f $(ALT_NAMES)
${RM} -f fac.oo parse.oo test.oo hatcat cathat august.oc
nuke: clobber #################
# build the entry
#################
#
all: data ${TARGET}
@${TRUE} @${TRUE}
install: all .PHONY: all alt data everything clean clobber install \
${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null love haste waste maker easter_egg sandwich \
supernova deep_magic magic charon pluto
${PROG}: ${PROG}.c
@echo "NOTE: This entry uses non-standard args to main() that do not work with modern compilers."
${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"
+10 -6
View File
@@ -1,4 +1,4 @@
Best Numerical Obfuscation: # Best Numerical Obfuscation:
John Dalbec John Dalbec
20 Squire's Ct. (home address) 20 Squire's Ct. (home address)
@@ -7,13 +7,18 @@ Best Numerical Obfuscation:
http://www.math.yale.edu/pub/users/dalbec/ http://www.math.yale.edu/pub/users/dalbec/
## To build:
Judges' comments: make all
NOTE: This entry uses non-standard args to main() that do not work with modern compilers.
### To run
To use:
make dalbec
./dalbec ./dalbec
## Judges' comments
The output is mis-leading ... why does it also print 2047? The output is mis-leading ... why does it also print 2047?
Also try: Also try:
@@ -32,8 +37,7 @@ Judges' comments:
how this program works. The source is small enough to make the effort how this program works. The source is small enough to make the effort
reasonable, and complex enough to make it interesting. reasonable, and complex enough to make it interesting.
## Author's comments
Selected notes from the author:
This program assumes that your terminal wraps lines automatically. This program assumes that your terminal wraps lines automatically.
If this is not the case, you may need to change the space in the If this is not the case, you may need to change the space in the
+315 -133
View File
@@ -1,156 +1,338 @@
# %W% %G% %U% #!/usr/bin/env make
# #
# 1996 makefile # IOCCC 1996 winning entry - eldby
################################################################################
# #
# Copyright (c) 1997, Landon Curt Noll & Sriram Srinivasan # An Historical Makefile NOTE:
# All Rights Reserved. Permission for personal, educational or non-profit #
# use is granted provided this this copyright and notice are included in its # The orig.Makefile, if it exits, is the original Makefile before this IOCCC
# entirety and remains unaltered. All other uses must receive prior permission # year directory was reworked so that entries are in separate directories.
# from Landon Curt Noll and Sriram Srinivasan. # This also applies to any orig.ansi.mk and orig.common.mk files.
#
# Several Makefiles were modified / formed in 2022, and as such it may have
# elements that are not historically compatible with way entries were built.
# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile.
#
# Regarding individual entries:
#
# IOCCC winning entry code may not work on your system. Even with standards,
# conditions and build environments change, especially when it comes to more
# extreme code such you might find in an IOCCC winner. Moreover, what was
# allowed and liked in one IOCCC contest may no longer be liked/allowed in
# later IOCCC years.
#
# Corrections on winning author and fixing typos in remarks are VERY WELCOME.
#
# GitHub pull requests are welcome:
#
# If you have a patch that might make running an entry work in modern Unix-like
# environments, please create a GitHub pull request for the IOCCC judges to
# consider.
#
# Suggestions and corrections regarding Makefiles, winning author information,
# fixing typos in remarks, and code patches are welcome via opening a GitHub
# issue or better yet, by creating a GitHub pull request for the IOCCC judges
# to consider. To form a GitHub issue or GitHub pull, please visit:
#
# https://github.com/ioccc-src/winner
#
################################################################################
# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under:
#
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
#
# See: http://creativecommons.org/licenses/by-sa/3.0/
SHELL=/bin/sh #############################
CAT=cat # shell used by this Makefile
CHMOD=chmod #############################
CP=cp #
GUNZIP=gunzip SHELL= bash
UUDECODE=uudecode
LN=ln
RM=rm
SED=sed
TRUE=true
# flags for ANSI compiles #######################
# common tool locations
#######################
# #
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode, include ../../var.mk
# others such as gcc may want -ansi, others may want nothing
# at all. Adjust the CFLAGS line as needed.
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# incorrectly. You might want to turn on -O to see if your
# compiler can handle them.
#
#CFLAGS=-O -Xa
#CFLAGS=-Xa
#CFLAGS= -ansi
CFLAGS= -ansi -O
#CFLAGS=
# ANSI compiler # Set X11_LIBDIR to the directory where the X11 library resides
# #
# Set CC to the name of your ANSI compiler. #X11_LIBDIR= /usr/X11R6/lib
CC=cc #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-return-type -Wno-unsequenced
# Common C compiler warning flags
#
#CWARN= ${CSILENCE}
#CWARN= -Wall ${CSILENCE}
#CWARN= -Wall -Wextra ${CSILENCE}
CWARN= -Wall -Wextra -pedantic ${CSILENCE}
# Compiler standard
#
#CSTD=
#CSTD= -ansi
CSTD= -std=gnu90
# Compiler bit architecture
#
# Some entries require 32-bitness:
# ARCH= -m32
#
# Some entries require 64-bitness:
# ARCH= -m64
#
# By default we assume nothing:
#
ARCH=
# Defines that are needed to compile
#
CDEFINE=
#CDEFINE= -DIOCCC
# Include files that are needed to compile
#
CINCLUDE=
#CINCLUDE= -include stdlib.h
#CINCLUDE= -include stdio.h
#CINCLUDE= -include stdlib.h -include stdio.h
#CINCLUDE= -I ${X11_INCDIR}
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
# Optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
# Reasonable compilers will allow for -O3.
#
#OPT=
#OPT= -O
#OPT= -O1
#OPT= -O2
OPT= -O3
# Default flags for ANSI C compilation
#
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# Libraries needed to build
#
LIBS=
#LIBS= -lm
#LIBS= -L ${X11_LIBDIR} -lX11
#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL
# C compiler to use
#
CC= cc
#CC=clang
#CC=gcc #CC=gcc
# winners that compile under ANSI C # Compiler add-ons or replacements for clang only
# #
WINNERS= august dalbec eldby gandalf huffman jonth rcm schweikh1 \ ifeq ($(CC),clang)
schweikh2 schweikh3 westley
ALT_NAMES= august.orig
LEVEL=5
all: $(WINNERS)
# NOTE: Some compilers will compile this code into infinite loop
# progs. We have found gcc to work on a number of platforms.
# If the following example does not execute in a very
# short time, try a better compiler:
# #
# cat august.c test.oc | ./august > test.oo CSILENCE+= -Wno-double-promotion -Wno-float-conversion -Wno-implicit-float-conversion \
# -Wno-missing-prototypes -Wno-missing-variable-declarations \
august: august.c fac.oc parse.oc test.oc -Wno-poison-system-directories -Wno-strict-prototypes
${CC} ${CFLAGS} -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.c -o august
${CHMOD} +r fac.oc parse.oc test.oc
# This forms a byte code execution engine written in OC
# #
august.oc: august.c CWARN+= -Weverything
${RM} -f august.oc
${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.c > august.oc
${CHMOD} +r august.oc
# NOTE: this is the original source that won
# #
august.orig: august.orig.c fac.oc parse.oc test.oc endif
${CC} ${CFLAGS} -DZ=60000 -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.orig.c -o august.orig
${RM} -f august.oc
${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.orig.c > august.oc
${CHMOD} +r fac.oc parse.oc test.oc august.oc
dalbec: dalbec.c # Specific add-ons or replacements for gcc only
${CC} ${CFLAGS} dalbec.c -o dalbec
eldby: eldby.c
${CC} ${CFLAGS} eldby.c -o eldby
gandalf: gandalf.c
${CC} ${CFLAGS} gandalf.c -o gandalf
${RM} -f hatcat cathat
${CP} gandalf hatcat
${CP} gandalf cathat
huffman: huffman.c
${CC} ${CFLAGS} huffman.c -o huffman
# Add -I${X}/include and -L${X}/lib if this doesn't build
# (X is the root of the X Window distribution)
# Solaris users add -lsocket
# #
jonth: jonth.c ifeq ($(CC),gcc)
${CC} ${CFLAGS} jonth.c -o jonth -lX11 -lm
rcm: rcm.c
${CC} ${CFLAGS} -DJ='if(' -Ds='else J O==' -DU='B(' \
-DX='for(' -DH='unsigned' -Dn='struct x' -DA='0,0,0,0,' \
-DT='<stdio.h>' -DY='<stdlib.h>' -DR='malloc(sizeof(n))' \
-DM='%=K' -DK=32768 -DD='getchar()' -DN=putchar rcm.c -o rcm
schweikh1: schweikh1.c errno.h
${CC} ${CFLAGS} -I. schweikh1.c -o schweikh1
schweikh2: schweikh2.c hunni.c hunni.pl
${CC} ${CFLAGS} -D_POSIX_SOURCE schweikh2.c -o schweikh2
# NOTE: On some systems such as SunOS, one may need to compile with:
# #
# ${CC} ${CFLAGS} \ #CSILENCE+=
# -I. -D_POSIX_SOURCE '-Ddifftime(a,b)=(double)(b-a)' \ #
# schweikh3.c -o schweikh3 #CWARN+=
# #
schweikh3: schweikh3.c iso646.h endif
${CC} ${CFLAGS} -I. -D_POSIX_SOURCE schweikh3.c -o schweikh3
westley: westley.c clock1 clock2 clock3
${CC} ${CFLAGS} westley.c -o westley
${CHMOD} +x clock1 clock2 clock3
clean: ##############################
${RM} -f *.o a.out core ${WINNERS} # Special flags for this entry
##############################
#
ENTRY= eldby
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
ALT_OBJ=
ALT_TARGET=
clobber: clean
${RM} -f $(WINNERS)
${RM} -f $(ALT_NAMES)
${RM} -f fac.oo parse.oo test.oo hatcat cathat august.oc
nuke: clobber #################
# build the entry
#################
#
all: data ${TARGET}
@${TRUE} @${TRUE}
install: all .PHONY: all alt data everything clean clobber install \
${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null 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 -6
View File
@@ -1,4 +1,4 @@
Best Output: # Best Output:
Thor AAge Eldby Thor AAge Eldby
European Technology Partner European Technology Partner
@@ -6,18 +6,20 @@ Best Output:
0955 OSLO 0955 OSLO
Norway Norway
## To build:
Judges' comments: make all
### To run
To use:
make eldby
./eldby ./eldby
## Judges' comments
We were impressed by the author's ability to render spheres in 3D We were impressed by the author's ability to render spheres in 3D
in a very small chunk of code. in a very small chunk of code.
## Author's comments
Selected notes from the author:
This program shows flying spheres. The program eats CPU on lesser This program shows flying spheres. The program eats CPU on lesser
equipt systems. The program will run until termination. Terminal equipt systems. The program will run until termination. Terminal
+2
View File
@@ -1 +1,3 @@
cathat
gandalf gandalf
hatcat
+323 -133
View File
@@ -1,156 +1,346 @@
# %W% %G% %U% #!/usr/bin/env make
# #
# 1996 makefile # IOCCC 1996 winning entry - gandalf
################################################################################
# #
# Copyright (c) 1997, Landon Curt Noll & Sriram Srinivasan # An Historical Makefile NOTE:
# All Rights Reserved. Permission for personal, educational or non-profit #
# use is granted provided this this copyright and notice are included in its # The orig.Makefile, if it exits, is the original Makefile before this IOCCC
# entirety and remains unaltered. All other uses must receive prior permission # year directory was reworked so that entries are in separate directories.
# from Landon Curt Noll and Sriram Srinivasan. # This also applies to any orig.ansi.mk and orig.common.mk files.
#
# Several Makefiles were modified / formed in 2022, and as such it may have
# elements that are not historically compatible with way entries were built.
# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile.
#
# Regarding individual entries:
#
# IOCCC winning entry code may not work on your system. Even with standards,
# conditions and build environments change, especially when it comes to more
# extreme code such you might find in an IOCCC winner. Moreover, what was
# allowed and liked in one IOCCC contest may no longer be liked/allowed in
# later IOCCC years.
#
# Corrections on winning author and fixing typos in remarks are VERY WELCOME.
#
# GitHub pull requests are welcome:
#
# If you have a patch that might make running an entry work in modern Unix-like
# environments, please create a GitHub pull request for the IOCCC judges to
# consider.
#
# Suggestions and corrections regarding Makefiles, winning author information,
# fixing typos in remarks, and code patches are welcome via opening a GitHub
# issue or better yet, by creating a GitHub pull request for the IOCCC judges
# to consider. To form a GitHub issue or GitHub pull, please visit:
#
# https://github.com/ioccc-src/winner
#
################################################################################
# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under:
#
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
#
# See: http://creativecommons.org/licenses/by-sa/3.0/
SHELL=/bin/sh #############################
CAT=cat # shell used by this Makefile
CHMOD=chmod #############################
CP=cp #
GUNZIP=gunzip SHELL= bash
UUDECODE=uudecode
LN=ln
RM=rm
SED=sed
TRUE=true
# flags for ANSI compiles #######################
# common tool locations
#######################
# #
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode, include ../../var.mk
# others such as gcc may want -ansi, others may want nothing
# at all. Adjust the CFLAGS line as needed.
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# incorrectly. You might want to turn on -O to see if your
# compiler can handle them.
#
#CFLAGS=-O -Xa
#CFLAGS=-Xa
#CFLAGS= -ansi
CFLAGS= -ansi -O
#CFLAGS=
# ANSI compiler # Set X11_LIBDIR to the directory where the X11 library resides
# #
# Set CC to the name of your ANSI compiler. #X11_LIBDIR= /usr/X11R6/lib
CC=cc #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-keyword-macro \
-Wno-shift-op-parentheses -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
#CC=clang
#CC=gcc #CC=gcc
# winners that compile under ANSI C # Compiler add-ons or replacements for clang only
# #
WINNERS= august dalbec eldby gandalf huffman jonth rcm schweikh1 \ ifeq ($(CC),clang)
schweikh2 schweikh3 westley
ALT_NAMES= august.orig
LEVEL=5
all: $(WINNERS)
# NOTE: Some compilers will compile this code into infinite loop
# progs. We have found gcc to work on a number of platforms.
# If the following example does not execute in a very
# short time, try a better compiler:
# #
# cat august.c test.oc | ./august > test.oo CSILENCE+= -Wno-missing-prototypes -Wno-missing-variable-declarations \
# -Wno-poison-system-directories -Wno-strict-prototypes
august: august.c fac.oc parse.oc test.oc
${CC} ${CFLAGS} -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.c -o august
${CHMOD} +r fac.oc parse.oc test.oc
# This forms a byte code execution engine written in OC
# #
august.oc: august.c CWARN+= -Weverything
${RM} -f august.oc
${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.c > august.oc
${CHMOD} +r august.oc
# NOTE: this is the original source that won
# #
august.orig: august.orig.c fac.oc parse.oc test.oc endif
${CC} ${CFLAGS} -DZ=60000 -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.orig.c -o august.orig
${RM} -f august.oc
${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.orig.c > august.oc
${CHMOD} +r fac.oc parse.oc test.oc august.oc
dalbec: dalbec.c # Specific add-ons or replacements for gcc only
${CC} ${CFLAGS} dalbec.c -o dalbec
eldby: eldby.c
${CC} ${CFLAGS} eldby.c -o eldby
gandalf: gandalf.c
${CC} ${CFLAGS} gandalf.c -o gandalf
${RM} -f hatcat cathat
${CP} gandalf hatcat
${CP} gandalf cathat
huffman: huffman.c
${CC} ${CFLAGS} huffman.c -o huffman
# Add -I${X}/include and -L${X}/lib if this doesn't build
# (X is the root of the X Window distribution)
# Solaris users add -lsocket
# #
jonth: jonth.c ifeq ($(CC),gcc)
${CC} ${CFLAGS} jonth.c -o jonth -lX11 -lm
rcm: rcm.c
${CC} ${CFLAGS} -DJ='if(' -Ds='else J O==' -DU='B(' \
-DX='for(' -DH='unsigned' -Dn='struct x' -DA='0,0,0,0,' \
-DT='<stdio.h>' -DY='<stdlib.h>' -DR='malloc(sizeof(n))' \
-DM='%=K' -DK=32768 -DD='getchar()' -DN=putchar rcm.c -o rcm
schweikh1: schweikh1.c errno.h
${CC} ${CFLAGS} -I. schweikh1.c -o schweikh1
schweikh2: schweikh2.c hunni.c hunni.pl
${CC} ${CFLAGS} -D_POSIX_SOURCE schweikh2.c -o schweikh2
# NOTE: On some systems such as SunOS, one may need to compile with:
# #
# ${CC} ${CFLAGS} \ #CSILENCE+=
# -I. -D_POSIX_SOURCE '-Ddifftime(a,b)=(double)(b-a)' \ #
# schweikh3.c -o schweikh3 #CWARN+=
# #
schweikh3: schweikh3.c iso646.h endif
${CC} ${CFLAGS} -I. -D_POSIX_SOURCE schweikh3.c -o schweikh3
westley: westley.c clock1 clock2 clock3
${CC} ${CFLAGS} westley.c -o westley
${CHMOD} +x clock1 clock2 clock3
clean: ##############################
${RM} -f *.o a.out core ${WINNERS} # Special flags for this entry
##############################
#
ENTRY= gandalf
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA=
TARGET= ${PROG} hatcat cathat
#
ALT_OBJ=
ALT_TARGET=
clobber: clean
${RM} -f $(WINNERS)
${RM} -f $(ALT_NAMES)
${RM} -f fac.oo parse.oo test.oo hatcat cathat august.oc
nuke: clobber #################
# build the entry
#################
#
all: data ${TARGET}
@${TRUE} @${TRUE}
install: all .PHONY: all alt data everything clean clobber install \
${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null love haste waste maker easter_egg sandwich \
supernova deep_magic magic charon pluto
${PROG}: ${PROG}.c
@echo "NOTE: This entry may not compile when using modern compilers."
${CC} ${CFLAGS} $< -o $@ ${LIBS}
hatcat: ${PROG}
${RM} -f $@
${CP} $< $@
cathat: ${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"
+14 -18
View File
@@ -1,4 +1,4 @@
Best Layout: # Best Layout:
Dean Swift Dean Swift
Trinome Communications Trinome Communications
@@ -10,31 +10,28 @@ Best Layout:
http://www.tc3.co.uk/~gandalf/G.HTML http://www.tc3.co.uk/~gandalf/G.HTML
## To build:
Judges' comments: make all
NOTE: This entry may not compile when using modern compilers.
### To run
To use:
make gandalf
./gandalf ./gandalf
## Judges' comments
Also try: Also try:
For C-shell: PATH=.:$PATH
./hatcat
setenv PATH ( . $PATH ) ./cathat
hatcat
cathat
For K-shell, /bin/sh, bash, etc:
PATH=.:$PATH
hatcat
cathat
And next try: And next try:
./cathat ./cathat
`pwd`/cathat # <--- those are back quotes `pwd`/cathat
Care to guess why these execute differently? Only the Care to guess why these execute differently? Only the
compiler knows ... ok maybe other things like the author, compiler knows ... ok maybe other things like the author,
@@ -44,7 +41,6 @@ Judges' comments:
cc -E gandalf.c cc -E gandalf.c
## Author's comments
Selected notes from the author:
The program requires an ASCII system. The program requires an ASCII system.
+312 -133
View File
@@ -1,156 +1,335 @@
# %W% %G% %U% #!/usr/bin/env make
# #
# 1996 makefile # IOCCC 1996 winning entry - huffman
################################################################################
# #
# Copyright (c) 1997, Landon Curt Noll & Sriram Srinivasan # An Historical Makefile NOTE:
# All Rights Reserved. Permission for personal, educational or non-profit #
# use is granted provided this this copyright and notice are included in its # The orig.Makefile, if it exits, is the original Makefile before this IOCCC
# entirety and remains unaltered. All other uses must receive prior permission # year directory was reworked so that entries are in separate directories.
# from Landon Curt Noll and Sriram Srinivasan. # This also applies to any orig.ansi.mk and orig.common.mk files.
#
# Several Makefiles were modified / formed in 2022, and as such it may have
# elements that are not historically compatible with way entries were built.
# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile.
#
# Regarding individual entries:
#
# IOCCC winning entry code may not work on your system. Even with standards,
# conditions and build environments change, especially when it comes to more
# extreme code such you might find in an IOCCC winner. Moreover, what was
# allowed and liked in one IOCCC contest may no longer be liked/allowed in
# later IOCCC years.
#
# Corrections on winning author and fixing typos in remarks are VERY WELCOME.
#
# GitHub pull requests are welcome:
#
# If you have a patch that might make running an entry work in modern Unix-like
# environments, please create a GitHub pull request for the IOCCC judges to
# consider.
#
# Suggestions and corrections regarding Makefiles, winning author information,
# fixing typos in remarks, and code patches are welcome via opening a GitHub
# issue or better yet, by creating a GitHub pull request for the IOCCC judges
# to consider. To form a GitHub issue or GitHub pull, please visit:
#
# https://github.com/ioccc-src/winner
#
################################################################################
# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under:
#
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
#
# See: http://creativecommons.org/licenses/by-sa/3.0/
SHELL=/bin/sh #############################
CAT=cat # shell used by this Makefile
CHMOD=chmod #############################
CP=cp #
GUNZIP=gunzip SHELL= bash
UUDECODE=uudecode
LN=ln
RM=rm
SED=sed
TRUE=true
# flags for ANSI compiles #######################
# common tool locations
#######################
# #
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode, include ../../var.mk
# others such as gcc may want -ansi, others may want nothing
# at all. Adjust the CFLAGS line as needed.
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# incorrectly. You might want to turn on -O to see if your
# compiler can handle them.
#
#CFLAGS=-O -Xa
#CFLAGS=-Xa
#CFLAGS= -ansi
CFLAGS= -ansi -O
#CFLAGS=
# ANSI compiler # Set X11_LIBDIR to the directory where the X11 library resides
# #
# Set CC to the name of your ANSI compiler. #X11_LIBDIR= /usr/X11R6/lib
CC=cc #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
# Common C compiler warning flags
#
#CWARN= ${CSILENCE}
#CWARN= -Wall ${CSILENCE}
#CWARN= -Wall -Wextra ${CSILENCE}
CWARN= -Wall -Wextra -pedantic ${CSILENCE}
# Compiler standard
#
#CSTD=
#CSTD= -ansi
CSTD= -std=gnu90
# Compiler bit architecture
#
# Some entries require 32-bitness:
# ARCH= -m32
#
# Some entries require 64-bitness:
# ARCH= -m64
#
# By default we assume nothing:
#
ARCH=
# Defines that are needed to compile
#
CDEFINE=
#CDEFINE= -DIOCCC
# Include files that are needed to compile
#
CINCLUDE=
#CINCLUDE= -include stdlib.h
#CINCLUDE= -include stdio.h
#CINCLUDE= -include stdlib.h -include stdio.h
#CINCLUDE= -I ${X11_INCDIR}
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
# Optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
# Reasonable compilers will allow for -O3.
#
#OPT=
#OPT= -O
#OPT= -O1
#OPT= -O2
OPT= -O3
# Default flags for ANSI C compilation
#
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# Libraries needed to build
#
LIBS=
#LIBS= -lm
#LIBS= -L ${X11_LIBDIR} -lX11
#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL
# C compiler to use
#
CC= cc
#CC=clang
#CC=gcc #CC=gcc
# winners that compile under ANSI C # Compiler add-ons or replacements for clang only
# #
WINNERS= august dalbec eldby gandalf huffman jonth rcm schweikh1 \ ifeq ($(CC),clang)
schweikh2 schweikh3 westley
ALT_NAMES= august.orig
LEVEL=5
all: $(WINNERS)
# NOTE: Some compilers will compile this code into infinite loop
# progs. We have found gcc to work on a number of platforms.
# If the following example does not execute in a very
# short time, try a better compiler:
# #
# cat august.c test.oc | ./august > test.oo CSILENCE+= -Wno-poison-system-directories
#
august: august.c fac.oc parse.oc test.oc
${CC} ${CFLAGS} -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.c -o august
${CHMOD} +r fac.oc parse.oc test.oc
# This forms a byte code execution engine written in OC
# #
august.oc: august.c CWARN+= -Weverything
${RM} -f august.oc
${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.c > august.oc
${CHMOD} +r august.oc
# NOTE: this is the original source that won
# #
august.orig: august.orig.c fac.oc parse.oc test.oc endif
${CC} ${CFLAGS} -DZ=60000 -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.orig.c -o august.orig
${RM} -f august.oc
${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.orig.c > august.oc
${CHMOD} +r fac.oc parse.oc test.oc august.oc
dalbec: dalbec.c # Specific add-ons or replacements for gcc only
${CC} ${CFLAGS} dalbec.c -o dalbec
eldby: eldby.c
${CC} ${CFLAGS} eldby.c -o eldby
gandalf: gandalf.c
${CC} ${CFLAGS} gandalf.c -o gandalf
${RM} -f hatcat cathat
${CP} gandalf hatcat
${CP} gandalf cathat
huffman: huffman.c
${CC} ${CFLAGS} huffman.c -o huffman
# Add -I${X}/include and -L${X}/lib if this doesn't build
# (X is the root of the X Window distribution)
# Solaris users add -lsocket
# #
jonth: jonth.c ifeq ($(CC),gcc)
${CC} ${CFLAGS} jonth.c -o jonth -lX11 -lm
rcm: rcm.c
${CC} ${CFLAGS} -DJ='if(' -Ds='else J O==' -DU='B(' \
-DX='for(' -DH='unsigned' -Dn='struct x' -DA='0,0,0,0,' \
-DT='<stdio.h>' -DY='<stdlib.h>' -DR='malloc(sizeof(n))' \
-DM='%=K' -DK=32768 -DD='getchar()' -DN=putchar rcm.c -o rcm
schweikh1: schweikh1.c errno.h
${CC} ${CFLAGS} -I. schweikh1.c -o schweikh1
schweikh2: schweikh2.c hunni.c hunni.pl
${CC} ${CFLAGS} -D_POSIX_SOURCE schweikh2.c -o schweikh2
# NOTE: On some systems such as SunOS, one may need to compile with:
# #
# ${CC} ${CFLAGS} \ #CSILENCE+=
# -I. -D_POSIX_SOURCE '-Ddifftime(a,b)=(double)(b-a)' \ #
# schweikh3.c -o schweikh3 #CWARN+=
# #
schweikh3: schweikh3.c iso646.h endif
${CC} ${CFLAGS} -I. -D_POSIX_SOURCE schweikh3.c -o schweikh3
westley: westley.c clock1 clock2 clock3
${CC} ${CFLAGS} westley.c -o westley
${CHMOD} +x clock1 clock2 clock3
clean: ##############################
${RM} -f *.o a.out core ${WINNERS} # Special flags for this entry
##############################
#
ENTRY= huffman
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
ALT_OBJ=
ALT_TARGET=
clobber: clean
${RM} -f $(WINNERS)
${RM} -f $(ALT_NAMES)
${RM} -f fac.oo parse.oo test.oo hatcat cathat august.oc
nuke: clobber #################
# build the entry
#################
#
all: data ${TARGET}
@${TRUE} @${TRUE}
install: all .PHONY: all alt data everything clean clobber install \
${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null 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"
+9 -6
View File
@@ -1,4 +1,4 @@
Best Obfuscated Character Set Utility: # Best Obfuscated Character Set Utility:
Ken Huffman Ken Huffman
Applied Innovation Inc Applied Innovation Inc
@@ -8,14 +8,18 @@ Best Obfuscated Character Set Utility:
<http://www.huffmancoding.com> <http://www.huffmancoding.com>
huffmancoding@gmail.com huffmancoding@gmail.com
## To build:
Judges' comments: make all
### To run
To use:
make huffman
echo 'Huffman Decoding' | ./huffman echo 'Huffman Decoding' | ./huffman
## Judges' comments
Try: Try:
echo 'seeing or feeling is believing' | ./huffman echo 'seeing or feeling is believing' | ./huffman
echo 'CC OR NOT CC' | ./huffman | ./huffman echo 'CC OR NOT CC' | ./huffman | ./huffman
@@ -30,8 +34,7 @@ Judges' comments:
This entry was very well received at the IOCCC BOF. This entry was very well received at the IOCCC BOF.
## Author's comments
Selected notes from the author:
This filter program is really not obfuscated code. It compiles cleanly This filter program is really not obfuscated code. It compiles cleanly
with an ANSI C compiler and comes with user documentation that even a with an ANSI C compiler and comes with user documentation that even a
+318 -133
View File
@@ -1,156 +1,341 @@
# %W% %G% %U% #!/usr/bin/env make
# #
# 1996 makefile # IOCCC 1996 winning entry - jonth
################################################################################
# #
# Copyright (c) 1997, Landon Curt Noll & Sriram Srinivasan # An Historical Makefile NOTE:
# All Rights Reserved. Permission for personal, educational or non-profit #
# use is granted provided this this copyright and notice are included in its # The orig.Makefile, if it exits, is the original Makefile before this IOCCC
# entirety and remains unaltered. All other uses must receive prior permission # year directory was reworked so that entries are in separate directories.
# from Landon Curt Noll and Sriram Srinivasan. # This also applies to any orig.ansi.mk and orig.common.mk files.
#
# Several Makefiles were modified / formed in 2022, and as such it may have
# elements that are not historically compatible with way entries were built.
# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile.
#
# Regarding individual entries:
#
# IOCCC winning entry code may not work on your system. Even with standards,
# conditions and build environments change, especially when it comes to more
# extreme code such you might find in an IOCCC winner. Moreover, what was
# allowed and liked in one IOCCC contest may no longer be liked/allowed in
# later IOCCC years.
#
# Corrections on winning author and fixing typos in remarks are VERY WELCOME.
#
# GitHub pull requests are welcome:
#
# If you have a patch that might make running an entry work in modern Unix-like
# environments, please create a GitHub pull request for the IOCCC judges to
# consider.
#
# Suggestions and corrections regarding Makefiles, winning author information,
# fixing typos in remarks, and code patches are welcome via opening a GitHub
# issue or better yet, by creating a GitHub pull request for the IOCCC judges
# to consider. To form a GitHub issue or GitHub pull, please visit:
#
# https://github.com/ioccc-src/winner
#
################################################################################
# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under:
#
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
#
# See: http://creativecommons.org/licenses/by-sa/3.0/
SHELL=/bin/sh #############################
CAT=cat # shell used by this Makefile
CHMOD=chmod #############################
CP=cp #
GUNZIP=gunzip SHELL= bash
UUDECODE=uudecode
LN=ln
RM=rm
SED=sed
TRUE=true
# flags for ANSI compiles #######################
# common tool locations
#######################
# #
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode, include ../../var.mk
# others such as gcc may want -ansi, others may want nothing
# at all. Adjust the CFLAGS line as needed.
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# incorrectly. You might want to turn on -O to see if your
# compiler can handle them.
#
#CFLAGS=-O -Xa
#CFLAGS=-Xa
#CFLAGS= -ansi
CFLAGS= -ansi -O
#CFLAGS=
# ANSI compiler # Set X11_LIBDIR to the directory where the X11 library resides
# #
# Set CC to the name of your ANSI compiler. #X11_LIBDIR= /usr/X11R6/lib
CC=cc #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-char-subscripts -Wno-error -Wno-implicit-function-declaration \
-Wno-infinite-recursion -Wno-return-type -Wno-string-plus-int \
-Wno-unsequenced -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 -lm
#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL
# C compiler to use
#
CC= cc
#CC=clang
#CC=gcc #CC=gcc
# winners that compile under ANSI C # Compiler add-ons or replacements for clang only
# #
WINNERS= august dalbec eldby gandalf huffman jonth rcm schweikh1 \ ifeq ($(CC),clang)
schweikh2 schweikh3 westley
ALT_NAMES= august.orig
LEVEL=5
all: $(WINNERS)
# NOTE: Some compilers will compile this code into infinite loop
# progs. We have found gcc to work on a number of platforms.
# If the following example does not execute in a very
# short time, try a better compiler:
# #
# cat august.c test.oc | ./august > test.oo CSILENCE+= -Wno-c99-extensions -Wno-double-promotion -Wno-float-conversion \
# -Wno-implicit-float-conversion -Wno-implicit-int-conversion \
august: august.c fac.oc parse.oc test.oc -Wno-missing-prototypes -Wno-missing-variable-declarations -Wno-pedantic \
${CC} ${CFLAGS} -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \ -Wno-poison-system-directories -Wno-shadow -Wno-sign-conversion \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \ -Wno-strict-prototypes
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.c -o august
${CHMOD} +r fac.oc parse.oc test.oc
# This forms a byte code execution engine written in OC
# #
august.oc: august.c CWARN+= -Weverything
${RM} -f august.oc
${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.c > august.oc
${CHMOD} +r august.oc
# NOTE: this is the original source that won
# #
august.orig: august.orig.c fac.oc parse.oc test.oc endif
${CC} ${CFLAGS} -DZ=60000 -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.orig.c -o august.orig
${RM} -f august.oc
${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.orig.c > august.oc
${CHMOD} +r fac.oc parse.oc test.oc august.oc
dalbec: dalbec.c # Specific add-ons or replacements for gcc only
${CC} ${CFLAGS} dalbec.c -o dalbec
eldby: eldby.c
${CC} ${CFLAGS} eldby.c -o eldby
gandalf: gandalf.c
${CC} ${CFLAGS} gandalf.c -o gandalf
${RM} -f hatcat cathat
${CP} gandalf hatcat
${CP} gandalf cathat
huffman: huffman.c
${CC} ${CFLAGS} huffman.c -o huffman
# Add -I${X}/include and -L${X}/lib if this doesn't build
# (X is the root of the X Window distribution)
# Solaris users add -lsocket
# #
jonth: jonth.c ifeq ($(CC),gcc)
${CC} ${CFLAGS} jonth.c -o jonth -lX11 -lm
rcm: rcm.c
${CC} ${CFLAGS} -DJ='if(' -Ds='else J O==' -DU='B(' \
-DX='for(' -DH='unsigned' -Dn='struct x' -DA='0,0,0,0,' \
-DT='<stdio.h>' -DY='<stdlib.h>' -DR='malloc(sizeof(n))' \
-DM='%=K' -DK=32768 -DD='getchar()' -DN=putchar rcm.c -o rcm
schweikh1: schweikh1.c errno.h
${CC} ${CFLAGS} -I. schweikh1.c -o schweikh1
schweikh2: schweikh2.c hunni.c hunni.pl
${CC} ${CFLAGS} -D_POSIX_SOURCE schweikh2.c -o schweikh2
# NOTE: On some systems such as SunOS, one may need to compile with:
# #
# ${CC} ${CFLAGS} \ #CSILENCE+=
# -I. -D_POSIX_SOURCE '-Ddifftime(a,b)=(double)(b-a)' \ #
# schweikh3.c -o schweikh3 #CWARN+=
# #
schweikh3: schweikh3.c iso646.h endif
${CC} ${CFLAGS} -I. -D_POSIX_SOURCE schweikh3.c -o schweikh3
westley: westley.c clock1 clock2 clock3
${CC} ${CFLAGS} westley.c -o westley
${CHMOD} +x clock1 clock2 clock3
clean: ##############################
${RM} -f *.o a.out core ${WINNERS} # Special flags for this entry
##############################
#
ENTRY= jonth
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
ALT_OBJ=
ALT_TARGET=
clobber: clean
${RM} -f $(WINNERS)
${RM} -f $(ALT_NAMES)
${RM} -f fac.oo parse.oo test.oo hatcat cathat august.oc
nuke: clobber #################
# build the entry
#################
#
all: data ${TARGET}
@${TRUE} @${TRUE}
install: all .PHONY: all alt data everything clean clobber install \
${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null 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 -10
View File
@@ -1,4 +1,4 @@
Best X11 Entry: # Best X11 Entry:
Jon Thingvold Jon Thingvold
University of Oslo University of Oslo
@@ -8,27 +8,24 @@ Best X11 Entry:
http://www.uio.no/~jonth/ http://www.uio.no/~jonth/
## To build:
Judges' comments: make all
To use: ### To run
make jonth
./jonth ./jonth
## Judges' comments
Also try: Also try:
./jonth host1:0 host2:0 ./jonth host1:0 host2:0
NOTE: You may need to change the Makefile depending on where X11
include files are found and what libs are required. For
example Solaris and Slowlaris need -lsocket. :-)
For extra credit, figure out how you can cheat by taking over For extra credit, figure out how you can cheat by taking over
a square already occupied by an opponent. a square already occupied by an opponent.
## Author's comments
Selected notes from the author:
This is mulituser tictactoe for X Windows. You may give one or two X This is mulituser tictactoe for X Windows. You may give one or two X
displays as arguments to this game. displays as arguments to this game.
+317 -133
View File
@@ -1,156 +1,340 @@
# %W% %G% %U% #!/usr/bin/env make
# #
# 1996 makefile # IOCCC 1996 winning entry - rcm
################################################################################
# #
# Copyright (c) 1997, Landon Curt Noll & Sriram Srinivasan # An Historical Makefile NOTE:
# All Rights Reserved. Permission for personal, educational or non-profit #
# use is granted provided this this copyright and notice are included in its # The orig.Makefile, if it exits, is the original Makefile before this IOCCC
# entirety and remains unaltered. All other uses must receive prior permission # year directory was reworked so that entries are in separate directories.
# from Landon Curt Noll and Sriram Srinivasan. # This also applies to any orig.ansi.mk and orig.common.mk files.
#
# Several Makefiles were modified / formed in 2022, and as such it may have
# elements that are not historically compatible with way entries were built.
# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile.
#
# Regarding individual entries:
#
# IOCCC winning entry code may not work on your system. Even with standards,
# conditions and build environments change, especially when it comes to more
# extreme code such you might find in an IOCCC winner. Moreover, what was
# allowed and liked in one IOCCC contest may no longer be liked/allowed in
# later IOCCC years.
#
# Corrections on winning author and fixing typos in remarks are VERY WELCOME.
#
# GitHub pull requests are welcome:
#
# If you have a patch that might make running an entry work in modern Unix-like
# environments, please create a GitHub pull request for the IOCCC judges to
# consider.
#
# Suggestions and corrections regarding Makefiles, winning author information,
# fixing typos in remarks, and code patches are welcome via opening a GitHub
# issue or better yet, by creating a GitHub pull request for the IOCCC judges
# to consider. To form a GitHub issue or GitHub pull, please visit:
#
# https://github.com/ioccc-src/winner
#
################################################################################
# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under:
#
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
#
# See: http://creativecommons.org/licenses/by-sa/3.0/
SHELL=/bin/sh #############################
CAT=cat # shell used by this Makefile
CHMOD=chmod #############################
CP=cp #
GUNZIP=gunzip SHELL= bash
UUDECODE=uudecode
LN=ln
RM=rm
SED=sed
TRUE=true
# flags for ANSI compiles #######################
# common tool locations
#######################
# #
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode, include ../../var.mk
# others such as gcc may want -ansi, others may want nothing
# at all. Adjust the CFLAGS line as needed.
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# incorrectly. You might want to turn on -O to see if your
# compiler can handle them.
#
#CFLAGS=-O -Xa
#CFLAGS=-Xa
#CFLAGS= -ansi
CFLAGS= -ansi -O
#CFLAGS=
# ANSI compiler # Set X11_LIBDIR to the directory where the X11 library resides
# #
# Set CC to the name of your ANSI compiler. #X11_LIBDIR= /usr/X11R6/lib
CC=cc #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-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= -DJ='if(' -Ds='else J O==' -DU='B(' \
-DX='for(' -DH='unsigned' -Dn='struct x' -DA='0,0,0,0,' \
-DT='<stdio.h>' -DY='<stdlib.h>' -DR='malloc(sizeof(n))' \
-DM='%=K' -DK=32768 -DD='getchar()' -DN=putchar
# Include files that are needed to compile
#
CINCLUDE=
#CINCLUDE= -include stdlib.h
#CINCLUDE= -include stdio.h
#CINCLUDE= -include stdlib.h -include stdio.h
#CINCLUDE= -I ${X11_INCDIR}
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
# Optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
# Reasonable compilers will allow for -O3.
#
#OPT=
#OPT= -O
#OPT= -O1
#OPT= -O2
OPT= -O3
# Default flags for ANSI C compilation
#
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# Libraries needed to build
#
LIBS=
#LIBS= -lm
#LIBS= -L ${X11_LIBDIR} -lX11
#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL
# C compiler to use
#
CC= cc
#CC=clang
#CC=gcc #CC=gcc
# winners that compile under ANSI C # Compiler add-ons or replacements for clang only
# #
WINNERS= august dalbec eldby gandalf huffman jonth rcm schweikh1 \ ifeq ($(CC),clang)
schweikh2 schweikh3 westley
ALT_NAMES= august.orig
LEVEL=5
all: $(WINNERS)
# NOTE: Some compilers will compile this code into infinite loop
# progs. We have found gcc to work on a number of platforms.
# If the following example does not execute in a very
# short time, try a better compiler:
# #
# cat august.c test.oc | ./august > test.oo CSILENCE+= -Wno-comma -Wno-implicit-int-conversion -Wno-missing-prototypes \
# -Wno-missing-variable-declarations -Wno-padded \
august: august.c fac.oc parse.oc test.oc -Wno-poison-system-directories -Wno-sign-conversion
${CC} ${CFLAGS} -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.c -o august
${CHMOD} +r fac.oc parse.oc test.oc
# This forms a byte code execution engine written in OC
# #
august.oc: august.c CWARN+= -Weverything
${RM} -f august.oc
${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.c > august.oc
${CHMOD} +r august.oc
# NOTE: this is the original source that won
# #
august.orig: august.orig.c fac.oc parse.oc test.oc endif
${CC} ${CFLAGS} -DZ=60000 -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.orig.c -o august.orig
${RM} -f august.oc
${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.orig.c > august.oc
${CHMOD} +r fac.oc parse.oc test.oc august.oc
dalbec: dalbec.c # Specific add-ons or replacements for gcc only
${CC} ${CFLAGS} dalbec.c -o dalbec
eldby: eldby.c
${CC} ${CFLAGS} eldby.c -o eldby
gandalf: gandalf.c
${CC} ${CFLAGS} gandalf.c -o gandalf
${RM} -f hatcat cathat
${CP} gandalf hatcat
${CP} gandalf cathat
huffman: huffman.c
${CC} ${CFLAGS} huffman.c -o huffman
# Add -I${X}/include and -L${X}/lib if this doesn't build
# (X is the root of the X Window distribution)
# Solaris users add -lsocket
# #
jonth: jonth.c ifeq ($(CC),gcc)
${CC} ${CFLAGS} jonth.c -o jonth -lX11 -lm
rcm: rcm.c
${CC} ${CFLAGS} -DJ='if(' -Ds='else J O==' -DU='B(' \
-DX='for(' -DH='unsigned' -Dn='struct x' -DA='0,0,0,0,' \
-DT='<stdio.h>' -DY='<stdlib.h>' -DR='malloc(sizeof(n))' \
-DM='%=K' -DK=32768 -DD='getchar()' -DN=putchar rcm.c -o rcm
schweikh1: schweikh1.c errno.h
${CC} ${CFLAGS} -I. schweikh1.c -o schweikh1
schweikh2: schweikh2.c hunni.c hunni.pl
${CC} ${CFLAGS} -D_POSIX_SOURCE schweikh2.c -o schweikh2
# NOTE: On some systems such as SunOS, one may need to compile with:
# #
# ${CC} ${CFLAGS} \ #CSILENCE+=
# -I. -D_POSIX_SOURCE '-Ddifftime(a,b)=(double)(b-a)' \ #
# schweikh3.c -o schweikh3 #CWARN+=
# #
schweikh3: schweikh3.c iso646.h endif
${CC} ${CFLAGS} -I. -D_POSIX_SOURCE schweikh3.c -o schweikh3
westley: westley.c clock1 clock2 clock3
${CC} ${CFLAGS} westley.c -o westley
${CHMOD} +x clock1 clock2 clock3
clean: ##############################
${RM} -f *.o a.out core ${WINNERS} # Special flags for this entry
##############################
#
ENTRY= rcm
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA= rfc1951.gz rfc1952.gz
TARGET= ${PROG}
#
ALT_OBJ=
ALT_TARGET=
clobber: clean
${RM} -f $(WINNERS)
${RM} -f $(ALT_NAMES)
${RM} -f fac.oo parse.oo test.oo hatcat cathat august.oc
nuke: clobber #################
# build the entry
#################
#
all: data ${TARGET}
@${TRUE} @${TRUE}
install: all .PHONY: all alt data everything clean clobber install \
${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null 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 -10
View File
@@ -1,32 +1,29 @@
Best RFC Obfuscation: # Best RFC Obfuscation:
Ron McFarland Ron McFarland
7941 Fawncreek Drive 7941 Fawncreek Drive
Cincinnati, Ohio 45249 Cincinnati, Ohio 45249
USA USA
## To build:
Judges' comments: make all
### To run
To use:
make rcm
./rcm < rfc1951.gz ./rcm < rfc1951.gz
Also try: ## Judges' comments
./rcm < rfc1952.gz
And for more information try: And for more information try:
./rcm < rfc1951.gz
./rcm < rfc1952.gz ./rcm < rfc1952.gz
For a good noop try: For a good noop try:
gzip -c < rcm.c | ./rcm gzip -c < rcm.c | ./rcm
## Author's comments
Selected notes from the author:
Except for some silly requirements regarding input validation, CRC Except for some silly requirements regarding input validation, CRC
checking, and similar unimportant fluff, this program is a fully checking, and similar unimportant fluff, this program is a fully
+314 -133
View File
@@ -1,156 +1,337 @@
# %W% %G% %U% #!/usr/bin/env make
# #
# 1996 makefile # IOCCC 1996 winning entry - schweikh1
################################################################################
# #
# Copyright (c) 1997, Landon Curt Noll & Sriram Srinivasan # An Historical Makefile NOTE:
# All Rights Reserved. Permission for personal, educational or non-profit #
# use is granted provided this this copyright and notice are included in its # The orig.Makefile, if it exits, is the original Makefile before this IOCCC
# entirety and remains unaltered. All other uses must receive prior permission # year directory was reworked so that entries are in separate directories.
# from Landon Curt Noll and Sriram Srinivasan. # This also applies to any orig.ansi.mk and orig.common.mk files.
#
# Several Makefiles were modified / formed in 2022, and as such it may have
# elements that are not historically compatible with way entries were built.
# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile.
#
# Regarding individual entries:
#
# IOCCC winning entry code may not work on your system. Even with standards,
# conditions and build environments change, especially when it comes to more
# extreme code such you might find in an IOCCC winner. Moreover, what was
# allowed and liked in one IOCCC contest may no longer be liked/allowed in
# later IOCCC years.
#
# Corrections on winning author and fixing typos in remarks are VERY WELCOME.
#
# GitHub pull requests are welcome:
#
# If you have a patch that might make running an entry work in modern Unix-like
# environments, please create a GitHub pull request for the IOCCC judges to
# consider.
#
# Suggestions and corrections regarding Makefiles, winning author information,
# fixing typos in remarks, and code patches are welcome via opening a GitHub
# issue or better yet, by creating a GitHub pull request for the IOCCC judges
# to consider. To form a GitHub issue or GitHub pull, please visit:
#
# https://github.com/ioccc-src/winner
#
################################################################################
# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under:
#
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
#
# See: http://creativecommons.org/licenses/by-sa/3.0/
SHELL=/bin/sh #############################
CAT=cat # shell used by this Makefile
CHMOD=chmod #############################
CP=cp #
GUNZIP=gunzip SHELL= bash
UUDECODE=uudecode
LN=ln
RM=rm
SED=sed
TRUE=true
# flags for ANSI compiles #######################
# common tool locations
#######################
# #
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode, include ../../var.mk
# others such as gcc may want -ansi, others may want nothing
# at all. Adjust the CFLAGS line as needed.
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# incorrectly. You might want to turn on -O to see if your
# compiler can handle them.
#
#CFLAGS=-O -Xa
#CFLAGS=-Xa
#CFLAGS= -ansi
CFLAGS= -ansi -O
#CFLAGS=
# ANSI compiler # Set X11_LIBDIR to the directory where the X11 library resides
# #
# Set CC to the name of your ANSI compiler. #X11_LIBDIR= /usr/X11R6/lib
CC=cc #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= -I.
#CINCLUDE= -include stdlib.h
#CINCLUDE= -include stdio.h
#CINCLUDE= -include stdlib.h -include stdio.h
#CINCLUDE= -I ${X11_INCDIR}
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
# Optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
# Reasonable compilers will allow for -O3.
#
#OPT=
#OPT= -O
#OPT= -O1
#OPT= -O2
OPT= -O3
# Default flags for ANSI C compilation
#
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# Libraries needed to build
#
LIBS=
#LIBS= -lm
#LIBS= -L ${X11_LIBDIR} -lX11
#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL
# C compiler to use
#
CC= cc
#CC=clang
#CC=gcc #CC=gcc
# winners that compile under ANSI C # Compiler add-ons or replacements for clang only
# #
WINNERS= august dalbec eldby gandalf huffman jonth rcm schweikh1 \ ifeq ($(CC),clang)
schweikh2 schweikh3 westley
ALT_NAMES= august.orig
LEVEL=5
all: $(WINNERS)
# NOTE: Some compilers will compile this code into infinite loop
# progs. We have found gcc to work on a number of platforms.
# If the following example does not execute in a very
# short time, try a better compiler:
# #
# cat august.c test.oc | ./august > test.oo CSILENCE+= -Wno-conditional-uninitialized -Wno-disabled-macro-expansion \
# -Wno-missing-variable-declarations -Wno-poison-system-directories
august: august.c fac.oc parse.oc test.oc
${CC} ${CFLAGS} -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.c -o august
${CHMOD} +r fac.oc parse.oc test.oc
# This forms a byte code execution engine written in OC
# #
august.oc: august.c CWARN+= -Weverything
${RM} -f august.oc
${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.c > august.oc
${CHMOD} +r august.oc
# NOTE: this is the original source that won
# #
august.orig: august.orig.c fac.oc parse.oc test.oc endif
${CC} ${CFLAGS} -DZ=60000 -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.orig.c -o august.orig
${RM} -f august.oc
${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.orig.c > august.oc
${CHMOD} +r fac.oc parse.oc test.oc august.oc
dalbec: dalbec.c # Specific add-ons or replacements for gcc only
${CC} ${CFLAGS} dalbec.c -o dalbec
eldby: eldby.c
${CC} ${CFLAGS} eldby.c -o eldby
gandalf: gandalf.c
${CC} ${CFLAGS} gandalf.c -o gandalf
${RM} -f hatcat cathat
${CP} gandalf hatcat
${CP} gandalf cathat
huffman: huffman.c
${CC} ${CFLAGS} huffman.c -o huffman
# Add -I${X}/include and -L${X}/lib if this doesn't build
# (X is the root of the X Window distribution)
# Solaris users add -lsocket
# #
jonth: jonth.c ifeq ($(CC),gcc)
${CC} ${CFLAGS} jonth.c -o jonth -lX11 -lm
rcm: rcm.c
${CC} ${CFLAGS} -DJ='if(' -Ds='else J O==' -DU='B(' \
-DX='for(' -DH='unsigned' -Dn='struct x' -DA='0,0,0,0,' \
-DT='<stdio.h>' -DY='<stdlib.h>' -DR='malloc(sizeof(n))' \
-DM='%=K' -DK=32768 -DD='getchar()' -DN=putchar rcm.c -o rcm
schweikh1: schweikh1.c errno.h
${CC} ${CFLAGS} -I. schweikh1.c -o schweikh1
schweikh2: schweikh2.c hunni.c hunni.pl
${CC} ${CFLAGS} -D_POSIX_SOURCE schweikh2.c -o schweikh2
# NOTE: On some systems such as SunOS, one may need to compile with:
# #
# ${CC} ${CFLAGS} \ #CSILENCE+=
# -I. -D_POSIX_SOURCE '-Ddifftime(a,b)=(double)(b-a)' \ #
# schweikh3.c -o schweikh3 #CWARN+=
# #
schweikh3: schweikh3.c iso646.h endif
${CC} ${CFLAGS} -I. -D_POSIX_SOURCE schweikh3.c -o schweikh3
westley: westley.c clock1 clock2 clock3
${CC} ${CFLAGS} westley.c -o westley
${CHMOD} +x clock1 clock2 clock3
clean: ##############################
${RM} -f *.o a.out core ${WINNERS} # Special flags for this entry
##############################
#
ENTRY= schweikh1
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA= errno.h
TARGET= ${PROG}
#
ALT_OBJ=
ALT_TARGET=
clobber: clean
${RM} -f $(WINNERS)
${RM} -f $(ALT_NAMES)
${RM} -f fac.oo parse.oo test.oo hatcat cathat august.oc
nuke: clobber #################
# build the entry
#################
#
all: data ${TARGET}
@${TRUE} @${TRUE}
install: all .PHONY: all alt data everything clean clobber install \
${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null 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 -6
View File
@@ -1,4 +1,4 @@
Worst Abuse of the C Preprocessor: # Worst Abuse of the C Preprocessor:
Jens Schweikhardt Jens Schweikhardt
DFN Network Operation Center DFN Network Operation Center
@@ -8,13 +8,16 @@ Worst Abuse of the C Preprocessor:
http://www.uni-stuttgart.de/People/schweikhardt/home.html http://www.uni-stuttgart.de/People/schweikhardt/home.html
## To build:
Judges' comments: make all
### To run
To use:
make schweikh1
./schweikh1 ./schweikh1
## Judges' comments
Look at the source. There is something very odd going on here. Look at the source. There is something very odd going on here.
Where does the real code come from if everything is a C pre-processor Where does the real code come from if everything is a C pre-processor
statement? statement?
@@ -22,8 +25,7 @@ Judges' comments:
Clearly this is either the Best Use or the Worst Abuse of the Clearly this is either the Best Use or the Worst Abuse of the
C Preprocessor that the judges have seen this year! C Preprocessor that the judges have seen this year!
## Author's comments
Selected notes from the author:
What this program does What this program does
---------------------- ----------------------
+312 -133
View File
@@ -1,156 +1,335 @@
# %W% %G% %U% #!/usr/bin/env make
# #
# 1996 makefile # IOCCC 1996 winning entry - schweikh2
################################################################################
# #
# Copyright (c) 1997, Landon Curt Noll & Sriram Srinivasan # An Historical Makefile NOTE:
# All Rights Reserved. Permission for personal, educational or non-profit #
# use is granted provided this this copyright and notice are included in its # The orig.Makefile, if it exits, is the original Makefile before this IOCCC
# entirety and remains unaltered. All other uses must receive prior permission # year directory was reworked so that entries are in separate directories.
# from Landon Curt Noll and Sriram Srinivasan. # This also applies to any orig.ansi.mk and orig.common.mk files.
#
# Several Makefiles were modified / formed in 2022, and as such it may have
# elements that are not historically compatible with way entries were built.
# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile.
#
# Regarding individual entries:
#
# IOCCC winning entry code may not work on your system. Even with standards,
# conditions and build environments change, especially when it comes to more
# extreme code such you might find in an IOCCC winner. Moreover, what was
# allowed and liked in one IOCCC contest may no longer be liked/allowed in
# later IOCCC years.
#
# Corrections on winning author and fixing typos in remarks are VERY WELCOME.
#
# GitHub pull requests are welcome:
#
# If you have a patch that might make running an entry work in modern Unix-like
# environments, please create a GitHub pull request for the IOCCC judges to
# consider.
#
# Suggestions and corrections regarding Makefiles, winning author information,
# fixing typos in remarks, and code patches are welcome via opening a GitHub
# issue or better yet, by creating a GitHub pull request for the IOCCC judges
# to consider. To form a GitHub issue or GitHub pull, please visit:
#
# https://github.com/ioccc-src/winner
#
################################################################################
# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under:
#
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
#
# See: http://creativecommons.org/licenses/by-sa/3.0/
SHELL=/bin/sh #############################
CAT=cat # shell used by this Makefile
CHMOD=chmod #############################
CP=cp #
GUNZIP=gunzip SHELL= bash
UUDECODE=uudecode
LN=ln
RM=rm
SED=sed
TRUE=true
# flags for ANSI compiles #######################
# common tool locations
#######################
# #
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode, include ../../var.mk
# others such as gcc may want -ansi, others may want nothing
# at all. Adjust the CFLAGS line as needed.
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# incorrectly. You might want to turn on -O to see if your
# compiler can handle them.
#
#CFLAGS=-O -Xa
#CFLAGS=-Xa
#CFLAGS= -ansi
CFLAGS= -ansi -O
#CFLAGS=
# ANSI compiler # Set X11_LIBDIR to the directory where the X11 library resides
# #
# Set CC to the name of your ANSI compiler. #X11_LIBDIR= /usr/X11R6/lib
CC=cc #X11_LIBDIR= /usr/X11/lib
X11_LIBDIR= /opt/X11/lib
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
#
#X11_INCDIR= /usr/X11R6/include
#X11_INCDIR= /usr/X11/include
X11_INCDIR= /opt/X11/include
# Common C compiler warnings to silence
#
CSILENCE=
#CSILENCE= -Wno-implicit-int
# Common C compiler warning flags
#
#CWARN= ${CSILENCE}
#CWARN= -Wall ${CSILENCE}
#CWARN= -Wall -Wextra ${CSILENCE}
CWARN= -Wall -Wextra -pedantic ${CSILENCE}
# Compiler standard
#
#CSTD=
#CSTD= -ansi
CSTD= -std=gnu90
# Compiler bit architecture
#
# Some entries require 32-bitness:
# ARCH= -m32
#
# Some entries require 64-bitness:
# ARCH= -m64
#
# By default we assume nothing:
#
ARCH=
# Defines that are needed to compile
#
CDEFINE=
#CDEFINE= -DIOCCC
# Include files that are needed to compile
#
CINCLUDE=
#CINCLUDE= -include stdlib.h
#CINCLUDE= -include stdio.h
#CINCLUDE= -include stdlib.h -include stdio.h
#CINCLUDE= -I ${X11_INCDIR}
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
# Optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
# Reasonable compilers will allow for -O3.
#
#OPT=
#OPT= -O
#OPT= -O1
#OPT= -O2
OPT= -O3
# Default flags for ANSI C compilation
#
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# Libraries needed to build
#
LIBS=
#LIBS= -lm
#LIBS= -L ${X11_LIBDIR} -lX11
#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL
# C compiler to use
#
CC= cc
#CC=clang
#CC=gcc #CC=gcc
# winners that compile under ANSI C # Compiler add-ons or replacements for clang only
# #
WINNERS= august dalbec eldby gandalf huffman jonth rcm schweikh1 \ ifeq ($(CC),clang)
schweikh2 schweikh3 westley
ALT_NAMES= august.orig
LEVEL=5
all: $(WINNERS)
# NOTE: Some compilers will compile this code into infinite loop
# progs. We have found gcc to work on a number of platforms.
# If the following example does not execute in a very
# short time, try a better compiler:
# #
# cat august.c test.oc | ./august > test.oo CSILENCE+= -Wno-comma -Wno-poison-system-directories -Wno-sign-conversion
#
august: august.c fac.oc parse.oc test.oc
${CC} ${CFLAGS} -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.c -o august
${CHMOD} +r fac.oc parse.oc test.oc
# This forms a byte code execution engine written in OC
# #
august.oc: august.c CWARN+= -Weverything
${RM} -f august.oc
${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.c > august.oc
${CHMOD} +r august.oc
# NOTE: this is the original source that won
# #
august.orig: august.orig.c fac.oc parse.oc test.oc endif
${CC} ${CFLAGS} -DZ=60000 -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.orig.c -o august.orig
${RM} -f august.oc
${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.orig.c > august.oc
${CHMOD} +r fac.oc parse.oc test.oc august.oc
dalbec: dalbec.c # Specific add-ons or replacements for gcc only
${CC} ${CFLAGS} dalbec.c -o dalbec
eldby: eldby.c
${CC} ${CFLAGS} eldby.c -o eldby
gandalf: gandalf.c
${CC} ${CFLAGS} gandalf.c -o gandalf
${RM} -f hatcat cathat
${CP} gandalf hatcat
${CP} gandalf cathat
huffman: huffman.c
${CC} ${CFLAGS} huffman.c -o huffman
# Add -I${X}/include and -L${X}/lib if this doesn't build
# (X is the root of the X Window distribution)
# Solaris users add -lsocket
# #
jonth: jonth.c ifeq ($(CC),gcc)
${CC} ${CFLAGS} jonth.c -o jonth -lX11 -lm
rcm: rcm.c
${CC} ${CFLAGS} -DJ='if(' -Ds='else J O==' -DU='B(' \
-DX='for(' -DH='unsigned' -Dn='struct x' -DA='0,0,0,0,' \
-DT='<stdio.h>' -DY='<stdlib.h>' -DR='malloc(sizeof(n))' \
-DM='%=K' -DK=32768 -DD='getchar()' -DN=putchar rcm.c -o rcm
schweikh1: schweikh1.c errno.h
${CC} ${CFLAGS} -I. schweikh1.c -o schweikh1
schweikh2: schweikh2.c hunni.c hunni.pl
${CC} ${CFLAGS} -D_POSIX_SOURCE schweikh2.c -o schweikh2
# NOTE: On some systems such as SunOS, one may need to compile with:
# #
# ${CC} ${CFLAGS} \ #CSILENCE+=
# -I. -D_POSIX_SOURCE '-Ddifftime(a,b)=(double)(b-a)' \ #
# schweikh3.c -o schweikh3 #CWARN+=
# #
schweikh3: schweikh3.c iso646.h endif
${CC} ${CFLAGS} -I. -D_POSIX_SOURCE schweikh3.c -o schweikh3
westley: westley.c clock1 clock2 clock3
${CC} ${CFLAGS} westley.c -o westley
${CHMOD} +x clock1 clock2 clock3
clean: ##############################
${RM} -f *.o a.out core ${WINNERS} # Special flags for this entry
##############################
#
ENTRY= schweikh2
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA= hunni.pl hunni.c
TARGET= ${PROG}
#
ALT_OBJ=
ALT_TARGET=
clobber: clean
${RM} -f $(WINNERS)
${RM} -f $(ALT_NAMES)
${RM} -f fac.oo parse.oo test.oo hatcat cathat august.oc
nuke: clobber #################
# build the entry
#################
#
all: data ${TARGET}
@${TRUE} @${TRUE}
install: all .PHONY: all alt data everything clean clobber install \
${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null 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 -7
View File
@@ -1,4 +1,4 @@
Best Algorithm: # Best Algorithm:
Jens Schweikhardt Jens Schweikhardt
DFN Network Operation Center DFN Network Operation Center
@@ -8,14 +8,16 @@ Best Algorithm:
http://www.uni-stuttgart.de/People/schweikhardt/home.html http://www.uni-stuttgart.de/People/schweikhardt/home.html
## To build:
Judges' comments: make all
### To run
To use:
make schweikh2
./schweikh2 ./schweikh2
## Judges' comments
Also try: Also try:
./schweikh2 15 1 0 0/0 ./schweikh2 15 1 0 0/0
@@ -37,8 +39,7 @@ Judges' comments:
This entry was another crowd pleaser at the IOCCC BOF. This entry was another crowd pleaser at the IOCCC BOF.
## Author's comments
Selected notes from the author:
Note: the source must be viewed with tabstop 8. To appreciate the Note: the source must be viewed with tabstop 8. To appreciate the
beauty have your eyes half closed. beauty have your eyes half closed.
Regular → Executable
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/perl #!/usr/bin/env perl
# #
print "#define C \" \"\n"; print "#define C \" \"\n";
print "#define O( _ ) # _\n"; print "#define O( _ ) # _\n";
+314 -133
View File
@@ -1,156 +1,337 @@
# %W% %G% %U% #!/usr/bin/env make
# #
# 1996 makefile # IOCCC 1996 winning entry - schweikh3
################################################################################
# #
# Copyright (c) 1997, Landon Curt Noll & Sriram Srinivasan # An Historical Makefile NOTE:
# All Rights Reserved. Permission for personal, educational or non-profit #
# use is granted provided this this copyright and notice are included in its # The orig.Makefile, if it exits, is the original Makefile before this IOCCC
# entirety and remains unaltered. All other uses must receive prior permission # year directory was reworked so that entries are in separate directories.
# from Landon Curt Noll and Sriram Srinivasan. # This also applies to any orig.ansi.mk and orig.common.mk files.
#
# Several Makefiles were modified / formed in 2022, and as such it may have
# elements that are not historically compatible with way entries were built.
# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile.
#
# Regarding individual entries:
#
# IOCCC winning entry code may not work on your system. Even with standards,
# conditions and build environments change, especially when it comes to more
# extreme code such you might find in an IOCCC winner. Moreover, what was
# allowed and liked in one IOCCC contest may no longer be liked/allowed in
# later IOCCC years.
#
# Corrections on winning author and fixing typos in remarks are VERY WELCOME.
#
# GitHub pull requests are welcome:
#
# If you have a patch that might make running an entry work in modern Unix-like
# environments, please create a GitHub pull request for the IOCCC judges to
# consider.
#
# Suggestions and corrections regarding Makefiles, winning author information,
# fixing typos in remarks, and code patches are welcome via opening a GitHub
# issue or better yet, by creating a GitHub pull request for the IOCCC judges
# to consider. To form a GitHub issue or GitHub pull, please visit:
#
# https://github.com/ioccc-src/winner
#
################################################################################
# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under:
#
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
#
# See: http://creativecommons.org/licenses/by-sa/3.0/
SHELL=/bin/sh #############################
CAT=cat # shell used by this Makefile
CHMOD=chmod #############################
CP=cp #
GUNZIP=gunzip SHELL= bash
UUDECODE=uudecode
LN=ln
RM=rm
SED=sed
TRUE=true
# flags for ANSI compiles #######################
# common tool locations
#######################
# #
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode, include ../../var.mk
# others such as gcc may want -ansi, others may want nothing
# at all. Adjust the CFLAGS line as needed.
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# incorrectly. You might want to turn on -O to see if your
# compiler can handle them.
#
#CFLAGS=-O -Xa
#CFLAGS=-Xa
#CFLAGS= -ansi
CFLAGS= -ansi -O
#CFLAGS=
# ANSI compiler # Set X11_LIBDIR to the directory where the X11 library resides
# #
# Set CC to the name of your ANSI compiler. #X11_LIBDIR= /usr/X11R6/lib
CC=cc #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-language-extension-token -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= -D_POSIX_SOURCE
# Include files that are needed to compile
#
#CINCLUDE=
CINCLUDE= -I.
#CINCLUDE= -include stdlib.h
#CINCLUDE= -include stdio.h
#CINCLUDE= -include stdlib.h -include stdio.h
#CINCLUDE= -I ${X11_INCDIR}
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
# Optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
# Reasonable compilers will allow for -O3.
#
#OPT=
#OPT= -O
#OPT= -O1
#OPT= -O2
OPT= -O3
# Default flags for ANSI C compilation
#
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# Libraries needed to build
#
LIBS=
#LIBS= -lm
#LIBS= -L ${X11_LIBDIR} -lX11
#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL
# C compiler to use
#
CC= cc
#CC=clang
#CC=gcc #CC=gcc
# winners that compile under ANSI C # Compiler add-ons or replacements for clang only
# #
WINNERS= august dalbec eldby gandalf huffman jonth rcm schweikh1 \ ifeq ($(CC),clang)
schweikh2 schweikh3 westley
ALT_NAMES= august.orig
LEVEL=5
all: $(WINNERS)
# NOTE: Some compilers will compile this code into infinite loop
# progs. We have found gcc to work on a number of platforms.
# If the following example does not execute in a very
# short time, try a better compiler:
# #
# cat august.c test.oc | ./august > test.oo CSILENCE+= -Wno-comma -Wno-date-time -Wno-double-promotion \
# -Wno-poison-system-directories -Wno-unreachable-code
august: august.c fac.oc parse.oc test.oc
${CC} ${CFLAGS} -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.c -o august
${CHMOD} +r fac.oc parse.oc test.oc
# This forms a byte code execution engine written in OC
# #
august.oc: august.c CWARN+= -Weverything
${RM} -f august.oc
${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.c > august.oc
${CHMOD} +r august.oc
# NOTE: this is the original source that won
# #
august.orig: august.orig.c fac.oc parse.oc test.oc endif
${CC} ${CFLAGS} -DZ=60000 -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.orig.c -o august.orig
${RM} -f august.oc
${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.orig.c > august.oc
${CHMOD} +r fac.oc parse.oc test.oc august.oc
dalbec: dalbec.c # Specific add-ons or replacements for gcc only
${CC} ${CFLAGS} dalbec.c -o dalbec
eldby: eldby.c
${CC} ${CFLAGS} eldby.c -o eldby
gandalf: gandalf.c
${CC} ${CFLAGS} gandalf.c -o gandalf
${RM} -f hatcat cathat
${CP} gandalf hatcat
${CP} gandalf cathat
huffman: huffman.c
${CC} ${CFLAGS} huffman.c -o huffman
# Add -I${X}/include and -L${X}/lib if this doesn't build
# (X is the root of the X Window distribution)
# Solaris users add -lsocket
# #
jonth: jonth.c ifeq ($(CC),gcc)
${CC} ${CFLAGS} jonth.c -o jonth -lX11 -lm
rcm: rcm.c
${CC} ${CFLAGS} -DJ='if(' -Ds='else J O==' -DU='B(' \
-DX='for(' -DH='unsigned' -Dn='struct x' -DA='0,0,0,0,' \
-DT='<stdio.h>' -DY='<stdlib.h>' -DR='malloc(sizeof(n))' \
-DM='%=K' -DK=32768 -DD='getchar()' -DN=putchar rcm.c -o rcm
schweikh1: schweikh1.c errno.h
${CC} ${CFLAGS} -I. schweikh1.c -o schweikh1
schweikh2: schweikh2.c hunni.c hunni.pl
${CC} ${CFLAGS} -D_POSIX_SOURCE schweikh2.c -o schweikh2
# NOTE: On some systems such as SunOS, one may need to compile with:
# #
# ${CC} ${CFLAGS} \ #CSILENCE+=
# -I. -D_POSIX_SOURCE '-Ddifftime(a,b)=(double)(b-a)' \ #
# schweikh3.c -o schweikh3 #CWARN+=
# #
schweikh3: schweikh3.c iso646.h endif
${CC} ${CFLAGS} -I. -D_POSIX_SOURCE schweikh3.c -o schweikh3
westley: westley.c clock1 clock2 clock3
${CC} ${CFLAGS} westley.c -o westley
${CHMOD} +x clock1 clock2 clock3
clean: ##############################
${RM} -f *.o a.out core ${WINNERS} # Special flags for this entry
##############################
#
ENTRY= schweikh3
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
ALT_OBJ=
ALT_TARGET=
clobber: clean
${RM} -f $(WINNERS)
${RM} -f $(ALT_NAMES)
${RM} -f fac.oo parse.oo test.oo hatcat cathat august.oc
nuke: clobber #################
# build the entry
#################
#
all: data ${TARGET}
@${TRUE} @${TRUE}
install: all .PHONY: all alt data everything clean clobber install \
${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null 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"
+12 -11
View File
@@ -1,4 +1,4 @@
Best Utility: # Best Utility:
Jens Schweikhardt Jens Schweikhardt
DFN Network Operation Center DFN Network Operation Center
@@ -8,18 +8,20 @@ Best Utility:
http://www.uni-stuttgart.de/People/schweikhardt/home.html http://www.uni-stuttgart.de/People/schweikhardt/home.html
## To build:
Judges' comments: make all
To use: ### To run
make schweikh3
WARNING! WARNING: Do not run this program without reading this text down to the end.
It may render your system unusable for a limited amount of time
or force you to reboot using the Big Red Button! This is not a joke.
You have been warned.
Do not run this program without reading this text down to the end. ./schweikh3
It may render your system unusable for a limited amount of time
or force you to reboot using the Big Red Button! This is not a joke. ## Judges' comments
You have been warned.
The source fails to compile on compilers that recognize the inline The source fails to compile on compilers that recognize the inline
keyword by default. For gcc, you may need to use -ansi. keyword by default. For gcc, you may need to use -ansi.
@@ -38,8 +40,7 @@ Judges' comments:
-I. -D_POSIX_SOURCE '-Ddifftime(a,b)=(double)(b-a)' \ -I. -D_POSIX_SOURCE '-Ddifftime(a,b)=(double)(b-a)' \
schweikh3.c -o schweikh3 schweikh3.c -o schweikh3
## Author's comments
Selected notes from the author:
Why I think my entry is obfuscated Why I think my entry is obfuscated
---------------------------------- ----------------------------------
+313 -133
View File
@@ -1,156 +1,336 @@
# %W% %G% %U% #!/usr/bin/env make
# #
# 1996 makefile # IOCCC 1996 winning entry - westley
################################################################################
# #
# Copyright (c) 1997, Landon Curt Noll & Sriram Srinivasan # An Historical Makefile NOTE:
# All Rights Reserved. Permission for personal, educational or non-profit #
# use is granted provided this this copyright and notice are included in its # The orig.Makefile, if it exits, is the original Makefile before this IOCCC
# entirety and remains unaltered. All other uses must receive prior permission # year directory was reworked so that entries are in separate directories.
# from Landon Curt Noll and Sriram Srinivasan. # This also applies to any orig.ansi.mk and orig.common.mk files.
#
# Several Makefiles were modified / formed in 2022, and as such it may have
# elements that are not historically compatible with way entries were built.
# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile.
#
# Regarding individual entries:
#
# IOCCC winning entry code may not work on your system. Even with standards,
# conditions and build environments change, especially when it comes to more
# extreme code such you might find in an IOCCC winner. Moreover, what was
# allowed and liked in one IOCCC contest may no longer be liked/allowed in
# later IOCCC years.
#
# Corrections on winning author and fixing typos in remarks are VERY WELCOME.
#
# GitHub pull requests are welcome:
#
# If you have a patch that might make running an entry work in modern Unix-like
# environments, please create a GitHub pull request for the IOCCC judges to
# consider.
#
# Suggestions and corrections regarding Makefiles, winning author information,
# fixing typos in remarks, and code patches are welcome via opening a GitHub
# issue or better yet, by creating a GitHub pull request for the IOCCC judges
# to consider. To form a GitHub issue or GitHub pull, please visit:
#
# https://github.com/ioccc-src/winner
#
################################################################################
# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under:
#
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
#
# See: http://creativecommons.org/licenses/by-sa/3.0/
SHELL=/bin/sh #############################
CAT=cat # shell used by this Makefile
CHMOD=chmod #############################
CP=cp #
GUNZIP=gunzip SHELL= bash
UUDECODE=uudecode
LN=ln
RM=rm
SED=sed
TRUE=true
# flags for ANSI compiles #######################
# common tool locations
#######################
# #
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode, include ../../var.mk
# others such as gcc may want -ansi, others may want nothing
# at all. Adjust the CFLAGS line as needed.
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# incorrectly. You might want to turn on -O to see if your
# compiler can handle them.
#
#CFLAGS=-O -Xa
#CFLAGS=-Xa
#CFLAGS= -ansi
CFLAGS= -ansi -O
#CFLAGS=
# ANSI compiler # Set X11_LIBDIR to the directory where the X11 library resides
# #
# Set CC to the name of your ANSI compiler. #X11_LIBDIR= /usr/X11R6/lib
CC=cc #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-char-subscripts -Wno-error -Wno-implicit-function-declaration \
-Wno-int-to-pointer-cast
# Common C compiler warning flags
#
#CWARN= ${CSILENCE}
#CWARN= -Wall ${CSILENCE}
CWARN= -Wall -Wextra ${CSILENCE}
#CWARN= -Wall -Wextra -pedantic ${CSILENCE}
# Compiler standard
#
#CSTD=
#CSTD= -ansi
CSTD= -std=gnu90
# Compiler bit architecture
#
# Some entries require 32-bitness:
# ARCH= -m32
#
# Some entries require 64-bitness:
# ARCH= -m64
#
# By default we assume nothing:
#
ARCH=
# Defines that are needed to compile
#
CDEFINE=
#CDEFINE= -DIOCCC
# Include files that are needed to compile
#
CINCLUDE=
#CINCLUDE= -include stdlib.h
#CINCLUDE= -include stdio.h
#CINCLUDE= -include stdlib.h -include stdio.h
#CINCLUDE= -I ${X11_INCDIR}
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
# Optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
# Reasonable compilers will allow for -O3.
#
#OPT=
#OPT= -O
#OPT= -O1
#OPT= -O2
OPT= -O3
# Default flags for ANSI C compilation
#
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# Libraries needed to build
#
LIBS=
#LIBS= -lm
#LIBS= -L ${X11_LIBDIR} -lX11
#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL
# C compiler to use
#
CC= cc
#CC=clang
#CC=gcc #CC=gcc
# winners that compile under ANSI C # Compiler add-ons or replacements for clang only
# #
WINNERS= august dalbec eldby gandalf huffman jonth rcm schweikh1 \ ifeq ($(CC),clang)
schweikh2 schweikh3 westley
ALT_NAMES= august.orig
LEVEL=5
all: $(WINNERS)
# NOTE: Some compilers will compile this code into infinite loop
# progs. We have found gcc to work on a number of platforms.
# If the following example does not execute in a very
# short time, try a better compiler:
# #
# cat august.c test.oc | ./august > test.oo CSILENCE+= -Wno-bad-function-cast -Wno-pedantic -Wno-poison-system-directories
#
august: august.c fac.oc parse.oc test.oc
${CC} ${CFLAGS} -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.c -o august
${CHMOD} +r fac.oc parse.oc test.oc
# This forms a byte code execution engine written in OC
# #
august.oc: august.c CWARN+= -Weverything
${RM} -f august.oc
${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.c > august.oc
${CHMOD} +r august.oc
# NOTE: this is the original source that won
# #
august.orig: august.orig.c fac.oc parse.oc test.oc endif
${CC} ${CFLAGS} -DZ=60000 -DZ=60000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.orig.c -o august.orig
${RM} -f august.oc
${CC} ${CFLAGS} -E -DZ=40000 -D'T=m[s]' -D'P=m[s++]' \
-D'L=m[p++]' -D'g=getchar()' -DE=else -DW=while -D'B=m[p++]' \
-DI=if -DR='s=s+l/2;T=r;I(l%2)s++' -D'X=m[s-' \
-D'D=Q(13,-)Q(14,*)Q(15,/)Q(16,%)Q(6,==)Q(7,!=)Q(8,<)C(1,r=P;m[T]=r;T=r)C(9,r=P;m[T]=r;s++)' \
august.orig.c > august.oc
${CHMOD} +r fac.oc parse.oc test.oc august.oc
dalbec: dalbec.c # Specific add-ons or replacements for gcc only
${CC} ${CFLAGS} dalbec.c -o dalbec
eldby: eldby.c
${CC} ${CFLAGS} eldby.c -o eldby
gandalf: gandalf.c
${CC} ${CFLAGS} gandalf.c -o gandalf
${RM} -f hatcat cathat
${CP} gandalf hatcat
${CP} gandalf cathat
huffman: huffman.c
${CC} ${CFLAGS} huffman.c -o huffman
# Add -I${X}/include and -L${X}/lib if this doesn't build
# (X is the root of the X Window distribution)
# Solaris users add -lsocket
# #
jonth: jonth.c ifeq ($(CC),gcc)
${CC} ${CFLAGS} jonth.c -o jonth -lX11 -lm
rcm: rcm.c
${CC} ${CFLAGS} -DJ='if(' -Ds='else J O==' -DU='B(' \
-DX='for(' -DH='unsigned' -Dn='struct x' -DA='0,0,0,0,' \
-DT='<stdio.h>' -DY='<stdlib.h>' -DR='malloc(sizeof(n))' \
-DM='%=K' -DK=32768 -DD='getchar()' -DN=putchar rcm.c -o rcm
schweikh1: schweikh1.c errno.h
${CC} ${CFLAGS} -I. schweikh1.c -o schweikh1
schweikh2: schweikh2.c hunni.c hunni.pl
${CC} ${CFLAGS} -D_POSIX_SOURCE schweikh2.c -o schweikh2
# NOTE: On some systems such as SunOS, one may need to compile with:
# #
# ${CC} ${CFLAGS} \ #CSILENCE+=
# -I. -D_POSIX_SOURCE '-Ddifftime(a,b)=(double)(b-a)' \ #
# schweikh3.c -o schweikh3 #CWARN+=
# #
schweikh3: schweikh3.c iso646.h endif
${CC} ${CFLAGS} -I. -D_POSIX_SOURCE schweikh3.c -o schweikh3
westley: westley.c clock1 clock2 clock3
${CC} ${CFLAGS} westley.c -o westley
${CHMOD} +x clock1 clock2 clock3
clean: ##############################
${RM} -f *.o a.out core ${WINNERS} # Special flags for this entry
##############################
#
ENTRY= westley
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA= clock1 clock2 clock3
TARGET= ${PROG}
#
ALT_OBJ=
ALT_TARGET=
clobber: clean
${RM} -f $(WINNERS)
${RM} -f $(ALT_NAMES)
${RM} -f fac.oo parse.oo test.oo hatcat cathat august.oc
nuke: clobber #################
# build the entry
#################
#
all: data ${TARGET}
@${TRUE} @${TRUE}
install: all .PHONY: all alt data everything clean clobber install \
${CAT} $(WINNERS) $(ALT_NAMES) > /dev/null 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 -6
View File
@@ -1,4 +1,4 @@
Best One Liner: # Best One Liner:
Brian Westley (Merlyn LeRoy on Usenet) Brian Westley (Merlyn LeRoy on Usenet)
1906 James Ave. 1906 James Ave.
@@ -7,13 +7,16 @@ Best One Liner:
http://www.visi.com/~westley/index.html http://www.visi.com/~westley/index.html
## To build:
Judges' comments: make all
### To run
To use:
make westley
sh ./clock1 sh ./clock1
## Judges' comments
Also try: Also try:
sh ./clock2 sh ./clock2
@@ -27,8 +30,7 @@ Judges' comments:
short line. We think you will as well if you take the time to short line. We think you will as well if you take the time to
understand it. understand it.
## Author's comments
Selected notes from the author:
This 1-line program allows various analog ASCII clocks This 1-line program allows various analog ASCII clocks
to print out the time; the ASCII clock is built from to print out the time; the ASCII clock is built from
Regular → Executable
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/sh #!/usr/bin/env sh
./westley \ ./westley \
"%%%&&&'''666EEESSSaaannn{{{zzzyyyxxxwwwhhhYYYKKK===000###\$\$\$" \ "%%%&&&'''666EEESSSaaannn{{{zzzyyyxxxwwwhhhYYYKKK===000###\$\$\$" \
"34CQ_lkj[M?234CQ_lkj[M?2" \ "34CQ_lkj[M?234CQ_lkj[M?2" \
Regular → Executable
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/sh #!/usr/bin/env sh
./westley \ ./westley \
"%%%\$\$\$###000===KKKYYYhhhwwwxxxyyyzzz{{{nnnaaaSSSEEE666'''&&&" \ "%%%\$\$\$###000===KKKYYYhhhwwwxxxyyyzzz{{{nnnaaaSSSEEE666'''&&&" \
"32?M[jkl_QC432?M[jkl_QC4" \ "32?M[jkl_QC432?M[jkl_QC4" \
Regular → Executable
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/sh #!/usr/bin/env sh
./westley \ ./westley \
"123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_\`abcdefghijkl" \ "123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_\`abcdefghijkl" \
"/\$%&'()*+,-./\$%&'()*+,-." \ "/\$%&'()*+,-./\$%&'()*+,-." \