From dd8e3b8b3e2d55c586e80e62d88719909bd8a568 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Tue, 21 May 2024 15:53:52 -0400 Subject: 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. --- build/flags.mk | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'build/flags.mk') 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} $@ -- cgit v1.2.3