improve Makefile.example for final rounds and for IOCCC29

This commit is contained in:
Landon Curt Noll committed 2025-06-19 11:41:53 -07:00
1 parent 4ffe4f84a2
commit 0d5d5754f3
1 file changed
+33 -77
+33 -77
View File
@@ -17,7 +17,12 @@ 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 this section
CC= cc
CHMOD= chmod
CLANG= clang
@@ -34,62 +39,45 @@ TRUE= true
# Common C compiler warnings to silence
#
# Example: CSILENCE= -Wno-some-thing -Wno-another-thing
#
CSILENCE= -Wno-poison-system-directories
# Attempt to silence unknown warnings
# Attempt to silence unknown warning options
#
CUNKNOWN= -Wno-unknown-warning-option
# Common C compiler warning flags
#
CWARN= -Wall -Wextra -pedantic ${CSILENCE} ${CUNKNOWN}
CWARN= -Wall -Wextra ${CSILENCE} ${CUNKNOWN}
# The standard to compile against
# Compiler standard
#
# Your IOCCC submission is free to require older C standards, or
# even not specify a C standard at all. We suggest trying
# for -std=gnu17, but that is not a requirement and you won't
# be penalized if you name CSTD empty or use another
# well known and reasonably widely implemented C 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
#
OPT= -O3
# Default flags for ANSI C compilation
#
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${COTHER} ${OPT}
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# Libraries needed to build
#
@@ -103,7 +91,7 @@ CC= cc
#
ifeq "$(findstring $(CLANG),${CC})" "$(CLANG)"
#
CSILENCE+=
#CSILENCE+=
#
CWARN+= -Weverything
#
@@ -113,9 +101,9 @@ endif
#
ifeq "$(findstring $(GCC),${CC})" "$(GCC)"
#
CSILENCE+=
#CSILENCE+=
#
CWARN+=
#CWARN+=
#
endif
@@ -124,22 +112,17 @@ endif
# Special Makefile variables for this entry
###########################################
# what to build
#
#ENTRY= XXX - we will change this line later - XXX
PROG= prog
OBJ= ${PROG}.o
TARGET= ${PROG}
# If you have alternate code, uncomment the next two lines and
# remove the rest of the comments:
# ALT_OBJ= ${PROG}.alt.o
# ALT_TARGET= ${PROG}.alt
ALT_OBJ=
ALT_TARGET=
# list any data files supplied with the submission
#
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
@@ -153,69 +136,42 @@ all: data ${TARGET}
@# to use ${CHMOD} +x on them like:
@#
@# ${CHMOD} +x foo.sh
@:
@${TRUE}
.PHONY: all data try clean clobber install
.PHONY: all alt data everything clean clobber
# how to compile
#
${PROG}: ${PROG}.c
${CC} ${CFLAGS} ${PROG}.c -o $@ ${LDFLAGS}
# suggested way(s) to run the program
#
try: ${PROG} ${DATA}
@# please remove these comments
@# notice how we do not assume that . is a component of the $PATH environment variable
@# you may use the try.sh script if you have one
@# change this next line as needed
./${PROG} some arguments
# 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
#
try.alt: ${PROG}.alt ${DATA}
@# please remove these comments
@# notice how we do not assume that . is a component of the $PATH environment variable
@# you may use the try.alt.sh script if you have one
@# change this next line as needed
./${PROG}.alt some arguments
# data files
#
data: ${DATA}
@${TRUE}
# both all and alt
#
everything: all alt
@${TRUE}
###############
# 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} -rf ${TARGET} ${ALT_TARGET} *.dSYM
@-if [[ -e sandwich ]]; then \
${RM} -f sandwich; \
echo 'ate sandwich'; \
fi
${RM} -f ${TARGET} ${ALT_TARGET}
${RM} -rf *.dSYM
######################################