Update Makefile for MacOS.

This commit is contained in:
Serge Vakulenko 2019-07-25 12:13:20 -07:00
parent 1af792bd8d
commit eb1417ebfa

View File

@ -3,26 +3,25 @@ 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)"'
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 =
LIBS = $(shell pkg-config --libs --static libusb-1.0)
LDFLAGS = -g
CFLAGS = -g -O -Wall -Werror -DVERSION='"$(VERSION).$(GITCOUNT)"' \
$(shell pkg-config --cflags libusb-1.0)
#
# Linux
#
# To install required libraries, use:
# sudo apt install libusb-1.0-0-dev libudev-dev
# sudo apt-get install pkg-config libusb-1.0-0-dev libudev-dev
#
ifeq ($(UNAME),Linux)
OBJS += hid-libusb.o
CFLAGS += $(shell pkg-config --cflags libusb-1.0)
LIBS += $(shell pkg-config --libs --static libusb-1.0)
# Link libusb statically, when possible
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
@ -30,6 +29,9 @@ endif
#
# Mac OS X
#
# To install required libraries, use:
# brew install pkg-config libusb
#
ifeq ($(UNAME),Darwin)
OBJS += hid-macos.o
LIBS += -framework IOKit -framework CoreFoundation