summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-04-15 12:02:21 -0400
committerTavian Barnes <tavianator@tavianator.com>2024-04-15 12:02:21 -0400
commiteb7dffa166a01240ba50dd23b1f086339b6eb619 (patch)
tree6a58c109bdb5d3877af16699568c4e1930410388
parenta28b04cfbce8948cb1b216da065a229009a99f01 (diff)
downloadbfs-eb7dffa166a01240ba50dd23b1f086339b6eb619.tar.xz
build: Show a nicer error if the user forgets to run make config
-rw-r--r--Makefile11
1 files 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