Template
build: add release/debug profiles (-O2 / -g2)
This commit is contained in:
+22
@@ -13,3 +13,25 @@ EXTRA_DIST = tests/run.sh scripts/build-static.sh
|
||||
.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"
|
||||
|
||||
Reference in New Issue
Block a user