]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
src/Makefile: forward LDFLAGS to $(CC)
authorErik Schilling <erik.schilling@linaro.org>
Tue, 18 Apr 2023 13:27:41 +0000 (15:27 +0200)
committerErik Schilling <erik.schilling@linaro.org>
Tue, 18 Apr 2023 13:29:29 +0000 (15:29 +0200)
Something external may set some special LDFLAGS. Currently those would
get ignored. Lets honor them and pass them to the compiler.

This simplifies packaging and cross-compilation.

Signed-off-by: Erik Schilling <erik.schilling@linaro.org>
src/Makefile

index cbb0b258f16a199bf4cbd6ba9cda639ecd8425f4..1365480d87fa1eb98ea359974a2b187de9aadb9f 100644 (file)
@@ -40,6 +40,7 @@ override CFLAGS   := -O2 -Wall -Wshadow $(CFLAGS) $(CONFIG_DEFS)
 override CXXFLAGS := -O2 -std=c++11 -Wall -Wextra -Wshadow -Wno-sign-compare \
                     -Werror $(CXXFLAGS) $(CONFIG_DEFS)
 MINIUBLK_FLAGS :=  -D_GNU_SOURCE -lpthread -luring
+LDFLAGS ?=
 
 all: $(TARGETS)
 
@@ -51,12 +52,12 @@ install: $(TARGETS)
        install $(TARGETS) $(dest)
 
 $(C_TARGETS): %: %.c
-       $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^
+       $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^
 
 $(CXX_TARGETS): %: %.cpp
-       $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ $^
+       $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
 
 $(C_MINIUBLK): %: miniublk.c
-       $(CC) $(CFLAGS) $(MINIUBLK_FLAGS) -o $@ miniublk.c
+       $(CC) $(CFLAGS) $(LDFLAGS) $(MINIUBLK_FLAGS) -o $@ miniublk.c
 
 .PHONY: all clean install