Put linked libraries in LDLIBS master
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Wed, 28 Dec 2022 10:34:36 +0000 (11:34 +0100)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Wed, 28 Dec 2022 10:34:36 +0000 (11:34 +0100)
This fixes building when compilers use -Wl,--as-needed, ensuring that
the libraries get specified after the source files while still using the
default implicit rule for building .c files.

Ths supersedes the proposed PR #11 on GitHub.

Makefile

index 88bbce0..890220f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -10,8 +10,8 @@ CPPFLAGS += -I$(XWIIMOTE)/lib
 
 LDFLAGS ?=
 LDFLAGS += -L$(XWIIMOTE)/.libs
-LDFLAGS += -ludev
-LDFLAGS += -lxwiimote
+LDLIBS += -ludev
+LDLIBS += -lxwiimote
 
 wiimote-pad: wiimote-pad.c