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-12-12 20:06:45 +00:00
|
|
|
LIBUSB_INC?=-I/usr/include/libusb-1.0
|
2016-06-16 18:14:52 +00:00
|
|
|
LDFLAGS=-lusb-1.0
|
|
|
|
PROGN=g810-led
|
2016-06-12 20:16:07 +00:00
|
|
|
|
2016-12-28 01:02:42 +00:00
|
|
|
.PHONY: all debug clean install uninstall
|
2016-06-16 18:14:52 +00:00
|
|
|
|
|
|
|
all: bin/$(PROGN)
|
2016-06-12 20:16:07 +00:00
|
|
|
|
2016-12-12 20:06:45 +00:00
|
|
|
bin/$(PROGN): src/main.cpp src/classes/*.cpp src/classes/*.h
|
2016-06-16 18:14:52 +00:00
|
|
|
@mkdir -p bin
|
2016-12-12 20:06:45 +00:00
|
|
|
$(CC) $(CFLAGS) $(LIBUSB_INC) -o $@ $^ $(LDFLAGS)
|
2016-06-12 20:16:07 +00:00
|
|
|
|
2016-12-12 20:06:45 +00:00
|
|
|
debug: CFLAGS += -g -Wextra -pedantic
|
2016-06-16 18:20:28 +00:00
|
|
|
debug: bin/$(PROGN)
|
|
|
|
|
2016-06-12 20:16:07 +00:00
|
|
|
clean:
|
2016-12-28 00:45:34 +00:00
|
|
|
@rm -rf bin
|
2016-06-12 20:16:07 +00:00
|
|
|
|
2016-12-28 00:45:34 +00:00
|
|
|
install:
|
|
|
|
@sudo mkdir -p /etc/$(PROGN)/samples
|
|
|
|
@sudo cp sample_profiles/* /etc/$(PROGN)/samples
|
|
|
|
@sudo cp udev/$(PROGN).rules /etc/udev/rules.d
|
2017-01-05 00:12:27 +00:00
|
|
|
@sudo udevadm control --reload-rules
|
2016-12-28 00:45:34 +00:00
|
|
|
@sudo cp bin/$(PROGN) /usr/bin
|
2017-01-04 23:42:34 +00:00
|
|
|
@sudo test -s /usr/bin/g410-led || sudo ln -s /usr/bin/$(PROGN) /usr/bin/g410-led
|
|
|
|
@sudo test -s /usr/bin/g610-led || sudo ln -s /usr/bin/$(PROGN) /usr/bin/g610-led
|
|
|
|
@sudo test -s /usr/bin/g910-led || sudo ln -s /usr/bin/$(PROGN) /usr/bin/g910-led
|
2016-12-28 00:45:34 +00:00
|
|
|
@sudo test -s /etc/$(PROGN)/profile || sudo cp /etc/$(PROGN)/samples/group_keys /etc/$(PROGN)/profile
|
|
|
|
@sudo test -s /etc/$(PROGN)/reboot || sudo cp /etc/$(PROGN)/samples/all_off /etc/$(PROGN)/reboot
|
2016-12-30 18:36:56 +00:00
|
|
|
@sudo cp systemd/$(PROGN).service /lib/systemd/system
|
|
|
|
@sudo cp systemd/$(PROGN)-reboot.service /lib/systemd/system
|
2017-01-04 23:46:30 +00:00
|
|
|
@sudo systemctl daemon-reload
|
2016-12-28 00:45:34 +00:00
|
|
|
@sudo systemctl start $(PROGN)
|
|
|
|
@sudo systemctl enable $(PROGN)
|
|
|
|
@sudo systemctl enable $(PROGN)-reboot
|
|
|
|
|
|
|
|
uninstall:
|
|
|
|
@sudo systemctl disable $(PROGN)
|
|
|
|
@sudo systemctl disable $(PROGN)-reboot
|
2016-12-30 23:20:52 +00:00
|
|
|
@sudo rm /lib/systemd/system/$(PROGN).service
|
|
|
|
@sudo rm /lib/systemd/system/$(PROGN)-reboot.service
|
2017-01-04 23:46:30 +00:00
|
|
|
@sudo systemctl daemon-reload
|
2017-01-04 22:56:41 +00:00
|
|
|
@sudo rm /usr/bin/g410-led
|
|
|
|
@sudo rm /usr/bin/g610-led
|
|
|
|
@sudo rm /usr/bin/g910-led
|
2016-12-28 00:45:34 +00:00
|
|
|
@sudo rm /usr/bin/$(PROGN)
|
|
|
|
@sudo rm -R /etc/$(PROGN)
|
2017-01-05 00:12:27 +00:00
|
|
|
@sudo rm /etc/udev/rules.d/$(PROGN).rules
|
|
|
|
@sudo udevadm control --reload-rules
|