From 2c4772ce53840c609d960121568c625a13c7f5a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?King=20K=C3=A9vin?= Date: Wed, 17 Feb 2021 09:49:02 +0100 Subject: [PATCH] From `man gcc`: 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. --- Makefile | 4 ++-- 1 file 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`