summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rwxr-xr-xconfig/cc.sh10
-rw-r--r--config/config.mk80
-rw-r--r--config/deps.mk18
-rw-r--r--config/empty.c6
-rw-r--r--config/exports.mk20
-rw-r--r--config/flags.mk133
-rw-r--r--config/libacl.c6
-rw-r--r--config/libcap.c6
-rw-r--r--config/libselinux.c6
-rw-r--r--config/liburing.c6
-rw-r--r--config/oniguruma.c6
-rw-r--r--config/pkg.mk23
-rwxr-xr-xconfig/pkg.sh26
-rwxr-xr-xconfig/pkgconf.sh88
-rw-r--r--config/pkgs.mk17
-rw-r--r--config/prelude.mk167
16 files changed, 0 insertions, 618 deletions
diff --git a/config/cc.sh b/config/cc.sh
deleted file mode 100755
index e6883f5..0000000
--- a/config/cc.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-# Copyright © Tavian Barnes <tavianator@tavianator.com>
-# SPDX-License-Identifier: 0BSD
-
-# Run the compiler and check if it succeeded
-
-set -eux
-
-$XCC $XCPPFLAGS $XCFLAGS $XLDFLAGS "$@" $XLDLIBS -o /dev/null
diff --git a/config/config.mk b/config/config.mk
deleted file mode 100644
index 4771a5e..0000000
--- a/config/config.mk
+++ /dev/null
@@ -1,80 +0,0 @@
-# Copyright © Tavian Barnes <tavianator@tavianator.com>
-# SPDX-License-Identifier: 0BSD
-
-# Makefile fragment that implements `make config`
-
-include config/prelude.mk
-include config/exports.mk
-
-# Makefile fragments generated by `make config`
-MKS := \
- ${GEN}/vars.mk \
- ${GEN}/flags.mk \
- ${GEN}/deps.mk \
- ${GEN}/objs.mk \
- ${GEN}/pkgs.mk
-
-# The main configuration file, which includes the others
-${CONFIG}: ${MKS}
- ${MSG} "[ GEN] ${TGT}"
- @printf '# %s\n' "${TGT}" >$@
- @printf 'include $${GEN}/%s\n' ${.ALLSRC:${GEN}/%=%} >>$@
- ${VCAT} ${CONFIG}
-.PHONY: ${CONFIG}
-
-# Saves the configurable variables
-${GEN}/vars.mk::
- @${MKDIR} ${@D}
- ${MSG} "[ GEN] ${TGT}"
- @printf '# %s\n' "${TGT}" >$@
- @printf 'PREFIX := %s\n' "$$XPREFIX" >>$@
- @printf 'MANDIR := %s\n' "$$XMANDIR" >>$@
- @printf 'OS := %s\n' "$${OS:-$$(uname)}" >>$@
- @printf 'ARCH := %s\n' "$${ARCH:-$$(uname -m)}" >>$@
- @printf 'CC := %s\n' "$$XCC" >>$@
- @printf 'INSTALL := %s\n' "$$XINSTALL" >>$@
- @printf 'MKDIR := %s\n' "$$XMKDIR" >>$@
- @printf 'PKG_CONFIG := %s\n' "$$XPKG_CONFIG" >>$@
- @printf 'RM := %s\n' "$$XRM" >>$@
- @printf 'PKGS :=\n' >>$@
- ${VCAT} $@
-
-# Sets the build flags. This depends on vars.mk and uses a recursive make so
-# that the default flags can depend on variables like ${OS}.
-${GEN}/flags.mk: ${GEN}/vars.mk
- @+${MAKE} -sf config/flags.mk
-.PHONY: ${GEN}/flags.mk
-
-# Check for dependency generation support
-${GEN}/deps.mk: ${GEN}/flags.mk
- @+${MAKE} -sf config/deps.mk
-.PHONY: ${GEN}/deps.mk
-
-# Lists file.o: file.c dependencies
-${GEN}/objs.mk::
- @${MKDIR} ${@D}
- ${MSG} "[ GEN] ${TGT}"
- @printf '# %s\n' "${TGT}" >$@
- @for obj in ${OBJS:${OBJ}/%.o=%}; do \
- printf '$${OBJ}/%s.o: %s.c\n' "$$obj" "$$obj"; \
- done | sed 's|: gen/|: $${GEN}/|' >>$@
-
-# External dependencies
-PKG_MKS := \
- ${GEN}/libacl.mk \
- ${GEN}/libcap.mk \
- ${GEN}/libselinux.mk \
- ${GEN}/liburing.mk \
- ${GEN}/oniguruma.mk
-
-# Auto-detect dependencies and their build flags
-${GEN}/pkgs.mk: ${PKG_MKS}
- @printf '# %s\n' "${TGT}" >$@
- @printf 'include $${GEN}/%s\n' ${.ALLSRC:${GEN}/%=%} >>$@
- @+${MAKE} -sf config/pkgs.mk
-.PHONY: ${GEN}/pkgs.mk
-
-# Auto-detect dependencies
-${PKG_MKS}: ${GEN}/flags.mk
- @+${MAKE} -sf config/pkg.mk TARGET=$@
-.PHONY: ${PKG_MKS}
diff --git a/config/deps.mk b/config/deps.mk
deleted file mode 100644
index e963b6e..0000000
--- a/config/deps.mk
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright © Tavian Barnes <tavianator@tavianator.com>
-# SPDX-License-Identifier: 0BSD
-
-# Makefile that generates gen/deps.mk
-
-include config/prelude.mk
-include ${GEN}/vars.mk
-include ${GEN}/flags.mk
-include config/exports.mk
-
-${GEN}/deps.mk::
- ${MSG} "[ GEN] ${TGT}"
- printf '# %s\n' "${TGT}" >$@
- if config/cc.sh -MD -MP -MF /dev/null config/empty.c; then \
- printf 'DEPFLAGS = -MD -MP -MF $${@:.o=.d}\n'; \
- fi >>$@ 2>$@.log
- ${VCAT} $@
- @printf -- '-include %s\n' ${OBJS:.o=.d} >>$@
diff --git a/config/empty.c b/config/empty.c
deleted file mode 100644
index 4fa9a5b..0000000
--- a/config/empty.c
+++ /dev/null
@@ -1,6 +0,0 @@
-// Copyright © Tavian Barnes <tavianator@tavianator.com>
-// SPDX-License-Identifier: 0BSD
-
-int main(void) {
- return 0;
-}
diff --git a/config/exports.mk b/config/exports.mk
deleted file mode 100644
index ed19134..0000000
--- a/config/exports.mk
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright © Tavian Barnes <tavianator@tavianator.com>
-# SPDX-License-Identifier: 0BSD
-
-# Makefile fragment that exports variables used by configuration scripts
-
-export XPREFIX=${PREFIX}
-export XMANDIR=${MANDIR}
-
-export XCC=${CC}
-export XINSTALL=${INSTALL}
-export XMKDIR=${MKDIR}
-export XPKG_CONFIG=${PKG_CONFIG}
-export XRM=${RM}
-
-export XCPPFLAGS=${CPPFLAGS}
-export XCFLAGS=${CFLAGS}
-export XLDFLAGS=${LDFLAGS}
-export XLDLIBS=${LDLIBS}
-
-export XNOLIBS=${NOLIBS}
diff --git a/config/flags.mk b/config/flags.mk
deleted file mode 100644
index 48f1a08..0000000
--- a/config/flags.mk
+++ /dev/null
@@ -1,133 +0,0 @@
-# Copyright © Tavian Barnes <tavianator@tavianator.com>
-# SPDX-License-Identifier: 0BSD
-
-# Makefile that generates gen/flags.mk
-
-include config/prelude.mk
-include ${GEN}/vars.mk
-
-# Configurable flags
-CPPFLAGS ?=
-CFLAGS ?= \
- -g \
- -Wall \
- -Wformat=2 \
- -Werror=implicit \
- -Wimplicit-fallthrough \
- -Wmissing-declarations \
- -Wshadow \
- -Wsign-compare \
- -Wstrict-prototypes
-LDFLAGS ?=
-LDLIBS ?=
-
-export XCPPFLAGS=${CPPFLAGS}
-export XCFLAGS=${CFLAGS}
-export XLDFLAGS=${LDFLAGS}
-export XLDLIBS=${LDLIBS}
-
-# Immutable flags
-export BFS_CPPFLAGS= \
- -D__EXTENSIONS__ \
- -D_ATFILE_SOURCE \
- -D_BSD_SOURCE \
- -D_DARWIN_C_SOURCE \
- -D_DEFAULT_SOURCE \
- -D_GNU_SOURCE \
- -D_LARGEFILE64_SOURCE \
- -D_POSIX_PTHREAD_SEMANTICS \
- -D_FILE_OFFSET_BITS=64 \
- -D_TIME_BITS=64
-export BFS_CFLAGS= -std=c17 -pthread
-
-# Platform-specific system libraries
-LDLIBS,DragonFly := -lposix1e
-LDLIBS,Linux := -lrt
-LDLIBS,NetBSD := -lutil
-LDLIBS,SunOS := -lsocket -lnsl
-export BFS_LDLIBS=${LDLIBS,${OS}}
-
-# Build profiles
-_ASAN := ${TRUTHY,${ASAN}}
-_LSAN := ${TRUTHY,${LSAN}}
-_MSAN := ${TRUTHY,${MSAN}}
-_TSAN := ${TRUTHY,${TSAN}}
-_UBSAN := ${TRUTHY,${UBSAN}}
-_GCOV := ${TRUTHY,${GCOV}}
-_LINT := ${TRUTHY,${LINT}}
-_RELEASE := ${TRUTHY,${RELEASE}}
-
-# https://github.com/google/sanitizers/issues/342
-TSAN_CPPFLAGS,y := -DBFS_USE_TARGET_CLONES=0
-export TSAN_CPPFLAGS=${TSAN_CPPFLAGS,${_TSAN}}
-
-ASAN_CFLAGS,y := -fsanitize=address
-LSAN_CFLAGS,y := -fsanitize=leak
-MSAN_CFLAGS,y := -fsanitize=memory -fsanitize-memory-track-origins
-TSAN_CFLAGS,y := -fsanitize=thread
-UBSAN_CFLAGS.y := -fsanitize=undefined
-
-export ASAN_CFLAGS=${ASAN_CFLAGS,${_ASAN}}
-export LSAN_CFLAGS=${LSAN_CFLAGS,${_LSAN}}
-export MSAN_CFLAGS=${MSAN_CFLAGS,${_MSAN}}
-export TSAN_CFLAGS=${TSAN_CFLAGS,${_TSAN}}
-export UBSAN_CFLAGS=${UBSAN_CFLAGS,${_UBSAN}}
-
-SAN_CFLAGS,y := -fno-sanitize-recover=all
-SAN := ${NOT,${NOR,${_ASAN},${_LSAN},${_MSAN},${_TSAN},${_UBSAN}}}
-export SAN_CFLAGS=${SAN_CFLAGS,${SAN}}
-
-# MSAN and TSAN both need all code to be instrumented
-NOLIBS ?= ${NOT,${NOR,${_MSAN},${_TSAN}}}
-export XNOLIBS=${NOLIBS}
-
-# gcov only intercepts fork()/exec() with -std=gnu*
-GCOV_CFLAGS,y := -std=gnu17 --coverage
-export GCOV_CFLAGS=${GCOV_CFLAGS,${_GCOV}}
-
-LINT_CPPFLAGS,y := -D_FORTIFY_SOURCE=3 -DBFS_LINT
-LINT_CFLAGS,y := -Werror -O2
-
-export LINT_CPPFLAGS=${LINT_CPPFLAGS,${_LINT}}
-export LINT_CFLAGS=${LINT_CFLAGS,${_LINT}}
-
-RELEASE_CPPFLAGS,y := -DNDEBUG
-RELEASE_CFLAGS,y := -O3 -flto=auto
-
-export RELEASE_CPPFLAGS=${RELEASE_CPPFLAGS,${_RELEASE}}
-export RELEASE_CFLAGS=${RELEASE_CFLAGS,${_RELEASE}}
-
-# Set a variable
-SETVAR = printf '%s := %s\n' >>$@
-
-# Append to a variable, if non-empty
-APPEND = append() { test -z "$$2" || printf '%s += %s\n' "$$1" "$$2" >>$@; }; append
-
-${GEN}/flags.mk::
- ${MSG} "[ GEN] ${TGT}"
- printf '# %s\n' "${TGT}" >$@
- ${SETVAR} CPPFLAGS "$$BFS_CPPFLAGS"
- ${APPEND} CPPFLAGS "$$TSAN_CPPFLAGS"
- ${APPEND} CPPFLAGS "$$LINT_CPPFLAGS"
- ${APPEND} CPPFLAGS "$$RELEASE_CPPFLAGS"
- ${APPEND} CPPFLAGS "$$XCPPFLAGS"
- ${APPEND} CPPFLAGS "$$EXTRA_CPPFLAGS"
- ${SETVAR} CFLAGS "$$BFS_CFLAGS"
- ${APPEND} CFLAGS "$$ASAN_CFLAGS"
- ${APPEND} CFLAGS "$$LSAN_CFLAGS"
- ${APPEND} CFLAGS "$$MSAN_CFLAGS"
- ${APPEND} CFLAGS "$$TSAN_CFLAGS"
- ${APPEND} CFLAGS "$$UBSAN_CFLAGS"
- ${APPEND} CFLAGS "$$SAN_CFLAGS"
- ${APPEND} CFLAGS "$$GCOV_CFLAGS"
- ${APPEND} CFLAGS "$$LINT_CFLAGS"
- ${APPEND} CFLAGS "$$RELEASE_CFLAGS"
- ${APPEND} CFLAGS "$$XCFLAGS"
- ${APPEND} CFLAGS "$$EXTRA_CFLAGS"
- ${SETVAR} LDFLAGS "$$XLDFLAGS"
- ${SETVAR} LDLIBS "$$XLDLIBS"
- ${APPEND} LDLIBS "$$EXTRA_LDLIBS"
- ${APPEND} LDLIBS "$$BFS_LDLIBS"
- ${SETVAR} NOLIBS "$$XNOLIBS"
- test "${OS}-${SAN}" != FreeBSD-y || printf 'POSTLINK = elfctl -e +noaslr $$@\n' >>$@
- ${VCAT} $@
diff --git a/config/libacl.c b/config/libacl.c
deleted file mode 100644
index 877cb69..0000000
--- a/config/libacl.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <sys/acl.h>
-
-int main(void) {
- acl_free(0);
- return 0;
-}
diff --git a/config/libcap.c b/config/libcap.c
deleted file mode 100644
index 64188ac..0000000
--- a/config/libcap.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <sys/capability.h>
-
-int main(void) {
- cap_free(0);
- return 0;
-}
diff --git a/config/libselinux.c b/config/libselinux.c
deleted file mode 100644
index 72f5d33..0000000
--- a/config/libselinux.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <selinux/selinux.h>
-
-int main(void) {
- freecon(0);
- return 0;
-}
diff --git a/config/liburing.c b/config/liburing.c
deleted file mode 100644
index 456059c..0000000
--- a/config/liburing.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <liburing.h>
-
-int main(void) {
- io_uring_free_probe(0);
- return 0;
-}
diff --git a/config/oniguruma.c b/config/oniguruma.c
deleted file mode 100644
index b834fac..0000000
--- a/config/oniguruma.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <oniguruma.h>
-
-int main(void) {
- onig_free(0);
- return 0;
-}
diff --git a/config/pkg.mk b/config/pkg.mk
deleted file mode 100644
index d2d77b0..0000000
--- a/config/pkg.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-# Copyright © Tavian Barnes <tavianator@tavianator.com>
-# SPDX-License-Identifier: 0BSD
-
-# Makefile that generates gen/lib*.mk
-
-include config/prelude.mk
-include ${GEN}/vars.mk
-include ${GEN}/flags.mk
-include config/exports.mk
-
-# Like ${TGT} but for ${TARGET}, not $@
-SHORT = ${TARGET:${BUILDDIR}/%=%}
-
-default::
- @printf '# %s\n' "${SHORT}" >${TARGET}
- config/pkg.sh ${TARGET:${GEN}/%.mk=%} >>${TARGET} 2>${TARGET}.log
- @if [ "${IS_V}" ]; then \
- cat ${TARGET}; \
- elif grep -q PKGS ${TARGET}; then \
- printf '[ GEN] %-18s [y]\n' ${SHORT}; \
- else \
- printf '[ GEN] %-18s [n]\n' ${SHORT}; \
- fi
diff --git a/config/pkg.sh b/config/pkg.sh
deleted file mode 100755
index 4ebea64..0000000
--- a/config/pkg.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-
-# Copyright © Tavian Barnes <tavianator@tavianator.com>
-# SPDX-License-Identifier: 0BSD
-
-# pkg-config wrapper that outputs a makefile fragment
-
-set -eu
-
-NAME=$(printf '%s' "$1" | tr 'a-z' 'A-Z')
-eval "XUSE=\"\${USE_$NAME:-}\""
-
-if [ "$XUSE" ]; then
- USE="$XUSE"
-elif config/pkgconf.sh "$1"; then
- USE=y
-else
- USE=n
-fi
-
-if [ "$USE" = y ]; then
- printf 'PKGS += %s\n' "$1"
- printf 'CPPFLAGS += -DBFS_USE_%s=1\n' "$NAME"
-else
- printf 'CPPFLAGS += -DBFS_USE_%s=0\n' "$NAME"
-fi
diff --git a/config/pkgconf.sh b/config/pkgconf.sh
deleted file mode 100755
index d6c45c7..0000000
--- a/config/pkgconf.sh
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/bin/sh
-
-# Copyright © Tavian Barnes <tavianator@tavianator.com>
-# SPDX-License-Identifier: 0BSD
-
-# pkg-config wrapper with hardcoded fallbacks
-
-set -eu
-
-MODE=
-case "${1:-}" in
- --*)
- MODE="$1"
- shift
-esac
-
-if [ $# -lt 1 ]; then
- exit
-fi
-
-case "$XNOLIBS" in
- y|1)
- exit 1
-esac
-
-if command -v "${XPKG_CONFIG:-}" >/dev/null 2>&1; then
- case "$MODE" in
- "")
- "$XPKG_CONFIG" "$@"
- ;;
- --cflags)
- OUT=$("$XPKG_CONFIG" --cflags "$@")
- if [ "$OUT" ]; then
- printf 'CFLAGS += %s\n' "$OUT"
- fi
- ;;
- --ldflags)
- OUT=$("$XPKG_CONFIG" --libs-only-L --libs-only-other "$@")
- if [ "$OUT" ]; then
- printf 'LDFLAGS += %s\n' "$OUT"
- fi
- ;;
- --ldlibs)
- OUT=$("$XPKG_CONFIG" --libs-only-l "$@")
- if [ "$OUT" ]; then
- printf 'LDLIBS := %s ${LDLIBS}\n' "$OUT"
- fi
- ;;
- esac
-else
- LDLIBS=""
- for LIB; do
- case "$LIB" in
- libacl)
- LDLIB=-lacl
- ;;
- libcap)
- LDLIB=-lcap
- ;;
- libselinux)
- LDLIB=-lselinux
- ;;
- liburing)
- LDLIB=-luring
- ;;
- oniguruma)
- LDLIB=-lonig
- ;;
- *)
- printf 'error: Unknown package %s\n' "$LIB" >&2
- exit 1
- ;;
- esac
-
- case "$MODE" in
- "")
- config/cc.sh "config/$LIB.c" "$LDLIB" || exit $?
- ;;
- --ldlibs)
- LDLIBS="$LDLIBS $LDLIB"
- ;;
- esac
- done
-
- if [ "$MODE" = "--ldlibs" ] && [ "$LDLIBS" ]; then
- printf 'LDLIBS :=%s ${LDLIBS}\n' "$LDLIBS"
- fi
-fi
diff --git a/config/pkgs.mk b/config/pkgs.mk
deleted file mode 100644
index de9e16e..0000000
--- a/config/pkgs.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright © Tavian Barnes <tavianator@tavianator.com>
-# SPDX-License-Identifier: 0BSD
-
-# Makefile that generates gen/pkgs.mk
-
-include config/prelude.mk
-include ${GEN}/vars.mk
-include ${GEN}/flags.mk
-include ${GEN}/pkgs.mk
-include config/exports.mk
-
-${GEN}/pkgs.mk::
- ${MSG} "[ GEN] ${TGT}"
- config/pkgconf.sh --cflags ${PKGS} >>$@ 2>>$@.log
- config/pkgconf.sh --ldflags ${PKGS} >>$@ 2>>$@.log
- config/pkgconf.sh --ldlibs ${PKGS} >>$@ 2>>$@.log
- ${VCAT} $@
diff --git a/config/prelude.mk b/config/prelude.mk
deleted file mode 100644
index dbc6875..0000000
--- a/config/prelude.mk
+++ /dev/null
@@ -1,167 +0,0 @@
-# Copyright © Tavian Barnes <tavianator@tavianator.com>
-# SPDX-License-Identifier: 0BSD
-
-# Common makefile utilities. Compatible with both GNU make and most BSD makes.
-
-# BSD make will chdir into ${.OBJDIR} by default, unless we tell it not to
-.OBJDIR: .
-
-# We don't use any suffix rules
-.SUFFIXES:
-
-# GNU make has $^ for the full list of targets, while BSD make has $> and the
-# long-form ${.ALLSRC}. We could write $^ $> to get them both, but that would
-# break if one of them implemented support for the other. So instead, bring
-# BSD's ${.ALLSRC} to GNU.
-.ALLSRC ?= $^
-
-# For out-of-tree builds, e.g.
-#
-# $ make config BUILDDIR=/path/to/build/dir
-# $ make BUILDDIR=/path/to/build/dir
-BUILDDIR ?= .
-
-# Shorthand for build subdirectories
-BIN := ${BUILDDIR}/bin
-GEN := ${BUILDDIR}/gen
-OBJ := ${BUILDDIR}/obj
-
-# GNU make strips a leading ./ from target names, so do the same for BSD make
-BIN := ${BIN:./%=%}
-GEN := ${GEN:./%=%}
-OBJ := ${OBJ:./%=%}
-
-# The configuration file generated by `make config`
-CONFIG := ${GEN}/config.mk
-
-# Installation paths
-DESTDIR ?=
-PREFIX ?= /usr
-MANDIR ?= ${PREFIX}/share/man
-
-# GNU make supports `export VAR`, but BSD make requires `export VAR=value`.
-# Sadly, GNU make gives a recursion error on `export VAR=${VAR}`.
-_BUILDDIR := ${BUILDDIR}
-export BUILDDIR=${_BUILDDIR}
-
-# Configurable executables; can be overridden with
-#
-# $ make config CC=clang
-CC ?= cc
-INSTALL ?= install
-MKDIR ?= mkdir -p
-PKG_CONFIG ?= pkg-config
-RM ?= rm -f
-
-# GNU and BSD make have incompatible syntax for conditionals, but we can do a
-# lot with just nested variable expansion. We use "y" as the canonical
-# truthy value, and "" (the empty string) as the canonical falsey value.
-#
-# To normalize a boolean, use ${TRUTHY,${VAR}}, which expands like this:
-#
-# VAR=y ${TRUTHY,${VAR}} => ${TRUTHY,y} => y
-# VAR=1 ${TRUTHY,${VAR}} => ${TRUTHY,1} => y
-# VAR=n ${TRUTHY,${VAR}} => ${TRUTHY,n} => [empty]
-# VAR=other ${TRUTHY,${VAR}} => ${TRUTHY,other} => [empty]
-# VAR= ${TRUTHY,${VAR}} => ${TRUTHY,} => [emtpy]
-#
-# Inspired by https://github.com/wahern/autoguess
-TRUTHY,y := y
-TRUTHY,1 := y
-
-# Boolean operators are also implemented with nested expansion
-NOT,y :=
-NOT, := y
-
-# Support up to 5 arguments
-AND,y := y
-AND,y,y := y
-AND,y,y,y := y
-AND,y,y,y,y := y
-AND,y,y,y,y,y := y
-
-# NOR can be defined without combinatorial explosion.
-# OR is just ${NOT,${NOR,...}}
-NOR, := y
-NOR,, := y
-NOR,,, := y
-NOR,,,, := y
-NOR,,,,, := y
-
-# Normalize ${V} to either "y" or ""
-IS_V := ${TRUTHY,${V}}
-
-# Suppress output unless V=1
-Q, := @
-Q := ${Q,${IS_V}}
-
-# The current target, with ${BUILDDIR} stripped for shorter messages
-TGT = ${@:${BUILDDIR}/%=%}
-
-# Show full commands with `make V=1`, otherwise short summaries
-MSG = @msg() { \
- MSG="$$1"; \
- shift; \
- test "${IS_V}" || printf '%s\n' "$$MSG"; \
- test "$${1:-}" || return 0; \
- test "${IS_V}" && printf '%s\n' "$$*"; \
- "$$@"; \
- }; \
- msg
-
-# cat a file if V=1
-VCAT,y := @cat
-VCAT, := @:
-VCAT := ${VCAT,${IS_V}}
-
-# List all object files here, as they're needed by both `make config` and `make`
-
-# All object files except the entry point
-LIBBFS := \
- ${OBJ}/src/alloc.o \
- ${OBJ}/src/bar.o \
- ${OBJ}/src/bfstd.o \
- ${OBJ}/src/bftw.o \
- ${OBJ}/src/color.o \
- ${OBJ}/src/ctx.o \
- ${OBJ}/src/diag.o \
- ${OBJ}/src/dir.o \
- ${OBJ}/src/dstring.o \
- ${OBJ}/src/eval.o \
- ${OBJ}/src/exec.o \
- ${OBJ}/src/expr.o \
- ${OBJ}/src/fsade.o \
- ${OBJ}/src/ioq.o \
- ${OBJ}/src/mtab.o \
- ${OBJ}/src/opt.o \
- ${OBJ}/src/parse.o \
- ${OBJ}/src/printf.o \
- ${OBJ}/src/pwcache.o \
- ${OBJ}/src/stat.o \
- ${OBJ}/src/thread.o \
- ${OBJ}/src/trie.o \
- ${OBJ}/src/typo.o \
- ${OBJ}/src/xregex.o \
- ${OBJ}/src/xspawn.o \
- ${OBJ}/src/xtime.o \
- ${OBJ}/gen/version.o
-
-# Unit test objects
-UNIT_OBJS := \
- ${OBJ}/tests/alloc.o \
- ${OBJ}/tests/bfstd.o \
- ${OBJ}/tests/bit.o \
- ${OBJ}/tests/ioq.o \
- ${OBJ}/tests/main.o \
- ${OBJ}/tests/trie.o \
- ${OBJ}/tests/xspawn.o \
- ${OBJ}/tests/xtime.o
-
-# All object files
-OBJS := \
- ${OBJ}/src/main.o \
- ${OBJ}/tests/mksock.o \
- ${OBJ}/tests/xspawnee.o \
- ${OBJ}/tests/xtouch.o \
- ${LIBBFS} \
- ${UNIT_OBJS}