Files
ioccc/next/Makefile.example
T

260 lines
5.6 KiB
Makefile

#!/usr/bin/env make
#
# YYYY/XXX <<=== The IOCCC Judges will replace this line
# XXX - Please use this Makefile, renamed as Makefile of course, as the Makefile in
# XXX - your submission. Modify it as needed, including removing this comment and
# XXX - other comments we ask you to remove.
#############################
# shell used by this Makefile
#############################
SHELL= bash
#######################
# common tool locations
#######################
#
# XXX - The IOCCC judges will remove this line and uncomment the next line later
# include ../../var.mk
# XXX - for now, set some common tool locations
# XXX - once var.mk is in use, the IOCCC judges will remove the section below
CC= cc
CHMOD= chmod
CLANG= clang
CLANG_FORMAT= clang-format
GCC= gcc
MV= mv
RM= rm
RMDIR= rmdir
TRUE= true
#####################
# C compiler settings
#####################
# Common C compiler warnings to silence
#
# Example: CSILENCE= -Wno-poison-system-directories
#
CSILENCE=
# 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
#
# XXX - Your IOCCC submission is free to require older C standards, or
# XXX - even not specify a C standard at all. We suggest trying
# XXX - for -std=gnu17, but that is not a requirement and you won't
# XXX - be penalized if you name CSTD empty or use another
# XXX - well known and reasonably widely implemented C standard.
#
CSTD= -std=gnu17
# 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= -O3
# 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+=
#
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= XXX - The IOCCC judges will change this line later
PROG= prog
#
OBJ= ${PROG}.o
TARGET= ${PROG}
# XXX - uncomment these next two lines if you have a prog.alt.c
# ALT_OBJ= ${PROG}.alt.o
# ALT_TARGET= ${PROG}.alt
# list any data files supplied with your submission
#
# Example: DATA= curds whey
#
DATA=
# NOTE: Add any new Makefile variables your code might need below.
#
# Example: WIDTH= 120
#################
# build the entry
#################
all: data ${TARGET}
@${TRUE}
.PHONY: all alt data everything clean clobber
${PROG}: ${PROG}.c
${CC} ${CFLAGS} ${PROG}.c -o $@ ${LDFLAGS}
# suggested way(s) to run the program
#
# XXX - You are better off supplying a try.sh script, than using a try Makefile rule.
#
# XXX - If you have a try.sh script, then please remove this try rule from your Makefile
#
try: ${PROG} ${DATA}
@# XXX - change this next line as needed
./${PROG} XXX some arguments XXX
# alternative executable
#
alt: data ${ALT_TARGET}
@${TRUE}
${PROG}.alt: ${PROG}.alt.c
${CC} ${CFLAGS} ${PROG}.alt.c -o $@ ${LDFLAGS}
# suggested way(s) to run alt code, if you include a prog.alt.c
#
# XXX - You are better off supplying a try.sh script, than using a try Makefile rule.
#
# XXX - If you have a try.sh script, then please remove this try.alt rule
#
# XXX - If you do NOT have a prog.alt.c, then please remove this try.alt rule from your Makefile
#
try.alt: ${PROG}.alt ${DATA}
@# XXX - change this next line as needed
./${PROG}.alt XXX some arguments XXX
# data files
#
data: ${DATA}
@${TRUE}
# both all and alt
#
everything: all alt
@${TRUE}
###############
# utility rules
###############
#
clean:
${RM} -f ${OBJ} ${ALT_OBJ}
clobber: clean
@# XXX - put additional ${RM} -f or ${RM} -rf lines so that
@# "make clobber" restores things to their submission state.
${RM} -f ${TARGET} ${ALT_TARGET}
${RM} -rf *.dSYM
######################################
# optional include of 1337 hacker rulz
######################################
-include 1337.mk ../1337.mk ../../1337.mk