Use pkg-config to configure libusb dependency.

This commit is contained in:
Serge Vakulenko 2019-06-25 21:15:44 -07:00
parent ad8bb33c13
commit 032af09b2a
3 changed files with 5 additions and 5 deletions

View File

@ -3,11 +3,12 @@ CC = gcc
VERSION = $(shell git describe --tags --abbrev=0) VERSION = $(shell git describe --tags --abbrev=0)
GITCOUNT = $(shell git rev-list HEAD --count) GITCOUNT = $(shell git rev-list HEAD --count)
UNAME = $(shell uname) 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 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 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 # Linux
@ -17,7 +18,6 @@ LIBS = -lusb-1.0
# #
ifeq ($(UNAME),Linux) ifeq ($(UNAME),Linux)
OBJS += hid-libusb.o OBJS += hid-libusb.o
LIBS += -ludev
LIBUSB = /usr/lib/x86_64-linux-gnu/libusb-1.0.a LIBUSB = /usr/lib/x86_64-linux-gnu/libusb-1.0.a
ifeq ($(wildcard $(LIBUSB)),$(LIBUSB)) ifeq ($(wildcard $(LIBUSB)),$(LIBUSB))
# Link libusb statically, when possible # Link libusb statically, when possible

View File

@ -29,7 +29,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <libusb-1.0/libusb.h> #include <libusb.h>
#include "util.h" #include "util.h"
// //

View File

@ -29,7 +29,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <libusb-1.0/libusb.h> #include <libusb.h>
#include "util.h" #include "util.h"
static libusb_context *ctx = NULL; // libusb context static libusb_context *ctx = NULL; // libusb context