From eb7dffa166a01240ba50dd23b1f086339b6eb619 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Mon, 15 Apr 2024 12:02:21 -0400 Subject: build: Show a nicer error if the user forgets to run make config --- Makefile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 453aeab..94aba73 100644 --- a/Makefile +++ b/Makefile @@ -244,10 +244,17 @@ ${PKG_MKS}: ${GEN}/vars.mk # bfs used to have flag-like targets (`make release`, `make asan ubsan`, etc.). # Direct users to the new configuration system. asan lsan msan tsan ubsan gcov lint release:: - @printf 'error: `make %s` is no longer supported. ' $@ >&2 - @printf 'Use `make config %s=y` instead.\n' $$(echo $@ | tr '[a-z]' '[A-Z]') >&2 + @printf 'error: `%s %s` is no longer supported. ' "${MAKE}" $@ >&2 + @printf 'Use `%s config %s=y` instead.\n' "${MAKE}" $$(echo $@ | tr '[a-z]' '[A-Z]') >&2 @false +# Print an error if `make` is run before `make config` +${CONFIG}:: + @if ! [ -e $@ ]; then \ + printf 'error: You must run `%s config` before `%s`.\n' "${MAKE}" "${MAKE}" >&2; \ + false; \ + fi + ## Build phase (`make`) # The main binary -- cgit v1.2.3