2016-06-12 20:16:07 +00:00
|
|
|
CC=g++
|
2016-08-07 18:36:13 +00:00
|
|
|
CFLAGS=-Wall -O2 -std=gnu++11
|
2016-06-16 18:14:52 +00:00
|
|
|
LDFLAGS=-lusb-1.0
|
|
|
|
PROGN=g810-led
|
2017-01-15 04:39:05 +00:00
|
|
|
SYSTEMDDIR?=/usr/lib/systemd
|
2016-06-12 20:16:07 +00:00
|
|
|
|
2017-01-21 08:15:18 +00:00
|
|
|
.PHONY: all debug clean
|
2016-06-16 18:14:52 +00:00
|
|
|
|
|
|
|
all: bin/$(PROGN)
|
2016-06-12 20:16:07 +00:00
|
|
|
|
2017-01-21 08:15:18 +00:00
|
|
|
bin/$(PROGN): src/main.cpp src/helpers/*.cpp src/helpers/*.h src/classes/*.cpp src/classes/*.h
|
2016-06-16 18:14:52 +00:00
|
|
|
@mkdir -p bin
|
2017-01-21 08:15:18 +00:00
|
|
|
$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
|
|
|
|
|
2016-12-12 20:06:45 +00:00
|
|
|
debug: CFLAGS += -g -Wextra -pedantic
|
2016-06-16 18:20:28 +00:00
|
|
|
debug: bin/$(PROGN)
|
2017-01-21 08:15:18 +00:00
|
|
|
|
2016-06-12 20:16:07 +00:00
|
|
|
clean:
|
2016-12-28 00:45:34 +00:00
|
|
|
@rm -rf bin
|
2017-01-21 08:15:18 +00:00
|
|
|
|
2016-12-28 00:45:34 +00:00
|
|
|
install:
|
2017-01-15 04:39:05 +00:00
|
|
|
@install -m 755 -d \
|
|
|
|
$(DESTDIR)/etc/$(PROGN)/samples \
|
|
|
|
$(DESTDIR)/etc/udev/rules.d \
|
|
|
|
$(DESTDIR)$(SYSTEMDDIR)/system \
|
|
|
|
$(DESTDIR)/usr/bin
|
|
|
|
@cp bin/$(PROGN) $(DESTDIR)/usr/bin
|
|
|
|
@test -s $(DESTDIR)/usr/bin/g410-led || ln -s /usr/bin/$(PROGN) $(DESTDIR)/usr/bin/g410-led
|
|
|
|
@test -s $(DESTDIR)/usr/bin/g610-led || ln -s /usr/bin/$(PROGN) $(DESTDIR)/usr/bin/g610-led
|
|
|
|
@test -s $(DESTDIR)/usr/bin/g910-led || ln -s /usr/bin/$(PROGN) $(DESTDIR)/usr/bin/g910-led
|
|
|
|
@cp udev/$(PROGN).rules $(DESTDIR)/etc/udev/rules.d
|
|
|
|
@cp sample_profiles/* $(DESTDIR)/etc/$(PROGN)/samples
|
|
|
|
@test -s $(DESTDIR)/etc/$(PROGN)/profile || cp $(DESTDIR)/etc/$(PROGN)/samples/group_keys $(DESTDIR)/etc/$(PROGN)/profile
|
|
|
|
@test -s $(DESTDIR)/etc/$(PROGN)/reboot || cp $(DESTDIR)/etc/$(PROGN)/samples/all_off $(DESTDIR)/etc/$(PROGN)/reboot
|
|
|
|
@cp systemd/$(PROGN).service $(DESTDIR)$(SYSTEMDDIR)/system
|
|
|
|
@cp systemd/$(PROGN)-reboot.service $(DESTDIR)$(SYSTEMDDIR)/system
|
|
|
|
@udevadm control --reload-rules
|
|
|
|
@systemctl daemon-reload
|
|
|
|
@systemctl start $(PROGN)
|
|
|
|
@systemctl enable $(PROGN)
|
|
|
|
@systemctl enable $(PROGN)-reboot
|
2016-12-28 00:45:34 +00:00
|
|
|
|
|
|
|
uninstall:
|
2017-01-15 04:39:05 +00:00
|
|
|
@systemctl disable $(PROGN)
|
|
|
|
@systemctl disable $(PROGN)-reboot
|
|
|
|
@rm $(SYSTEMDDIR)/system/$(PROGN).service
|
|
|
|
@rm $(SYSTEMDDIR)/system/$(PROGN)-reboot.service
|
|
|
|
@systemctl daemon-reload
|
|
|
|
@rm /usr/bin/g410-led
|
|
|
|
@rm /usr/bin/g610-led
|
|
|
|
@rm /usr/bin/g910-led
|
|
|
|
@rm /usr/bin/$(PROGN)
|
|
|
|
@rm -R /etc/$(PROGN)
|
|
|
|
@rm /etc/udev/rules.d/$(PROGN).rules
|
|
|
|
@udevadm control --reload-rules
|