From 596bc731cf8014bc10e95b5cb85e0e18929a1f28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Freitag?= Date: Sat, 21 Jan 2017 19:32:30 -0800 Subject: [PATCH] Split file installation and loading commands To ease packaging, the new setup rule only copies files to the correct location. The install rules perform the commands to load the newly installed files. --- makefile | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/makefile b/makefile index 5140ca1..c960a37 100644 --- a/makefile +++ b/makefile @@ -24,32 +24,24 @@ debug: bin/$(PROGN) clean: @rm -rf bin - -install: - @install -m 755 -d \ - $(DESTDIR)/etc/udev/rules.d \ - $(DESTDIR)/usr/bin + +setup: + @install -m 755 -d $(DESTDIR)/etc/udev/rules.d $(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 + @install -m 755 -d $(DESTDIR)/etc/$(PROGN)/samples $(DESTDIR)$(SYSTEMDDIR)/system + @cp sample_profiles/* $(DESTDIR)/etc/$(PROGN)/samples + @cp $(DESTDIR)/etc/$(PROGN)/samples/group_keys $(DESTDIR)/etc/$(PROGN)/profile + @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 + +install: setup @udevadm control --reload-rules - @test -s /usr/bin/systemd-run && \ - install -m 755 -d \ - $(DESTDIR)/etc/$(PROGN)/samples \ - $(DESTDIR)$(SYSTEMDDIR)/system && \ - 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 /usr/bin/systemd-run && \ - test -s $(DESTDIR)/etc/$(PROGN)/reboot || \ - cp $(DESTDIR)/etc/$(PROGN)/samples/all_off $(DESTDIR)/etc/$(PROGN)/reboot - @test -s /usr/bin/systemd-run && \ - cp systemd/$(PROGN).service $(DESTDIR)$(SYSTEMDDIR)/system && \ - cp systemd/$(PROGN)-reboot.service $(DESTDIR)$(SYSTEMDDIR)/system && \ systemctl daemon-reload && \ systemctl start $(PROGN) && \ systemctl enable $(PROGN) && \