diff options
authorKing Kévin <kingkevin@cuvoodoo.info>2021-02-17 09:49:02 +0100
committerKing Kévin <kingkevin@cuvoodoo.info>2021-02-17 09:49:02 +0100
commit2c4772ce53840c609d960121568c625a13c7f5a5 (patch)
parent7fc06171d9fe53ae039f097cb2948aa2821b661d (diff)
From `man gcc`:HEADmaster
It makes a difference where in the command you write this option; the linker searches and processes libraries and object files in the order they are specified. Thus, foo.o -lz bar.o searches library z after file foo.o but before bar.o. If bar.o refers to functions in z, those functions may not be loaded.
1 files changed, 2 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 8d6c20d..2b07534 100644
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,7 @@ CFLAGS += -fno-common -ffunction-sections -fdata-sections
all: u2_usb u2_bt
u2_usb: u2_usb.c
- gcc ${CFLAGS} -lhidapi-libusb -o $@ $<
+ gcc ${CFLAGS} `pkg-config --cflags hidapi-libusb` -o $@ $< `pkg-config --libs hidapi-libusb`
u2_bt: u2_bt.c
- gcc ${CFLAGS} `pkg-config --cflags dbus-1` `pkg-config --libs dbus-1` -o $@ $<
+ gcc ${CFLAGS} `pkg-config --cflags dbus-1` -o $@ $< `pkg-config --libs dbus-1`