We swapped `2024/anders` and `2024/straadt` by accident.
Sorry (tm Canada 🇨🇦) about that!
We **SINCERELY APOLOGIZE** to both **Anders Kaare Straadt**
and **Sebastian Macke** for the mix up!
We normalized some of the `.gitignore` files for some
of the 2024 winning entries.
Rebuilt 2024 tar files.
Updated `sitemap.xml`.
Ran `make update` to perform the above.
225 lines
4.8 KiB
Makefile
225 lines
4.8 KiB
Makefile
#!/usr/bin/env make
|
|
#
|
|
# 2024/straadt
|
|
|
|
#############################
|
|
# shell used by this Makefile
|
|
#############################
|
|
|
|
SHELL= bash
|
|
|
|
|
|
#######################
|
|
# common tool locations
|
|
#######################
|
|
|
|
include ../../var.mk
|
|
|
|
|
|
#####################
|
|
# C compiler settings
|
|
#####################
|
|
|
|
# Common C compiler warnings to silence
|
|
#
|
|
# Example: CSILENCE= -Wno-poison-system-directories
|
|
#
|
|
CSILENCE= -Wno-bitwise-op-parentheses -Wno-int-in-bool-context \
|
|
-Wno-strict-prototypes -Wno-misleading-indentation -Wno-parentheses \
|
|
-Wno-sign-compare
|
|
|
|
# Attempt to silence unknown warning options
|
|
#
|
|
CUNKNOWN= -Wno-unknown-warning-option
|
|
|
|
# Common C compiler warning flags
|
|
#
|
|
# NOTE: The addition of -pedantic to CWARN is a challenge that
|
|
# You may wish to avoid if it proves too problematic.
|
|
# There is NO penalty for removing -pedantic from CWARN.
|
|
#
|
|
CWARN= -Wall -Wextra -pedantic ${CSILENCE} ${CUNKNOWN}
|
|
|
|
# Compiler standard
|
|
#
|
|
CSTD= -std=c11
|
|
|
|
# Compiler bit architecture
|
|
#
|
|
# Example for 32-bitness: ARCH= -m32
|
|
# Example for 64-bitness: ARCH= -m64
|
|
#
|
|
# NOTE: Normally one should NOT specify a specific architecture.
|
|
#
|
|
ARCH=
|
|
|
|
# Defines that are needed to compile
|
|
#
|
|
# Example: -Dfoo -Dbar=baz
|
|
#
|
|
CDEFINE=
|
|
|
|
# Include files that are needed to compile
|
|
#
|
|
# Example: CINCLUDE= -include stdio.h
|
|
#
|
|
CINCLUDE=
|
|
|
|
# Other flags to pass to the C compiler
|
|
#
|
|
# Example: COTHER= -fno-math-errno
|
|
#
|
|
COTHER=
|
|
|
|
# Optimization
|
|
#
|
|
# NOTE: Feel free to change the level of compiler optimization.
|
|
# The "-O3" is just a friendly default you might wish to try.
|
|
#
|
|
# Example: OPT= -O0 -g
|
|
#
|
|
OPT= -Os
|
|
|
|
# Default flags for ANSI C compilation
|
|
#
|
|
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${COTHER} ${OPT}
|
|
|
|
# Libraries needed to build
|
|
#
|
|
# Example: LDFLAGS= -lncurses -lm
|
|
#
|
|
LDFLAGS=
|
|
|
|
# C compiler to use
|
|
#
|
|
# NOTE: The IOCCC Judges recommend you leave CC as just "cc"
|
|
# and NOT set it to clang, or gcc, or something else
|
|
# unless you have a STRONG reason to do so.
|
|
#
|
|
# Setting CC to something other than "cc" makes your
|
|
# code less portable to those who do not have your
|
|
# particular C compiler. **hint**
|
|
#
|
|
# If you want to test your code with a particular C compiler,
|
|
# use the make command line. For example:
|
|
#
|
|
# make all CC=clang
|
|
# make all CC=gcc
|
|
#
|
|
CC= cc
|
|
|
|
# Compiler add-ons or replacements for clang only
|
|
#
|
|
ifeq "$(findstring $(CLANG),${CC})" "$(CLANG)"
|
|
#
|
|
# NOTE: This code is only invoked when CC is "clang"
|
|
# such as when you use the make command line:
|
|
#
|
|
# make all CC=clang
|
|
#
|
|
CSILENCE+= -Wno-bitwise-op-parentheses -Wno-cast-align -Wno-comma \
|
|
-Wno-implicit-int-conversion -Wno-int-in-bool-context \
|
|
-Wno-missing-prototypes -Wno-missing-variable-declarations \
|
|
-Wno-poison-system-directories -Wno-shorten-64-to-32 -Wno-sign-conversion \
|
|
-Wno-strict-prototypes -Wno-unsafe-buffer-usage
|
|
#
|
|
CWARN+= -Weverything
|
|
#
|
|
endif
|
|
|
|
# Specific add-ons or replacements for gcc only
|
|
#
|
|
ifeq "$(findstring $(GCC),${CC})" "$(GCC)"
|
|
#
|
|
# NOTE: This code is only invoked when CC is "gcc"
|
|
# such as when you use the make command line:
|
|
#
|
|
# make all CC=gcc
|
|
#
|
|
CSILENCE+=
|
|
#
|
|
CWARN+=
|
|
#
|
|
endif
|
|
|
|
|
|
###########################################
|
|
# Special Makefile variables for this entry
|
|
###########################################
|
|
|
|
ENTRY= prog
|
|
PROG= ${ENTRY}
|
|
#
|
|
OBJ= ${PROG}.o
|
|
TARGET= ${PROG}
|
|
#
|
|
ALT_OBJ=
|
|
ALT_TARGET=
|
|
|
|
# list any data files supplied with your submission
|
|
#
|
|
# Example: DATA= curds whey
|
|
#
|
|
DATA= a ${PROG}.wasm
|
|
|
|
|
|
#################
|
|
# build the entry
|
|
#################
|
|
|
|
all: data ${TARGET}
|
|
@${TRUE}
|
|
|
|
.PHONY: all alt data everything clean clobber
|
|
|
|
# how to compile
|
|
#
|
|
${PROG}: ${PROG}.c
|
|
${CC} ${CFLAGS} ${PROG}.c -o $@ ${LDFLAGS}
|
|
|
|
${PROG}.wasm: ${PROG}.c wasm_include/stdio.h wasm_include/termios.h wasm_include/unistd.h
|
|
@if [[ ! -s ${PROG}.wasm ]]; then \
|
|
echo ${CLANG} -Os -nostdlib -Iwasm_include --target=wasm32 ${PROG}.c -o ${PROG}.wasm -Wno-builtin-requires-header -Wno-c23-extensions -Wl,--allow-undefined -Wl,--no-entry -Wl,--export-all; \
|
|
${CLANG} -Os -nostdlib -Iwasm_include --target=wasm32 ${PROG}.c -o ${PROG}.wasm -Wno-builtin-requires-header -Wno-c23-extensions -Wl,--allow-undefined -Wl,--no-entry -Wl,--export-all; \
|
|
else \
|
|
echo "make $@: File already exists: ${PROG}.wasm"; \
|
|
echo "make $@: To force a rebuild: ${RM} -f ${PROG}.wasm ; ${MAKE} $@"; \
|
|
fi
|
|
|
|
# alternative executable
|
|
#
|
|
alt: data ${ALT_TARGET}
|
|
@${TRUE}
|
|
|
|
${PROG}.alt: ${PROG}.alt.c
|
|
${CC} ${CFLAGS} ${PROG}.alt.c -o $@ ${LDFLAGS}
|
|
|
|
# data files
|
|
#
|
|
data: ${DATA}
|
|
@${TRUE}
|
|
|
|
# both all and alt
|
|
#
|
|
everything: all alt
|
|
@${TRUE}
|
|
|
|
|
|
###############
|
|
# utility rules
|
|
###############
|
|
#
|
|
clean:
|
|
${RM} -f ${OBJ} ${ALT_OBJ}
|
|
|
|
clobber: clean
|
|
${RM} -f ${TARGET} ${ALT_TARGET}
|
|
${RM} -rf *.dSYM
|
|
|
|
|
|
######################################
|
|
# optional include of 1337 hacker rulz
|
|
######################################
|
|
|
|
-include 1337.mk ../1337.mk ../../1337.mk
|