Template
38 lines
1.4 KiB
Makefile
38 lines
1.4 KiB
Makefile
# Top-level Makefile.am: recursion into src/ plus the test harness.
|
|
# `make check` runs tests/run.sh through automake's parallel test harness
|
|
# (genuinely executed - the harness propagates the script's exit code).
|
|
|
|
SUBDIRS = src
|
|
|
|
TESTS = tests/run.sh
|
|
EXTRA_DIST = tests/run.sh scripts/build-static.sh
|
|
|
|
# Fully-static musl build (explicit opt-in; the default build stays dynamic).
|
|
# Requires a musl toolchain on the host - see scripts/build-static.sh for
|
|
# the probe order (musl-gcc -> musl-clang -> clang+sysroot -> apt -> musl.cc).
|
|
.PHONY: static
|
|
static:
|
|
$(SHELL) "$(srcdir)/scripts/build-static.sh"
|
|
|
|
# Release/debug build profiles (explicit opt-in; `make` alone is unchanged).
|
|
#
|
|
# Mechanism: CFLAGS is passed on the recursive make COMMAND LINE. Automake's
|
|
# compile rule ends with `$(AM_CFLAGS) $(CFLAGS)`, so a command-line CFLAGS
|
|
# overrides configure's `-g -O2` default while AM_CFLAGS (-std=c23 -Wall
|
|
# -Wextra -Wpedantic) is always kept. No configure.ac churn, no default
|
|
# build impact. Both targets clean first so a previous profile's objects
|
|
# can never be reused as a fresh build.
|
|
#
|
|
# release: -O2 -DNDEBUG, no -g, then the binary is stripped (needs binutils
|
|
# `strip` on PATH).
|
|
# debug: -g2 only, no -O/-O2, no NDEBUG (default CFLAGS are overridden).
|
|
.PHONY: release debug
|
|
release:
|
|
$(MAKE) clean
|
|
$(MAKE) CFLAGS="-O2 -DNDEBUG"
|
|
strip src/stupidtools
|
|
|
|
debug:
|
|
$(MAKE) clean
|
|
$(MAKE) CFLAGS="-g2"
|