Modify Makefile to link libusb statically, when possible, and dynamically otherwise.
This commit is contained in:
parent
2ba10d85ae
commit
a4c5f893d2
13
Makefile
13
Makefile
@ -9,13 +9,24 @@ LDFLAGS = -g
|
|||||||
OBJS = main.o util.o radio.o dfu-libusb.o uv380.o md380.o rd5r.o gd77.o hid.o
|
OBJS = main.o util.o radio.o dfu-libusb.o uv380.o md380.o rd5r.o gd77.o hid.o
|
||||||
LIBS = -lusb-1.0
|
LIBS = -lusb-1.0
|
||||||
|
|
||||||
|
#
|
||||||
# Linux
|
# Linux
|
||||||
|
#
|
||||||
|
# To install required libraries, use:
|
||||||
|
# sudo apt install libusb-1.0-0-dev libudev-dev
|
||||||
|
#
|
||||||
ifeq ($(UNAME),Linux)
|
ifeq ($(UNAME),Linux)
|
||||||
OBJS += hid-libusb.o
|
OBJS += hid-libusb.o
|
||||||
LIBS = -Wl,-Bstatic -lusb-1.0 -Wl,-Bdynamic -lpthread -ludev
|
LIBUSB = /usr/lib/x86_64-linux-gnu/libusb-1.0.a
|
||||||
|
ifeq ($(wildcard $(LIBUSB)),$(LIBUSB))
|
||||||
|
# Link libusb statically, when possible
|
||||||
|
LIBS = $(LIBUSB) -lpthread -ludev
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
#
|
||||||
# Mac OS X
|
# Mac OS X
|
||||||
|
#
|
||||||
ifeq ($(UNAME),Darwin)
|
ifeq ($(UNAME),Darwin)
|
||||||
OBJS += hid-macos.o
|
OBJS += hid-macos.o
|
||||||
LIBS += -framework IOKit -framework CoreFoundation
|
LIBS += -framework IOKit -framework CoreFoundation
|
||||||
|
Loading…
Reference in New Issue
Block a user