4 .PHONY: all install uninstall autorandr bash_completion pmutils systemd udev
7 @echo "Call \"make install\" to install this program."
8 @echo "Call \"make uninstall\" to remove this program."
10 @echo "The following components were autodetected and will be installed:"
11 @echo " "$(DEFAULT_TARGETS)
12 @echo "You can use the TARGETS variable to override, e.g. \"make install TAGETS='autorandr pmutils'\"."
14 # Rules for autorandr itself
15 DEFAULT_TARGETS=autorandr
18 install -D -m 755 autorandr.py ${DESTDIR}${PREFIX}/bin/autorandr
21 rm -f ${DESTDIR}${PREFIX}/bin/autorandr
23 # Rules for bash_completion
24 HAVE_BASH_COMPLETION=$(shell [ -d /etc/bash_completion.d/ ] && echo "y")
25 ifeq ($(HAVE_BASH_COMPLETION),y)
26 DEFAULT_TARGETS+=bash_completion
29 install_bash_completion:
30 install -D -m 644 contrib/bash_completion/autorandr ${DESTDIR}/etc/bash_completion.d/autorandr
32 uninstall_bash_completion:
33 rm -f ${DESTDIR}/etc/bash_completion.d/autorandr
36 HAVE_PMUTILS=$(shell [ -x /usr/sbin/pm-suspend ] && echo "y")
37 ifeq ($(HAVE_PMUTILS),y)
38 DEFAULT_TARGETS+=pmutils
42 install -D -m 755 contrib/pm-utils/40autorandr ${DESTDIR}/etc/pm/sleep.d/40autorandr
45 rm -f ${DESTDIR}/etc/pm/sleep.d/40autorandr
48 HAVE_SYSTEMD=$(shell grep -q systemd $$(readlink -f $$(awk '{print $$1}' /proc/1/cmdline)) && echo "y")
49 ifeq ($(HAVE_SYSTEMD),y)
50 DEFAULT_TARGETS+=systemd
53 install_systemd: install_pmutils
54 install -D -m 644 contrib/systemd/autorandr-resume.service ${DESTDIR}/etc/systemd/system/autorandr-resume.service
56 uninstall_systemd: uninstall_pmutils
57 rm -f ${DESTDIR}/etc/systemd/system/autorandr-resume.service
60 HAVE_UDEV=$(shell [ -d /etc/udev/rules.d/ ] && echo "y")
66 install -D -m 644 contrib/udev/40-monitor-hotplug.rules ${DESTDIR}/etc/udev/rules.d/40-monitor-hotplug.rules
68 udevadm control --reload-rules
70 @echo "Please run this command as root:"
71 @echo " udevadm control --reload-rules"
75 rm -f ${DESTDIR}/etc/udev/rules.d/40-monitor-hotplug.rules
78 TARGETS=$(DEFAULT_TARGETS)
79 install: $(patsubst %,install_%,$(TARGETS))
80 uninstall: $(patsubst %,uninstall_%,$(TARGETS))