From 695d1701cdd1bb4539f652c2204f7787097b2715 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Sat, 5 Jun 2021 22:36:24 +0100 Subject: jztool: add correct compiler flags for building on Mac Change-Id: Ic89b5a2e65754891fedd63fec1e7235ed424e5f9 --- rbutil/jztool/Makefile | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/rbutil/jztool/Makefile b/rbutil/jztool/Makefile index bc2724ef59..5e397c59aa 100644 --- a/rbutil/jztool/Makefile +++ b/rbutil/jztool/Makefile @@ -25,15 +25,23 @@ ifeq ($(findstring WIN32,$(CPPDEFINES)),WIN32) # TODO: support Windows else ifeq ($(findstring APPLE,$(CPPDEFINES)),APPLE) -# OSX -- /opt location is cheesy attempt to support ARM macs -# COMPLETELY UNTESTED, testing from someone with an actual Mac is appreciated! -CFLAGS += -I/usr/local/include -I/opt/homebrew/include -LDOPTS += -L/usr/local/lib -L/opt/homebrew/lib -lusb-1.0 +# Mac, tested on x86 only -- may need to adjust paths if building on ARM. +# paths should work with homebrew libusb. +LIBUSB_CFLAGS ?= -I/usr/local/include/libusb-1.0 +ifdef STATIC +LIBUSB_LDOPTS ?= /usr/local/lib/libusb-1.0.a -framework IOKit -framework CoreFoundation else -# Linux -CFLAGS += `pkg-config --cflags libusb-1.0` -LDOPTS += `pkg-config --libs libusb-1.0` +LIBUSB_LDOPTS ?= -L/usr/local/lib -lusb-1.0 +endif +else +# Linux; note for static builds you need to build a copy of libusb without +# udev support and specify the includes / libs manually +LIBUSB_CFLAGS ?= `pkg-config --cflags libusb-1.0` +LIBUSB_LDOPTS ?= `pkg-config --libs libusb-1.0` endif endif +CFLAGS += $(LIBUSB_CFLAGS) +LDOPTS += $(LIBUSB_LDOPTS) + include ../libtools.make -- cgit v1.2.3