From 44150667f5c3a4dc317021e2f0d7ce3cb91f64e2 Mon Sep 17 00:00:00 2001 From: Steve Langasek Date: Mon, 9 Sep 2019 21:04:11 -0400 Subject: [PATCH] Ensure libraries linked are listed after objects using them The Ubuntu toolchain uses -Wl,--as-needed by default, which causes libraries to be dropped from the final binary if they aren't used. For portability, make sure that libraries are always listed on the linker commandline /after/ the objects that reference them. . This also avoids passing -l options to the compiler when compiling .o files. --- Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 4caf1cc..700afa7 100644 --- a/Makefile +++ b/Makefile @@ -3,8 +3,7 @@ VERSION=1.1.9 CFLAGS+= -O2 -Wall -Wextra -Wshadow -rdynamic\ -D_FILE_OFFSET_BITS=64 -DVERSION=\"$(VERSION)\" \ `pkg-config --cflags-only-I gumbo libcurl fuse` -LDFLAGS+= -pthread -lgumbo -lcurl -lfuse -lcrypto \ - `pkg-config --libs-only-L gumbo libcurl fuse` +LIBS = -pthread -lgumbo -lcurl -lfuse -lcrypto COBJS = main.o network.o fuse_local.o link.o cache.o util.o prefix ?= /usr/local @@ -15,7 +14,7 @@ all: httpdirfs $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -c -o $@ $< httpdirfs: $(COBJS) - $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDFLAGS) + $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) install: install -m 755 -D httpdirfs \