We update `next/Makefile.example` as per needs of IOCCC
final judging rounds.
Improved a few "XXX" comments.
Add `-pedantic` to `${CWARN}` by default with a comment
suggesting that is is OK to remove that compiler flag.
181 lines
3.4 KiB
Makefile
181 lines
3.4 KiB
Makefile
#!/usr/bin/env make
|
|
#
|
|
# XXX - prog - an example Makefile <<=== change "an example Makefile" to a suitable title for your submission
|
|
#
|
|
# 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 comment 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
|
|
GCC= gcc
|
|
GINDENT= gindent
|
|
MV= mv
|
|
RM= rm
|
|
TRUE= true
|
|
|
|
|
|
#####################
|
|
# C compiler settings
|
|
#####################
|
|
|
|
# Common C compiler warnings to silence
|
|
#
|
|
CSILENCE= -Wno-poison-system-directories
|
|
|
|
# Attempt to silence unknown warning options
|
|
#
|
|
CUNKNOWN= -Wno-unknown-warning-option
|
|
|
|
# Common C compiler warning flags
|
|
#
|
|
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
|
|
#
|
|
ARCH=
|
|
|
|
# Defines that are needed to compile
|
|
#
|
|
CDEFINE=
|
|
|
|
# Include files that are needed to compile
|
|
#
|
|
CINCLUDE=
|
|
|
|
# Optimization
|
|
#
|
|
OPT= -O3
|
|
|
|
# Default flags for ANSI C compilation
|
|
#
|
|
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
|
|
|
|
# Libraries needed to build
|
|
#
|
|
LDFLAGS=
|
|
|
|
# C compiler to use
|
|
#
|
|
CC= cc
|
|
|
|
# Compiler add-ons or replacements for clang only
|
|
#
|
|
ifeq "$(findstring $(CLANG),${CC})" "$(CLANG)"
|
|
#
|
|
#CSILENCE+=
|
|
#
|
|
CWARN+= -Weverything
|
|
#
|
|
endif
|
|
|
|
# Specific add-ons or replacements for gcc only
|
|
#
|
|
ifeq "$(findstring $(GCC),${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
|
|
DATA=
|
|
TARGET= ${PROG}
|
|
#
|
|
# XXX - uncomment these next two lines if you have a prog.alt.c
|
|
#ALT_OBJ= ${PROG}.alt.o
|
|
#ALT_TARGET= ${PROG}.alt
|
|
|
|
|
|
#################
|
|
# build the entry
|
|
#################
|
|
|
|
all: data ${TARGET}
|
|
@# XXX - please remove these comments
|
|
@
|
|
@# NOTE: only try.sh and try.alt.sh scripts will be made executable in
|
|
@# the tarball so if you need any scripts that are executable, make sure
|
|
@# to use ${CHMOD} +x on them like:
|
|
@#
|
|
@# ${CHMOD} +x foo.sh
|
|
@${TRUE}
|
|
|
|
.PHONY: all alt data everything clean clobber
|
|
|
|
${PROG}: ${PROG}.c
|
|
${CC} ${CFLAGS} ${PROG}.c -o $@ ${LDFLAGS}
|
|
|
|
# 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
|