From 07f61719e735f932440e3300da586c873099adc6 Mon Sep 17 00:00:00 2001 From: Göktürk Yüksek Date: Wed, 25 May 2016 08:31:55 -0400 Subject: Fix the linking order of tests in the Makefile for --as-needed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When '--as-needed' linker flag is added to LDFLAGS, linker strips out the symbols from the libraries needed for the tests due to the order in which the libraries appear on the command line. List the source files before the libraries to fix the linking issue. For more information, see: https://wiki.gentoo.org/wiki/Project:Quality_Assurance/As-needed#Importance_of_linking_order Signed-off-by: Göktürk Yüksek --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 7e40bf1..c130dfb 100644 --- a/Makefile +++ b/Makefile @@ -48,7 +48,7 @@ $(BUILDDIR)/%.o: src/%.c $(BUILDDIR)/test_%: test/%.c src/%.c @echo "BUILDING $@" - $(MUTE)$(CC) -o $@ -Isrc $(TFLAGS) $(LDFLAGS) -lcmocka $^ + $(MUTE)$(CC) -o $@ -Isrc $(TFLAGS) $^ $(LDFLAGS) -lcmocka check: $(BUILDDIR) $(TESTS) @echo "RUNNING TESTS" -- cgit v1.2.3