Rename wrongly named author/winner handles
There were many files renamed in this commit and I hope I got all the references to the old names changed to the new names. To explain this commit there were some older entries that had the wrong directory name: not the surname but something else. Very possibly there are other directories that need to be renamed and I am actually aware of one right now but since it's in 2005 (which is close to being worked on) I am not changing that now but just noting it: 2005/anon should be changed to 2005/anonymous (unless there's a very good reason I am unaware of). But like I said since 2005 will be worked on soon I have not touched it. The Makefiles, .gitignore, the all/summary.txt, years.html and winners.html files as well as the directories and the files under the renamed directories have all been updated. This is a rather big update and it might be that there are conflicts. If so I will fix them. I will have to update 2005/anon later on to try and prevent this from happening but very possibly there will be conflicts here. It's also possible I missed some changes in years.html and/or winners.html and/or summary/all.txt but I think I got them all. These should be verified later on.
This commit is contained in:
1 parent
9e540136d1
commit
ad04d21fda
52 files changed
+163
-162
No files matched your search
@@ -1,3 +0,0 @@
|
||||
am
|
||||
am.safe
|
||||
ant
|
||||
@@ -1,340 +0,0 @@
|
||||
#!/usr/bin/env make
|
||||
#
|
||||
# IOCCC 1992 winning entry - ant
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# 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 used by this Makefile
|
||||
#############################
|
||||
#
|
||||
SHELL= bash
|
||||
|
||||
#######################
|
||||
# common tool locations
|
||||
#######################
|
||||
include ../../var.mk
|
||||
#
|
||||
|
||||
# Set X11_LIBDIR to the directory where the X11 library resides
|
||||
#
|
||||
#X11_LIBDIR= /usr/X11R6/lib
|
||||
#X11_LIBDIR= /usr/X11/lib
|
||||
X11_LIBDIR= /opt/X11/lib
|
||||
|
||||
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
|
||||
#
|
||||
#X11_INCDIR= /usr/X11R6/include
|
||||
#X11_INCDIR= /usr/X11/include
|
||||
X11_INCDIR= /opt/X11/include
|
||||
|
||||
# Common C compiler warnings to silence
|
||||
#
|
||||
#CSILENCE=
|
||||
CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-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
|
||||
|
||||
# Compiler add-ons or replacements for clang only
|
||||
#
|
||||
ifeq ($(CC),clang)
|
||||
#
|
||||
CSILENCE+= -Wno-conditional-uninitialized -Wno-implicit-int-conversion \
|
||||
-Wno-missing-prototypes -Wno-missing-variable-declarations \
|
||||
-Wno-poison-system-directories -Wno-shadow -Wno-shorten-64-to-32 \
|
||||
-Wno-sign-conversion -Wno-strict-prototypes
|
||||
#
|
||||
CWARN+= -Weverything
|
||||
#
|
||||
endif
|
||||
|
||||
# Specific add-ons or replacements for gcc only
|
||||
#
|
||||
ifeq ($(CC),gcc)
|
||||
#
|
||||
#CSILENCE+=
|
||||
#
|
||||
#CWARN+=
|
||||
#
|
||||
endif
|
||||
|
||||
|
||||
##############################
|
||||
# Special flags for this entry
|
||||
##############################
|
||||
#
|
||||
ENTRY= ant
|
||||
PROG= ${ENTRY}
|
||||
#
|
||||
OBJ= ${PROG}.o
|
||||
DATA=
|
||||
TARGET= ${PROG}
|
||||
#
|
||||
ALT_OBJ=
|
||||
ALT_TARGET=
|
||||
|
||||
|
||||
#################
|
||||
# build the entry
|
||||
#################
|
||||
#
|
||||
all: data ${TARGET}
|
||||
@${TRUE}
|
||||
|
||||
.PHONY: all alt data everything clean clobber install \
|
||||
love haste waste maker easter_egg sandwich \
|
||||
am am_clobber \
|
||||
supernova deep_magic magic charon pluto
|
||||
|
||||
${PROG}: ${PROG}.c
|
||||
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
||||
|
||||
am: ${PROG}
|
||||
${RM} -f $@
|
||||
${LN} $< $@
|
||||
|
||||
# alternative executable
|
||||
#
|
||||
alt: data ${ALT_TARGET}
|
||||
@${TRUE}
|
||||
|
||||
# data files
|
||||
#
|
||||
data: ${DATA}
|
||||
@${TRUE}
|
||||
|
||||
# both all and alt
|
||||
#
|
||||
everything: all alt
|
||||
|
||||
|
||||
###############
|
||||
# utility rules
|
||||
###############
|
||||
#
|
||||
clean:
|
||||
${RM} -f ${OBJ} ${ALT_OBJ}
|
||||
@-if [ -f indent.c ]; then \
|
||||
echo ${RM} -f indent.c; \
|
||||
${RM} -f indent.c; \
|
||||
fi
|
||||
|
||||
clobber: clean
|
||||
${RM} -f ${TARGET} ${ALT_TARGET}
|
||||
${RM} -f am am.safe
|
||||
@-if [ -e sandwich ]; then \
|
||||
${RM} -f sandwich; \
|
||||
echo 'ate sandwich'; \
|
||||
fi
|
||||
|
||||
am_clobber: clean am
|
||||
${RM} -f am.safe
|
||||
${CP} am am.safe
|
||||
${CP} am.safe am
|
||||
${RM} -f am.safe
|
||||
|
||||
install:
|
||||
@echo "Dr. Spock says that is not logical!"
|
||||
@${TRUE}
|
||||
|
||||
# you may be able to misunderstand the source by reading indent.c
|
||||
#
|
||||
indent.c: ${PROG}.c
|
||||
@if which "${GINDENT}" >/dev/null 2>&1; then \
|
||||
echo ${RM} -f $@; \
|
||||
${RM} -f $@; \
|
||||
echo "${GINDENT} < $< > $@"; \
|
||||
${GINDENT} < $< > $@; \
|
||||
elif which "${INDENT}" >/dev/null 2>&1; then \
|
||||
echo ${RM} -f $@; \
|
||||
${RM} -f $@; \
|
||||
echo "${INDENT} < $< > $@"; \
|
||||
${INDENT} < $< > $@; \
|
||||
else \
|
||||
echo "no intent tool found, ident $< yourself, sorry"; \
|
||||
echo "exit 1"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
|
||||
##################
|
||||
# 133t hacker rulz
|
||||
##################
|
||||
#
|
||||
love:
|
||||
@echo 'not war?'
|
||||
@${TRUE}
|
||||
|
||||
haste:
|
||||
$(MAKE) waste
|
||||
@${TRUE}
|
||||
|
||||
waste:
|
||||
@echo 'haste'
|
||||
@${TRUE}
|
||||
|
||||
maker:
|
||||
@echo 'Participate in a maker faire'
|
||||
@${TRUE}
|
||||
|
||||
easter_egg:
|
||||
@echo "you expected to often misunderstand this $${RANDOM} magic"
|
||||
@echo "chongo '<was here>' /\\oo/\\"
|
||||
@echo "Eggy"
|
||||
|
||||
sandwich: easter_egg
|
||||
@if [ `id -u` -eq 0 ]; then \
|
||||
echo 'Okay.'; \
|
||||
echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \
|
||||
else \
|
||||
echo 'What? Make it yourself.'; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
# Understand the history of the Homebrew Computer Club
|
||||
# as well as the West Coast Computer Faire and
|
||||
# you might be confused different. :-)
|
||||
#
|
||||
supernova: sandwich
|
||||
@-if [ -r .code_anal ]; then \
|
||||
${RM} -f .code_anal_v6; \
|
||||
else \
|
||||
echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \
|
||||
fi
|
||||
@echo "A $@ helps ${MAKE} the elements that help form planets"
|
||||
@${TRUE}
|
||||
|
||||
deep_magic: supernova
|
||||
@-if [ -r .code_anal ]; then \
|
||||
ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \
|
||||
--FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
|
||||
else \
|
||||
echo "Wrong! Do it again!"; \
|
||||
sleep 2; \
|
||||
echo "Wrong! Do it again!"; \
|
||||
sleep 2; \
|
||||
echo "Wrong! Do it again!"; \
|
||||
fi
|
||||
@${TRUE}
|
||||
|
||||
magic: deep_magic
|
||||
@-if [ -r .code_anal ]; then \
|
||||
ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
|
||||
else \
|
||||
echo "If you don't eat yer meat, you can't have any pudding!"; \
|
||||
echo "How can you have any pudding if you don't eat yer meat?!"; \
|
||||
fi
|
||||
@${TRUE}
|
||||
|
||||
# The IOCCC resident astronomer states
|
||||
#
|
||||
charon: magic
|
||||
@echo "$@ is a dwarf planet"
|
||||
@echo "dwarf is a type of planet"
|
||||
@echo "therefore IAU, $@ is a planet"
|
||||
|
||||
pluto: charon
|
||||
${MAKE} charon
|
||||
@echo "$@ is a dwarf planet"
|
||||
@echo "dwarf is a type of planet"
|
||||
@echo "therefore, $@ is a planet"
|
||||
@echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them"
|
||||
@@ -1,42 +0,0 @@
|
||||
# Best Utility:
|
||||
|
||||
Anthony C Howe
|
||||
Mortice Kern Systems Inc.
|
||||
Unit 1, 14 Weber Street North
|
||||
Waterloo, Ontario
|
||||
N2J 3G4
|
||||
Canada
|
||||
|
||||
## To build:
|
||||
|
||||
make all
|
||||
|
||||
### To run
|
||||
|
||||
./am ant.test.mk
|
||||
|
||||
## Judges' comments
|
||||
|
||||
|
||||
Like much of Posix, obfuscation has its place. Your task is to
|
||||
figure out where.
|
||||
|
||||
This entry comes complete with a Posix-like command description.
|
||||
Interested Posix balloters should lobby the IEEE for an obfuscated
|
||||
P1003 sub-committee.
|
||||
|
||||
We also suggest that you try:
|
||||
|
||||
make am
|
||||
./am Makefile am_clobber # clobber everything except am
|
||||
./am Makefile all
|
||||
|
||||
## Author's comments
|
||||
|
||||
See the file ant.README.
|
||||
|
||||
Copyright (c) 1992, Landon Curt Noll & Larry Bassel.
|
||||
All Rights Reserved. Permission for personal, educational or non-profit use is
|
||||
granted provided this this copyright and notice are included in its entirety
|
||||
and remains unaltered. All other uses must receive prior permission in writing
|
||||
from both Landon Curt Noll and Larry Bassel.
|
||||
@@ -1,271 +0,0 @@
|
||||
NAME
|
||||
|
||||
am Anthony's Make
|
||||
|
||||
|
||||
SYNOPSIS
|
||||
|
||||
am <makefile> [target]
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
AM is a programmer's tool to maintain, update, and regenerate groups
|
||||
of files and/or programs. It is similar to MAKE as described by the
|
||||
POSIX.2 draft standard 11.2, and this document parallels the draft
|
||||
in order to point out the subtle differences between AM and MAKE.
|
||||
|
||||
The AM utility can be used as part of software development to update
|
||||
files that are derived from other files. A typical case is one where
|
||||
object files are derived from the corresponding source files. The AM
|
||||
utility examines time relationships and updates those derived files
|
||||
(targets) that have modified times earlier than the modified times of
|
||||
the files (prerequisites) from which they are derived. A description
|
||||
file ("makefile") contains a description of the relationships between
|
||||
files, and the commands that must be executed to update the targets to
|
||||
reflect changes in their prerequisites. Each specification, or rule,
|
||||
shall consist of a target, optional prerequisites, and optional
|
||||
commands to be executed when a prerequisite is newer than the target.
|
||||
|
||||
|
||||
OPTIONS
|
||||
|
||||
None.
|
||||
|
||||
|
||||
OPERANDS
|
||||
|
||||
makefile This required argument, is a pathname of a description
|
||||
file, which is also referred to as the "makfile". A
|
||||
pathname of "-", shall *NOT* denote the standard input.
|
||||
|
||||
target This optional argument, is the first target to be
|
||||
processed. If no target is specified, when AM is
|
||||
processing the makefile, the first target that AM
|
||||
encounters shall be used.
|
||||
|
||||
|
||||
EXTERNAL INFLUENCES
|
||||
|
||||
STANDARD INPUT
|
||||
|
||||
Not used.
|
||||
|
||||
|
||||
INPUT FILES
|
||||
|
||||
The input file, otherwise known as the makefile, is a text file
|
||||
containing rules, macro definitions, and comments.
|
||||
|
||||
|
||||
ASYNCHRONOUS EVENTS
|
||||
|
||||
All traps are left to their default actions. If AM receives a SIGHUP,
|
||||
SIGTERM, SIGINT, or SIGQUIT then AM will terminate as per request
|
||||
*WITHOUT* removing the current target.
|
||||
|
||||
|
||||
EXTERNAL EFFECTS
|
||||
|
||||
STANDARD OUTPUT
|
||||
|
||||
The AM utility shall write all commands to be executed to standard
|
||||
output unless the command is prefixed with an at-sign (@). If AM is
|
||||
invoked without any work needing to be done, it shall *NOT* write a
|
||||
message to standard output indicating that no action was taken.
|
||||
|
||||
|
||||
STANDARD ERROR
|
||||
|
||||
Standard error is used for diagnostic messages only.
|
||||
|
||||
|
||||
OUTPUT FILES
|
||||
|
||||
None. However, the utilities invoked by AM may create additional files.
|
||||
|
||||
|
||||
EXTENDED DESCRIPTION
|
||||
|
||||
The AM utility attempts to perform the actions required to ensure
|
||||
that the specified target(s) are up-to-date. A target is considered
|
||||
out-of-date if it is older than any of its prerequisites or it does
|
||||
not exist. The AM utility shall treat all prerequisites as targets
|
||||
themselves and recursively ensure that they are up-to-date, processing
|
||||
them in the order which they appear in the rule. The AM utility shall
|
||||
use the modification times of files to determine if the corresponding
|
||||
targets are out-of-date.
|
||||
|
||||
After AM has ensured that all of the prerequisites of a target are
|
||||
up-to-date, and if the target is out-of-date, the commands associated
|
||||
with the target entry shall be executed. If there are no commands
|
||||
listed for the target, the target shall be treated as up-to-date.
|
||||
|
||||
|
||||
MAKEFILE SYNTAX
|
||||
|
||||
A makefile can contain rules, macro definitions, and comments. If a
|
||||
macro is defined more than once, the value of the macro shall be the
|
||||
last one specified. Comments start with a number-sign (#) and
|
||||
continue until an unescaped <newline> is reached.
|
||||
|
||||
A backslash before a <newline> serves as a line continuation mark, and
|
||||
is used to create long-lines. A line will continue to be extended until
|
||||
an unescaped <newline> is reached.
|
||||
|
||||
When an escaped <newline> (one preceded by a backslash) is found anywhere
|
||||
in the makefile, it shall be replaced, along with any leading white
|
||||
space on the following line, with a single <space>.
|
||||
|
||||
|
||||
MAKEFILE EXECUTION
|
||||
|
||||
Command lines shall be processed one at a time by writing the command
|
||||
line to standard output, unless prefixed with an at-sign (@), and
|
||||
executing the command(s) in the line. Commands shall be executed by
|
||||
passing the command line to the command interpreter via the system()
|
||||
function.
|
||||
|
||||
The environment for the command being executed shall contain all of the
|
||||
variables in the environment of AM. All macros are considered to be part
|
||||
of the environment too.
|
||||
|
||||
By default, when AM receives a non-zero status from the execution of a
|
||||
command, it terminates with an error message to standard error. If
|
||||
the command is prefixed by a hyphen (-) then any error found while
|
||||
executing the command shall be ignored.
|
||||
|
||||
Command lines can have one or more of the following prefixes: a hyphen
|
||||
(-) to ignore errors, an at-sign (@) to be silent, or a plus-sign (+)
|
||||
if the command is always executed (this prefix is for compatibility with
|
||||
MAKE and is ignored).
|
||||
|
||||
|
||||
TARGET RULES
|
||||
|
||||
Target rules are formatted as follows:
|
||||
|
||||
target [target ...] : [prerequisite ...]
|
||||
[<tab>command
|
||||
<tab>command
|
||||
...]
|
||||
|
||||
(line that does not begin with <tab>)
|
||||
|
||||
Target entries are specified by a <blank>-separated, non-null list of
|
||||
targets, then a colon, then a <blank>-separated, possibly empty list
|
||||
of prerequisite. All following lines, if any, that begin with a <tab>,
|
||||
are command lines to be executed to update the target(s). The first
|
||||
line that does not begin with a <tab> shall begin a new entry.
|
||||
|
||||
Target names can be any character supported by the host system,
|
||||
excluding <blank>s, <tab>s, <newline>s, and colons (:), which are used
|
||||
for delimiters.
|
||||
|
||||
For any given target there can be only one target rule. The first
|
||||
occurrence of a target in a makefile shall be used. All subsequent
|
||||
rules for the same target are ignored. There is *no* support for
|
||||
adding prerequisites to a target's prerequisite list once a target
|
||||
rule is defined.
|
||||
|
||||
There are no special targets or inference rule support.
|
||||
|
||||
|
||||
MACROS
|
||||
|
||||
Macro definitions are in the form:
|
||||
|
||||
string1 = [string2]
|
||||
|
||||
The macro named string1 is defined as having the value of string2,
|
||||
where string2 is defined as all characters, if any, after the equal
|
||||
sign up to an unescaped <newline>. Any <blank>s immediately before or
|
||||
after the equal sign shall be ignored.
|
||||
|
||||
Subsequent appearances of $(string1) shall be replaced by string2.
|
||||
The parentheses are *NOT* optional if string1 is a single character.
|
||||
The macro $$ shall be replaced by the single character $.
|
||||
|
||||
Macro names can be any character that the host system would allow in
|
||||
the definition of environment variables, excluding parentheses, ( and ),
|
||||
which are used for delimiters.
|
||||
|
||||
Macros can appear anywhere in the makefile, except within other macro
|
||||
references (ie. no nesting). Macros in target and command lines shall
|
||||
be evaluated when the line is read. Macros in macro definition lines
|
||||
shall be evaluated *IMMEDIATELY*. A macro that has not been defined
|
||||
shall evaluate to a null string without causing any error condition.
|
||||
|
||||
If a macro is defined more than once, the value of the macro shall be the
|
||||
last one specified prior to it being referenced.
|
||||
|
||||
Macro assignments shall be accepted from the sources listed below, in
|
||||
the order shown. If a macro name already exists at the time it is being
|
||||
processed, the newer definition shall replace the existing definition.
|
||||
|
||||
1) The contents of the environment, including the variables with
|
||||
null values in the order defined in the environment.
|
||||
|
||||
2) Macros defined in the makefile, processed in the order specified.
|
||||
|
||||
There are no internal macros supported. The SHELL macro shall *NOT* be
|
||||
treated specially.
|
||||
|
||||
|
||||
EXIT STATUS
|
||||
|
||||
0 Successful completion.
|
||||
1 General error.
|
||||
2 Usage error.
|
||||
3 Failed to open makefile.
|
||||
4 Failed to allocate memory.
|
||||
|
||||
|
||||
INSTALLATION
|
||||
|
||||
AM can be built on any system providing at least K&R C. It has been
|
||||
tested on
|
||||
|
||||
o SunOS with GCC
|
||||
o ATARI Mega ST with Sozobon C
|
||||
o PC clone with Turbo C
|
||||
o Interactive UNIX System V/386 release 3.2
|
||||
|
||||
For all machines, the compile command line should be
|
||||
|
||||
cc -O -o am am.c
|
||||
|
||||
The value RULES represents the number of slots available to record
|
||||
target rules, dependencies, and commands. The default value chosen
|
||||
should handle most project makefiles. RULES can be overridden on the
|
||||
command line with -DRULES=nn, where 0 < nn < INT_MAX.
|
||||
|
||||
On a DOS machine using Turbo C, it may be necessary to add the include
|
||||
directive
|
||||
|
||||
#include <time.h>
|
||||
|
||||
with the rest of the includes if sys/stat.h does not properly define or
|
||||
use time_t. Also, on some older K&R C compilers, stdlib.h may not be
|
||||
defined and so it might be necessary to remove the include directive for
|
||||
it.
|
||||
|
||||
|
||||
REFERENCES
|
||||
|
||||
[Mil87] Webb Miller, "A Software Tools Sampler", Prentice Hall, 87
|
||||
ISBN 0-13-822305-X, chaper 2
|
||||
|
||||
[POSIX] POSIX.2 draft 11.2 MAKE
|
||||
|
||||
|
||||
FILES
|
||||
|
||||
ant.c Obfuscated source
|
||||
ant.README Manual for AM
|
||||
ant.test.mk Test makefile
|
||||
|
||||
|
||||
BUGS
|
||||
|
||||
Unknown as of 20 March 92.
|
||||
-178
@@ -1,178 +0,0 @@
|
||||
#define W while
|
||||
#define S strspn
|
||||
#define R return
|
||||
#define F fprintf(stderr,
|
||||
#define C continue;
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifndef RULES
|
||||
#define RULES 500
|
||||
#endif
|
||||
|
||||
#define N(p, i) (p += i, p += S(p, w), i = strcspn(p, w))
|
||||
|
||||
char *b, l[BUFSIZ], *t[RULES], *d[RULES], *c[RULES], w[] = "\n\t ";
|
||||
|
||||
time_t M();
|
||||
int T();
|
||||
void U();
|
||||
|
||||
|
||||
time_t
|
||||
M(f)
|
||||
char *f;
|
||||
{
|
||||
int j, x;
|
||||
size_t i = 0;
|
||||
struct stat s;
|
||||
N(f, i);
|
||||
x = f[i];
|
||||
f[i] = 0;
|
||||
j = stat(f, &s);
|
||||
f[i] = x;
|
||||
R j < 0 ? 0 : s.st_mtime;
|
||||
}
|
||||
|
||||
int
|
||||
T(f)
|
||||
char *f;
|
||||
{
|
||||
char *q;
|
||||
size_t i = 0, j, k = 1;
|
||||
N(f, i);
|
||||
W ((q = t[k])) {
|
||||
j = 0;
|
||||
W (N(q, j)) {
|
||||
if (i == j && !strncmp(f, q, i))
|
||||
R k;
|
||||
}
|
||||
++k;
|
||||
}
|
||||
R 0;
|
||||
}
|
||||
|
||||
void
|
||||
U(f)
|
||||
char *f;
|
||||
{
|
||||
time_t t = M(f);
|
||||
size_t i = 0, j = !t, k = T(f);
|
||||
char *p = d[k], *q = c[k];
|
||||
if (!N(p, i) && q && *q != '\t' && j) {
|
||||
F "am: Don't know how to make '%s'.\n", f);
|
||||
exit(1);
|
||||
}
|
||||
W (0 < i) {
|
||||
U(p);
|
||||
if (t < M(p))
|
||||
j = 1;
|
||||
N(p, i);
|
||||
}
|
||||
if (j && q && *q == '\t') {
|
||||
sleep(1);
|
||||
W (*q++ == '\t') {
|
||||
i = j = 1;
|
||||
W (0 < S(q, "-+@")) {
|
||||
if (*q == '@')
|
||||
|
||||
i = 0;
|
||||
if (*q++ == '-')
|
||||
|
||||
j = 0;
|
||||
}
|
||||
if (i)
|
||||
puts(q);
|
||||
if (system(q) && j) {
|
||||
F "am: Error making '%s'\n", f);
|
||||
exit(1);
|
||||
}
|
||||
q += strlen(q) + 1;
|
||||
}
|
||||
c[k] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(u, v)
|
||||
int u;
|
||||
char **v;
|
||||
{
|
||||
FILE *f;
|
||||
struct stat s;
|
||||
size_t i, j, k;
|
||||
char *m, *n, *p, *q, *r;
|
||||
if (u < 2) {
|
||||
F "usage: am <makefile> [target]\n");
|
||||
R 2;
|
||||
}
|
||||
if (stat(*++v, &s) || !(f = fopen(*v, "r")))
|
||||
R 3;
|
||||
q = b = malloc(2*s.st_size);
|
||||
if (!b)
|
||||
R 4;
|
||||
i = 1;
|
||||
k = 0;
|
||||
m = 0;
|
||||
*t = *d = *c = "";
|
||||
W ((r = fgets(l, BUFSIZ, f))) {
|
||||
if (RULES <= i) {
|
||||
F "am: Number of target-rules exceeds %d.\n", RULES);
|
||||
R 1;
|
||||
}
|
||||
if (k) {
|
||||
*q++ = ' ';
|
||||
r += S(r, w);
|
||||
} else {
|
||||
if (t[i])
|
||||
c[i++] = q;
|
||||
if (m && putenv(m))
|
||||
F "am: No more environment space.\n");
|
||||
m = 0;
|
||||
if (*l == '#' || *l == '\n')
|
||||
C
|
||||
p = q;
|
||||
}
|
||||
W (!(k = *r == '\\' && r[1] == '\n') && *r) {
|
||||
if (*r == '$') {
|
||||
if (r[1] == '(') {
|
||||
n = r+2;
|
||||
r += strcspn(r, ")");
|
||||
*r++ = 0;
|
||||
n = getenv(n);
|
||||
if (n)
|
||||
q = strcpy(q, n) + strlen(n);
|
||||
C
|
||||
}
|
||||
if (*r == r[1])
|
||||
++r;
|
||||
}
|
||||
if (*r == '=' && *l != '\t' && !m) {
|
||||
*q = 0;
|
||||
m = p;
|
||||
j = 0;
|
||||
q = N(m, j) + m;
|
||||
*q++ = *r;
|
||||
j = 1;
|
||||
if (!N(r, j))
|
||||
*q++ = 0;
|
||||
C
|
||||
}
|
||||
if (*r == ':') {
|
||||
t[i] = p;
|
||||
*r = 0;
|
||||
d[i] = q+1;
|
||||
}
|
||||
if (*r == '\n')
|
||||
*r = 0;
|
||||
*q++ = *r++;
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
U(2 < u ? *++v : t[1]);
|
||||
R 0;
|
||||
}
|
||||
|
||||
@@ -1,196 +0,0 @@
|
||||
#
|
||||
# Test makefile for AM
|
||||
#
|
||||
|
||||
#
|
||||
# Allow for empty macros.
|
||||
#
|
||||
EMPTY=
|
||||
|
||||
#
|
||||
# Allow for white space in macro assignment.
|
||||
#
|
||||
TEXT_1=no white space
|
||||
TEXT_2 =left hand side
|
||||
TEXT_3= right hand side
|
||||
TEXT_4 = both sides
|
||||
TEXT_5 = tabs boths sides
|
||||
|
||||
#
|
||||
# Test psuedo targets.
|
||||
#
|
||||
all : print_macros repeat redefine many flags multiple split errors done
|
||||
|
||||
print_macros : empty t1 t2 t3 t4 t5 t.all
|
||||
|
||||
#
|
||||
# Targets with no dependencies.
|
||||
#
|
||||
empty :
|
||||
echo EMPTY='$(EMPTY)'
|
||||
|
||||
t1 :
|
||||
echo TEXT_1='$(TEXT_1)'
|
||||
|
||||
t2 :
|
||||
echo TEXT_2='$(TEXT_2)'
|
||||
|
||||
t3 :
|
||||
echo TEXT_3='$(TEXT_3)'
|
||||
|
||||
t4 :
|
||||
echo TEXT_4='$(TEXT_4)'
|
||||
|
||||
t5 :
|
||||
echo TEXT_5='$(TEXT_5)'
|
||||
|
||||
t.all :
|
||||
echo $(TEXT_1) $(TEXT_2) $(TEXT_3) $(TEXT_4) $(TEXT_5)
|
||||
|
||||
#
|
||||
# Test redefinition of macros. AM allows redefinition and
|
||||
# evaluates macros immediately.
|
||||
#
|
||||
TEXT_1 =text number 1
|
||||
TEXT_2 = test macro split \
|
||||
across lines \
|
||||
three lines
|
||||
TEXT_3 = test dollar macro '$$'
|
||||
TEXT_4 = test dollar again "$$(TEXT_1)"
|
||||
TEXT_5 = imbeded macro '$(TEXT_1)'
|
||||
|
||||
redefine : r1 r2 r3 r4 r5
|
||||
|
||||
r1 :
|
||||
echo TEXT_1='$(TEXT_1)'
|
||||
|
||||
r2 :
|
||||
echo TEXT_2='$(TEXT_2)'
|
||||
|
||||
r3 :
|
||||
echo TEXT_3='$(TEXT_3)'
|
||||
|
||||
r4 :
|
||||
echo TEXT_4='$(TEXT_4)'
|
||||
|
||||
r5 :
|
||||
echo TEXT_5='$(TEXT_5)'
|
||||
|
||||
#
|
||||
# Try to update a prerequisite more than once. Subsequent occurences
|
||||
# should be ignored once a prerequisite has been updated.
|
||||
#
|
||||
repeat: t1 repeat.a t3
|
||||
repeat.a : t2 t1
|
||||
|
||||
|
||||
#
|
||||
# Target with multi-line receipe.
|
||||
#
|
||||
many : leaf.1 leaf.2
|
||||
echo Execute receipe with multiple commands.
|
||||
ls -1 leaf.*
|
||||
echo Last line of receipe for target 'many'.
|
||||
|
||||
leaf.1 :
|
||||
touch leaf.1
|
||||
|
||||
leaf.2 :
|
||||
touch leaf.2
|
||||
|
||||
|
||||
#
|
||||
# Test receipe line flags.
|
||||
#
|
||||
flags : silence ignore always combination
|
||||
|
||||
# Command not displayed before execution.
|
||||
silence :
|
||||
echo You should not see the 'ls' command printed.
|
||||
@ls leaf.*
|
||||
|
||||
# Ignore errors from command.
|
||||
ignore :
|
||||
echo The 'ls' command should fail but not terminate AM.
|
||||
-ls unknown
|
||||
|
||||
# This flag is ignored by AM since we don't support a silence option (-n).
|
||||
always :
|
||||
+echo The '+' flag is accepted and ignored.
|
||||
|
||||
combination:
|
||||
-@echo The next displayed line should not be 'ls unknown'
|
||||
@-ls unknown
|
||||
@+-echo Combined flags test completed.
|
||||
|
||||
|
||||
#
|
||||
# Multiple targets.
|
||||
#
|
||||
multiple : node.2 node.5
|
||||
|
||||
node.1 node.2 node.3 : leaf.1 leaf.2
|
||||
touch node.1 node.2 node.3
|
||||
|
||||
node.4 node.5 : node.2 leaf.3
|
||||
touch node.4 node.5
|
||||
|
||||
leaf.3 :
|
||||
touch leaf.3
|
||||
|
||||
|
||||
#
|
||||
# Test split lines.
|
||||
#
|
||||
split : node.6 leaf.4 split.cmd
|
||||
echo Completed split line tests.
|
||||
|
||||
# Target dependencies split across lines.
|
||||
node.6 : leaf.1 \
|
||||
leaf.2 \
|
||||
leaf.3
|
||||
echo Test dependency list split across lines.
|
||||
touch node.6
|
||||
|
||||
# Target list split across lines.
|
||||
split.tar \
|
||||
leaf.4 \
|
||||
leaf.5 :
|
||||
echo Test target list split across lines
|
||||
touch leaf.4 leaf.5
|
||||
|
||||
# Command lines split across lines.
|
||||
split.cmd:
|
||||
echo Try spliting command \
|
||||
lines across more \
|
||||
than one line.
|
||||
|
||||
|
||||
#
|
||||
# Test AM error reports and exit statuses.
|
||||
#
|
||||
errors:
|
||||
-am test.mk error.1
|
||||
-am test.mk error.2
|
||||
-am test.mk error.3
|
||||
|
||||
# Target that does not exist, has no dependencies, and no commands.
|
||||
error.1:
|
||||
|
||||
# Target where dependency does not exist.
|
||||
error.2: unknown
|
||||
|
||||
# Receipe command causes error.
|
||||
error.3: t1 fail t2
|
||||
fail:
|
||||
ls -l unknown
|
||||
|
||||
|
||||
#
|
||||
#
|
||||
#
|
||||
done:
|
||||
echo AM Test Complete
|
||||
|
||||
clean:
|
||||
rm leaf.* node.*
|
||||
Reference in new issue
Block a user