From 032af09b2a29ab20caa9274636e19409a6261006 Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Tue, 25 Jun 2019 21:15:44 -0700 Subject: [PATCH] Use pkg-config to configure libusb dependency. --- Makefile | 6 +++--- dfu-libusb.c | 2 +- hid-libusb.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 66db092..88ebb33 100644 --- a/Makefile +++ b/Makefile @@ -3,11 +3,12 @@ CC = gcc VERSION = $(shell git describe --tags --abbrev=0) GITCOUNT = $(shell git rev-list HEAD --count) UNAME = $(shell uname) -CFLAGS = -g -O -Wall -Werror -DVERSION='"$(VERSION).$(GITCOUNT)"' +CFLAGS = -g -O -Wall -Werror -DVERSION='"$(VERSION).$(GITCOUNT)"' \ + $(shell pkg-config --cflags libusb-1.0) LDFLAGS = -g OBJS = main.o util.o radio.o dfu-libusb.o uv380.o md380.o rd5r.o gd77.o hid.o serial.o d868uv.o -LIBS = -lusb-1.0 +LIBS = $(shell pkg-config --libs --static libusb-1.0) # # Linux @@ -17,7 +18,6 @@ LIBS = -lusb-1.0 # ifeq ($(UNAME),Linux) OBJS += hid-libusb.o - LIBS += -ludev LIBUSB = /usr/lib/x86_64-linux-gnu/libusb-1.0.a ifeq ($(wildcard $(LIBUSB)),$(LIBUSB)) # Link libusb statically, when possible diff --git a/dfu-libusb.c b/dfu-libusb.c index 5281a3f..8b4c760 100644 --- a/dfu-libusb.c +++ b/dfu-libusb.c @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include "util.h" // diff --git a/hid-libusb.c b/hid-libusb.c index a2c05ca..a998fc7 100644 --- a/hid-libusb.c +++ b/hid-libusb.c @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include "util.h" static libusb_context *ctx = NULL; // libusb context