mirror of
https://github.com/MatMoul/g810-led.git
synced 2024-12-23 09:16:11 +00:00
OSX Makefile changes
This commit is contained in:
parent
118631d184
commit
bf70dc6d4f
24
makefile
24
makefile
@ -1,4 +1,5 @@
|
|||||||
CXX?=g++
|
UNAME := $(shell uname)
|
||||||
|
|
||||||
CXXFLAGS?=-Wall -O2
|
CXXFLAGS?=-Wall -O2
|
||||||
LIB?=hidapi
|
LIB?=hidapi
|
||||||
ifeq ($(LIB),libusb)
|
ifeq ($(LIB),libusb)
|
||||||
@ -6,9 +7,20 @@ ifeq ($(LIB),libusb)
|
|||||||
LIBS=-lusb-1.0
|
LIBS=-lusb-1.0
|
||||||
else
|
else
|
||||||
CPPFLAGS=-Dhidapi
|
CPPFLAGS=-Dhidapi
|
||||||
LIBS=-lhidapi-hidraw
|
ifeq ($(UNAME),Darwin)
|
||||||
|
LIBS = -lhidapi
|
||||||
|
else
|
||||||
|
LIBS = -lhidapi-hidraw
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
SYSTEMDDIR?=/usr/lib/systemd
|
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
|
PREFIX?=$(DESTDIR)/usr
|
||||||
libdir?=$(PREFIX)/lib
|
libdir?=$(PREFIX)/lib
|
||||||
@ -33,13 +45,13 @@ bin: bin/$(PROGN)
|
|||||||
bin/$(PROGN): $(APPSRCS) $(LIBSRCS)
|
bin/$(PROGN): $(APPSRCS) $(LIBSRCS)
|
||||||
@mkdir -p bin
|
@mkdir -p bin
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS)
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS)
|
||||||
|
|
||||||
debug: CXXFLAGS += -g -Wextra -pedantic
|
debug: CXXFLAGS += -g -Wextra -pedantic
|
||||||
debug: bin/$(PROGN)
|
debug: bin/$(PROGN)
|
||||||
|
|
||||||
lib/lib$(PROGN).so: $(LIBSRCS)
|
lib/lib$(PROGN).so: $(LIBSRCS)
|
||||||
@mkdir -p lib
|
@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
|
@ln -sf lib$(PROGN).so.$(MAJOR).$(MINOR).$(MICRO) lib/lib$(PROGN).so
|
||||||
|
|
||||||
bin-linked: lib/lib$(PROGN).so
|
bin-linked: lib/lib$(PROGN).so
|
||||||
@ -104,7 +116,7 @@ uninstall:
|
|||||||
rm $(SYSTEMDDIR)/system/$(PROGN)-reboot.service && \
|
rm $(SYSTEMDDIR)/system/$(PROGN)-reboot.service && \
|
||||||
systemctl daemon-reload && \
|
systemctl daemon-reload && \
|
||||||
rm -R /etc/$(PROGN)
|
rm -R /etc/$(PROGN)
|
||||||
|
|
||||||
@rm /usr/bin/g213-led
|
@rm /usr/bin/g213-led
|
||||||
@rm /usr/bin/g410-led
|
@rm /usr/bin/g410-led
|
||||||
@rm /usr/bin/g413-led
|
@rm /usr/bin/g413-led
|
||||||
@ -114,6 +126,6 @@ uninstall:
|
|||||||
@rm /usr/bin/g910-led
|
@rm /usr/bin/g910-led
|
||||||
@rm /usr/bin/gpro-led
|
@rm /usr/bin/gpro-led
|
||||||
@rm /usr/bin/$(PROGN)
|
@rm /usr/bin/$(PROGN)
|
||||||
|
|
||||||
@rm /etc/udev/rules.d/$(PROGN).rules
|
@rm /etc/udev/rules.d/$(PROGN).rules
|
||||||
@udevadm control --reload-rules
|
@udevadm control --reload-rules
|
||||||
|
Loading…
Reference in New Issue
Block a user