1
0
mirror of https://github.com/MatMoul/g810-led.git synced 2024-12-23 01:06:11 +00:00

Merge branch 'lanodan-fix/makefile' into stdvar

This commit is contained in:
MatMoul 2018-09-13 21:48:03 +02:00
commit 1e16ee0844

View File

@ -1,18 +1,18 @@
CC=g++
CFLAGS=-Wall -O2 -std=gnu++11
CXX?=g++
CXXFLAGS?=-Wall -O2
LIB?=hidapi
ifeq ($(LIB),libusb)
CPPFLAGS=-Dlibusb
LDFLAGS=-lusb-1.0
LIBS=-lusb-1.0
else
CPPFLAGS=-Dhidapi
LDFLAGS=-lhidapi-hidraw
LIBS=-lhidapi-hidraw
endif
SYSTEMDDIR?=/usr/lib/systemd
prefix?=$(DESTDIR)/usr
libdir?=$(prefix)/lib
includedir?=$(prefix)/include
PREFIX?=$(DESTDIR)/usr
libdir?=$(PREFIX)/lib
includedir?=$(PREFIX)/include
# Program & versioning information
PROGN=g810-led
@ -20,7 +20,7 @@ MAJOR=0
MINOR=2
MICRO=7
CFLAGS+=-DVERSION=\"$(MAJOR).$(MINOR).$(MICRO)\"
CXXFLAGS+=-std=gnu++11 -DVERSION=\"$(MAJOR).$(MINOR).$(MICRO)\"
APPSRCS=src/main.cpp src/helpers/*.cpp src/helpers/*.h
LIBSRCS=src/classes/*.cpp src/classes/*.h
@ -32,19 +32,19 @@ bin: bin/$(PROGN)
bin/$(PROGN): $(APPSRCS) $(LIBSRCS)
@mkdir -p bin
$(CC) $(CPPFLAGS) $(CFLAGS) $^ -o $@ $(LDFLAGS)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS)
debug: CFLAGS += -g -Wextra -pedantic
debug: CXXFLAGS += -g -Wextra -pedantic
debug: bin/$(PROGN)
lib/lib$(PROGN).so: $(LIBSRCS)
@mkdir -p lib
$(CC) $(CPPFLAGS) $(CFLAGS) -fPIC -shared -Wl,-soname,lib$(PROGN).so -o lib/lib$(PROGN).so.$(MAJOR).$(MINOR).$(MICRO) $^ $(LDFLAGS)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -fPIC -shared -Wl,-soname,lib$(PROGN).so -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
@mkdir -p bin
$(CC) $(CPPFLAGS) $(CFLAGS) $(APPSRCS) -o bin/$(PROGN) $(LDFLAGS) -L./lib -l$(PROGN)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(APPSRCS) -o bin/$(PROGN) $(LIBS) -L./lib -l$(PROGN)
lib: lib/lib$(PROGN).so