The first alt version added some whitespaces that broke the outline, so I simply filled those up. I also expanded tabs to spaces since there is no size limit restriction for the alternate version. The second alt version attempted to force binary mode with _setmode() and _fileno() calls, plus some additional headers. Rather than doing it this way, I hack in the binary mode adjustments via preprocessor. Actually I did a similar trick for IOCCC 2011, but I guess I didn't submit that version: https://uguu.org/archive/ioccc2011/akari/source/binmode_main.h The file above uses _setmode() and _fileno(). The leading underscore indicates that they were nonstandard extensions. For the binmode_main.h in this change, I have opted for setmode() and STDIN_FILENO instead, which are more widely available.
179 lines
3.5 KiB
Makefile
179 lines
3.5 KiB
Makefile
#!/usr/bin/env make
|
|
#
|
|
# IOCCC 2012 winning entry - omoikane
|
|
|
|
################################################################################
|
|
#
|
|
# IOCCC winning entry code may not work on your system. What was liked/allowed
|
|
# and worked in the past may no longer be liked/allowed or compile/run today.
|
|
#
|
|
# Bug fixes, corrections and typo fixes are VERY WELCOME. If you see a problem,
|
|
# first check this URL for a list of known bugs and (mis)features of IOCCC entries:
|
|
#
|
|
# https://www.ioccc.org/bugs.html
|
|
#
|
|
# GitHub pull requests are welcome! Please see the above URL for details.
|
|
#
|
|
################################################################################
|
|
#
|
|
# This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
|
# You are free to share and adapt this file under the terms of this license:
|
|
#
|
|
# Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
|
#
|
|
# For more information, see: https://creativecommons.org/licenses/by-sa/4.0/
|
|
|
|
|
|
#############################
|
|
# shell used by this Makefile
|
|
#############################
|
|
#
|
|
SHELL= bash
|
|
|
|
#######################
|
|
# common tool locations
|
|
#######################
|
|
#
|
|
include ../../var.mk
|
|
|
|
# Common C compiler warnings to silence
|
|
#
|
|
CSILENCE= -Wno-empty-body -Wno-strict-prototypes -Wno-misleading-indentation
|
|
|
|
# Attempt to silence unknown warning option
|
|
#
|
|
CUNKNOWN= -Wno-unknown-warning-option
|
|
|
|
# Common C compiler warning flags
|
|
#
|
|
CWARN= -Wall -Wextra ${CSILENCE} ${CUNKNOWN}
|
|
|
|
# Compiler standard
|
|
#
|
|
CSTD= -std=gnu11
|
|
|
|
# Compiler bit architecture
|
|
#
|
|
ARCH=
|
|
|
|
# Defines that are needed to compile
|
|
#
|
|
CDEFINE=
|
|
|
|
# Include files that are needed to compile
|
|
#
|
|
CINCLUDE=-include binmode_main.h
|
|
|
|
# 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+= -Wno-implicit-int-conversion -Wno-missing-prototypes \
|
|
-Wno-missing-variable-declarations -Wno-poison-system-directories \
|
|
-Wno-shorten-64-to-32 -Wno-sign-conversion -Wno-strict-prototypes \
|
|
-Wno-disabled-macro-expansion -Wno-misleading-indentation \
|
|
-Wno-unsafe-buffer-usage
|
|
#
|
|
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= omoikane
|
|
PROG= nyaruko
|
|
#
|
|
OBJ= ${PROG}.o
|
|
DATA=
|
|
TARGET= ${PROG}
|
|
#
|
|
ALT_OBJ= ${PROG}.alt.o
|
|
ALT_TARGET= ${PROG}.alt
|
|
|
|
|
|
#################
|
|
# build the entry
|
|
#################
|
|
#
|
|
all: data ${TARGET}
|
|
@${TRUE}
|
|
|
|
.PHONY: all alt data everything clean clobber
|
|
|
|
${PROG}: ${PROG}.c
|
|
${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
|
|
|
|
${PROG}.c: ${ENTRY}.c
|
|
${CP} -f -v $? $@
|
|
|
|
# alternative executable
|
|
#
|
|
alt: data ${ALT_TARGET}
|
|
@${TRUE}
|
|
|
|
${PROG}.alt: ${PROG}.alt.c
|
|
${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
|
|
|
|
${PROG}.alt.c: ${ENTRY}.alt.c
|
|
${CP} -f -v $? $@
|
|
|
|
# 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} -f ${PROG}.c ${PROG}.alt.c
|
|
${RM} -rf *.dSYM
|
|
${RM} -f output.c key.c data.c regenerated.bin data output output.2
|
|
|
|
|
|
######################################
|
|
# optional include of 1337 hacker rulz
|
|
######################################
|
|
|
|
-include 1337.mk ../1337.mk ../../1337.mk
|