From bf70dc6d4fc5f440b2589a2ca9fd9f834ad2e0f9 Mon Sep 17 00:00:00 2001 From: David E Date: Sun, 15 Mar 2020 19:57:11 -0400 Subject: [PATCH 1/2] OSX Makefile changes --- makefile | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/makefile b/makefile index 6102514..d9f17f3 100644 --- a/makefile +++ b/makefile @@ -1,4 +1,5 @@ -CXX?=g++ +UNAME := $(shell uname) + CXXFLAGS?=-Wall -O2 LIB?=hidapi ifeq ($(LIB),libusb) @@ -6,9 +7,20 @@ ifeq ($(LIB),libusb) LIBS=-lusb-1.0 else CPPFLAGS=-Dhidapi - LIBS=-lhidapi-hidraw + ifeq ($(UNAME),Darwin) + LIBS = -lhidapi + else + LIBS = -lhidapi-hidraw + endif endif SYSTEMDDIR?=/usr/lib/systemd +$(warning CXX is $(CXX)) +# Handle CLANG-specific link syntax +ifeq ($(UNAME),Darwin) + LINK_FLAGS = -Wl,-install_name,lib$(PROGN).so +else + LINK_FLAGS = -Wl,-soname,lib$(PROGN).so +endif PREFIX?=$(DESTDIR)/usr libdir?=$(PREFIX)/lib @@ -33,13 +45,13 @@ bin: bin/$(PROGN) bin/$(PROGN): $(APPSRCS) $(LIBSRCS) @mkdir -p bin $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS) - + debug: CXXFLAGS += -g -Wextra -pedantic debug: bin/$(PROGN) lib/lib$(PROGN).so: $(LIBSRCS) @mkdir -p lib - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -fPIC -shared -Wl,-soname,lib$(PROGN).so -o lib/lib$(PROGN).so.$(MAJOR).$(MINOR).$(MICRO) $^ $(LIBS) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -fPIC -shared $(LINKFLAGS) -o lib/lib$(PROGN).so.$(MAJOR).$(MINOR).$(MICRO) $^ $(LIBS) @ln -sf lib$(PROGN).so.$(MAJOR).$(MINOR).$(MICRO) lib/lib$(PROGN).so bin-linked: lib/lib$(PROGN).so @@ -104,7 +116,7 @@ uninstall: rm $(SYSTEMDDIR)/system/$(PROGN)-reboot.service && \ systemctl daemon-reload && \ rm -R /etc/$(PROGN) - + @rm /usr/bin/g213-led @rm /usr/bin/g410-led @rm /usr/bin/g413-led @@ -114,6 +126,6 @@ uninstall: @rm /usr/bin/g910-led @rm /usr/bin/gpro-led @rm /usr/bin/$(PROGN) - + @rm /etc/udev/rules.d/$(PROGN).rules @udevadm control --reload-rules From dfe0783b4e52558831120e10502fac6fd210df6a Mon Sep 17 00:00:00 2001 From: David E Date: Sun, 15 Mar 2020 20:04:04 -0400 Subject: [PATCH 2/2] OSX Makefile changes (restored accidentally deleted line) --- makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/makefile b/makefile index d9f17f3..ccf890f 100644 --- a/makefile +++ b/makefile @@ -1,3 +1,4 @@ +CXX?=g++ UNAME := $(shell uname) CXXFLAGS?=-Wall -O2