summaryrefslogtreecommitdiffstats
path: root/build/flags.mk
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-05-21 15:53:52 -0400
committerTavian Barnes <tavianator@tavianator.com>2024-05-21 15:53:52 -0400
commitdd8e3b8b3e2d55c586e80e62d88719909bd8a568 (patch)
tree2a1de46f9e5b557a90e673e656f531340d0db962 /build/flags.mk
parentf9498086969d917a85452560173a0d9db3604c32 (diff)
downloadbfs-dd8e3b8b3e2d55c586e80e62d88719909bd8a568.tar.xz
build: Allow flags.mk to override command line variables
Previously, during something like ./configure LDFLAGS=..., any additions to LDFLAGS from the generated makefiles were ignored. I had thought that sub-make invocations would allow those variables to be overridden, but that is not the behaviour of make. So instead, set _LDFLAGS etc. in the generated files so that they don't conflict.
Diffstat (limited to 'build/flags.mk')
-rw-r--r--build/flags.mk44
1 files changed, 22 insertions, 22 deletions
diff --git a/build/flags.mk b/build/flags.mk
index c911b22..8e359aa 100644
--- a/build/flags.mk
+++ b/build/flags.mk
@@ -109,28 +109,28 @@ APPEND = @append() { test -z "$$2" || printf '%s += %s\n' "$$1" "$$2" >>$@; }; a
gen/flags.mk::
${MSG} "[ GEN] $@"
@printf '# %s\n' "$@" >$@
- ${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} _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} $@