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

42 lines
1.3 KiB
Makefile
Raw Normal View History

2016-06-12 20:16:07 +00:00
CC=g++
2016-08-07 18:36:13 +00:00
CFLAGS=-Wall -O2 -std=gnu++11
LIBUSB_INC?=-I/usr/include/libusb-1.0
LDFLAGS=-lusb-1.0
PROGN=g810-led
2016-06-12 20:16:07 +00:00
2016-12-28 00:45:34 +00:00
.PHONY: all debug clean install uninstall update
all: bin/$(PROGN)
2016-06-12 20:16:07 +00:00
bin/$(PROGN): src/main.cpp src/classes/*.cpp src/classes/*.h
@mkdir -p bin
$(CC) $(CFLAGS) $(LIBUSB_INC) -o $@ $^ $(LDFLAGS)
2016-06-12 20:16:07 +00:00
debug: CFLAGS += -g -Wextra -pedantic
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
@sudo cp bin/$(PROGN) /usr/bin
@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
@sudo cp systemd/$(PROGN).service /usr/lib/systemd/system
@sudo cp systemd/$(PROGN)-reboot.service /usr/lib/systemd/system
@sudo systemctl start $(PROGN)
@sudo systemctl enable $(PROGN)
@sudo systemctl enable $(PROGN)-reboot
uninstall:
@sudo systemctl disable $(PROGN)
@sudo systemctl disable $(PROGN)-reboot
@sudo rm /usr/lib/systemd/system/$(PROGN).service
@sudo rm /usr/lib/systemd/system/$(PROGN)-reboot.service
@sudo rm /etc/udev/rules.d/$(PROGN).rules
@sudo rm /usr/bin/$(PROGN)
@sudo rm -R /etc/$(PROGN)