make: Prevent double wrapping of printf/vprintf

This is a bit awkward due to Makefiles having no concept of boolean ors,
but we can avoid passing multiple -Wl,--wrap flags with enough
ifdefs/ifndefs.
This commit is contained in:
Christopher Haster
2026-02-07 01:41:08 -06:00
parent 238c2babe4
commit 24ed0c2892
+4
View File
@@ -113,9 +113,11 @@ TEST_CFLAGS += -DTEST_HEAP
TEST_CFLAGS += -Wl,--wrap=malloc TEST_CFLAGS += -Wl,--wrap=malloc
TEST_CFLAGS += -Wl,--wrap=free TEST_CFLAGS += -Wl,--wrap=free
TEST_CFLAGS += -Wl,--wrap=realloc TEST_CFLAGS += -Wl,--wrap=realloc
ifndef STACK
TEST_CFLAGS += -Wl,--wrap=printf TEST_CFLAGS += -Wl,--wrap=printf
TEST_CFLAGS += -Wl,--wrap=vprintf TEST_CFLAGS += -Wl,--wrap=vprintf
endif endif
endif
BENCH_CFLAGS += -Wno-unused-function BENCH_CFLAGS += -Wno-unused-function
BENCH_CFLAGS += -Wno-format-overflow BENCH_CFLAGS += -Wno-format-overflow
@@ -129,9 +131,11 @@ BENCH_CFLAGS += -DBENCH_HEAP
BENCH_CFLAGS += -Wl,--wrap=malloc BENCH_CFLAGS += -Wl,--wrap=malloc
BENCH_CFLAGS += -Wl,--wrap=free BENCH_CFLAGS += -Wl,--wrap=free
BENCH_CFLAGS += -Wl,--wrap=realloc BENCH_CFLAGS += -Wl,--wrap=realloc
ifdef NO_STACK
BENCH_CFLAGS += -Wl,--wrap=printf BENCH_CFLAGS += -Wl,--wrap=printf
BENCH_CFLAGS += -Wl,--wrap=vprintf BENCH_CFLAGS += -Wl,--wrap=vprintf
endif endif
endif
ifdef VERBOSE ifdef VERBOSE
CODEFLAGS += -v CODEFLAGS += -v