Files
ioccc/1992/gson/Makefile
T
Cody Boone Ferguson c840024e38 Fix clobber rule in 1992/gson
The rule removed the file 'og' but this file does not exist. The closest
thing to that is 'ag' but that's removed from a previous line in the
rule.
2025-01-14 07:04:58 -08:00

181 lines
3.7 KiB
Makefile

#!/usr/bin/env make
#
# IOCCC 1992 winning entry - gson
################################################################################
#
# 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-bitwise-op-parentheses -Wno-char-subscripts \
-Wno-deprecated-declarations -Wno-empty-body -Wno-error \
-Wno-implicit-function-declaration -Wno-parentheses -Wno-pedantic \
-Wno-return-type -Wno-unused-parameter -Wno-unused-value \
-Wno-deprecated-non-prototype -Wno-implicit-int \
-Wno-int-in-bool-context -Wno-misleading-indentation \
-Wno-missing-parameter-type
# 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=gnu90
# Compiler bit architecture
#
ARCH=
# Defines that are needed to compile
#
CDEFINE=
# Include files that are needed to compile
#
CINCLUDE=
# Optimization
#
# We DISABLE the optimiser because having it enabled will cause a crash in some
# invocations in some systems.
OPT= -O0
# 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-comma -Wno-implicit-int-conversion -Wno-missing-prototypes \
-Wno-missing-variable-declarations -Wno-poison-system-directories \
-Wno-shorten-64-to-32 -Wno-strict-prototypes -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= gson
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA=
TARGET= ${PROG} ag
#
ALT_OBJ=
ALT_TARGET=
#################
# build the entry
#################
#
all: data ${TARGET}
@${TRUE}
.PHONY: all alt data everything clean clobber
# We DISABLE THE OPTIMISER because when it's enabled in some conditions it
# crashes.
#
${PROG}: ${PROG}.c
${CC} ${CFLAGS} -O0 $< -o $@ ${LDFLAGS}
ag: ${PROG}
${RM} -f $@
${LN} $< $@
# alternative executable
#
alt: data ${ALT_TARGET}
@${TRUE}
# data files
#
data: ${DATA}
@${TRUE}
# both all and alt
#
everything: all alt
###############
# utility rules
###############
#
clean:
${RM} -f ${OBJ} ${ALT_OBJ}
clobber: clean
${RM} -f ${TARGET} ${ALT_TARGET}
${RM} -rf *.dSYM
${RM} -f words
######################################
# optional include of 1337 hacker rulz
######################################
-include 1337.mk ../1337.mk ../../1337.mk