From 15a3d49bf12b24c0a353525acb93e188f67e7581 Mon Sep 17 00:00:00 2001 From: "Andrew G. Morgan" Date: Tue, 31 Aug 2021 19:05:59 -0700 Subject: Move $(LDFLAGS) earlier in build command lines. As explained (thanks David Seifert) there are some LDFLAGS that need to precede actual linked libraries. For example, -Wl,--as-needed. Given this, I've tried it and it appears to work for the default build cases as captured in 'make distcheck'. Signed-off-by: Andrew G. Morgan --- progs/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'progs') diff --git a/progs/Makefile b/progs/Makefile index 0917dd3..2f887c8 100644 --- a/progs/Makefile +++ b/progs/Makefile @@ -28,7 +28,7 @@ endif $(MAKE) -C ../libcap libcap.so $(BUILD): %: %.o $(DEPS) - $(CC) $(CFLAGS) -o $@ $< $(LIBCAPLIB) $(LDFLAGS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBCAPLIB) %.o: %.c $(INCS) $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ @@ -49,8 +49,10 @@ capshdoc.h.cf: capshdoc.h ./mkcapshdoc.sh diff -u capshdoc.h $@ || (rm $@ ; exit 1) capsh: capsh.c capshdoc.h.cf $(DEPS) - $(CC) $(CFLAGS) $(CPPFLAGS) $(CAPSH_SHELL) -o $@ $< $(LIBCAPLIB) $(LDFLAGS) + $(CC) $(CFLAGS) $(CPPFLAGS) $(CAPSH_SHELL) $(LDFLAGS) -o $@ $< $(LIBCAPLIB) +# Statically linked with minimal linkage flags to enable running in a +# chroot and in other in-tree testing contexts. tcapsh-static: capsh.c capshdoc.h.cf $(DEPS) $(CC) $(CFLAGS) $(CPPFLAGS) $(CAPSH_SHELL) -o $@ $< $(LIBCAPLIB) --static -- cgit v1.2.1