4 .PHONY: all install uninstall autorandr bash_completion autostart_config 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 @echo "The following additional targets are available:"
16 @echo " make deb creates a Debian package"
18 # Rules for autorandr itself
19 DEFAULT_TARGETS=autorandr
22 install -D -m 755 autorandr.py ${DESTDIR}${PREFIX}/bin/autorandr
25 rm -f ${DESTDIR}${PREFIX}/bin/autorandr
27 # Rules for bash_completion
28 BASH_COMPLETION_DIR=/etc/bash_completion.d
29 HAVE_BASH_COMPLETION=$(shell [ -d /etc/bash_completion.d/ ] && echo "y")
30 ifeq ($(HAVE_BASH_COMPLETION),y)
31 DEFAULT_TARGETS+=bash_completion
34 install_bash_completion:
35 install -D -m 644 contrib/bash_completion/autorandr ${DESTDIR}/${BASH_COMPLETION_DIR}/autorandr
37 uninstall_bash_completion:
38 rm -f ${DESTDIR}/${BASH_COMPLETION_DIR}/autorandr
40 # Rules for autostart config
41 XDG_AUTOSTART_DIR=/etc/xdg/autostart
42 DEFAULT_TARGETS+=autostart_config
44 install_autostart_config:
45 install -D -m 644 contrib/etc/xdg/autostart/autorandr.desktop ${DESTDIR}/${XDG_AUTOSTART_DIR}/autorandr.desktop
47 uninstall_autostart_config:
48 rm -f ${DESTDIR}/${XDG_AUTOSTART_DIR}/autorandr.desktop
51 PM_UTILS_DIR=/etc/pm/sleep.d
52 HAVE_PMUTILS=$(shell [ -x /usr/sbin/pm-suspend ] && echo "y")
53 ifeq ($(HAVE_PMUTILS),y)
54 DEFAULT_TARGETS+=pmutils
58 install -D -m 755 contrib/pm-utils/40autorandr ${DESTDIR}/${PM_UTILS_DIR}/40autorandr
61 rm -f ${DESTDIR}/${PM_UTILS_DIR}/40autorandr
64 SYSTEMD_UNIT_DIR=/etc/systemd/system/
65 HAVE_SYSTEMD=$(shell grep -q systemd /proc/1/comm && echo "y")
66 ifeq ($(HAVE_SYSTEMD),y)
67 DEFAULT_TARGETS+=systemd
71 install -D -m 644 contrib/systemd/autorandr-resume.service ${DESTDIR}/${SYSTEMD_UNIT_DIR}/autorandr-resume.service
74 rm -f ${DESTDIR}/${SYSTEMD_UNIT_DIR}/autorandr-resume.service
77 UDEV_RULES_DIR=/etc/udev/rules.d
78 HAVE_UDEV=$(shell [ -d "${UDEV_RULES_DIR}" ] && echo "y")
84 install -D -m 644 contrib/udev/40-monitor-hotplug.rules ${DESTDIR}/${UDEV_RULES_DIR}/40-monitor-hotplug.rules
86 udevadm control --reload-rules
88 @echo "Please run this command as root:"
89 @echo " udevadm control --reload-rules"
93 rm -f ${DESTDIR}/${UDEV_RULES_DIR}/40-monitor-hotplug.rules
96 TARGETS=$(DEFAULT_TARGETS)
97 install: $(patsubst %,install_%,$(TARGETS))
98 uninstall: $(patsubst %,uninstall_%,$(TARGETS))
101 ./contrib/packaging/debian/make_deb.sh