]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/blobdiff - Makefile
Undo making the launcher the default
[deb_pkgs/autorandr.git] / Makefile
index fd35f6a4ff702e3c592fc4c23037f32e678ea999..2ce8f7df081c222d8e84541f0c501b89ed3ec692 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,7 @@
 DESTDIR=/
 PREFIX=/usr/
+RPM_SPEC=contrib/packaging/rpm/autorandr.spec
+CFLAGS=-O2
 
 .PHONY: all install uninstall autorandr bash_completion autostart_config pmutils systemd udev
 
@@ -25,11 +27,13 @@ all:
        @echo "An additional TARGETS variable \"launcher\" is available. This"
        @echo "installs a launcher called \"autorandr_launcher\". The launcher"
        @echo "is able to be run by the user and calls autorandr automatically"
-       @echo "without using udev rules."
+       @echo "without using udev rules. The launcher is an alternative to the"
+       @echo "udev/systemd setup that is more stable for some users."
        @echo
        @echo "The following additional targets are available:"
        @echo
        @echo "    make deb        creates a Debian package"
+       @echo "    make rpm        creates a RPM package"
 
 # Rules for autorandr itself
 DEFAULT_TARGETS=autorandr
@@ -109,7 +113,7 @@ uninstall_pmutils:
 
 # Rules for udev
 UDEV_RULES_DIR:=$(shell pkg-config --variable=udevdir udev 2>/dev/null)/rules.d
-ifneq (,$(UDEV_RULES_DIR),y)
+ifneq (/rules.d,$(UDEV_RULES_DIR))
 DEFAULT_TARGETS+=udev
 endif
 
@@ -138,12 +142,19 @@ uninstall_manpage:
        rm -f ${DESTDIR}/${MANDIR}/autorandr.1
 
 # Rules for launcher
+LAUNCHER_FLAGS=$(shell pkg-config --libs --cflags pkg-config xcb xcb-randr 2>/dev/null)
 install_launcher:
-       gcc -Wall contrib/autorandr_launcher/autorandr_launcher.c -o contrib/autorandr_launcher/autorandr_launcher -lxcb -lxcb-randr
-       install -D -m 755 contrib/autorandr_launcher/autorandr_launcher ${DESTDIR}${PREFIX}/bin/autorandr_launcher
+       gcc -Wall $(CFLAGS) contrib/autorandr_launcher/autorandr_launcher.c -o contrib/autorandr_launcher/autorandr-launcher $(LAUNCHER_FLAGS)
+       install -D -m 755 contrib/autorandr_launcher/autorandr-launcher ${DESTDIR}${PREFIX}/bin/autorandr-launcher
+
+       install -D -m 644 contrib/etc/xdg/autostart/autorandr-launcher.desktop ${DESTDIR}/${XDG_AUTOSTART_DIR}/autorandr-launcher.desktop
+ifneq ($(PREFIX),/usr/)
+       sed -i -re 's#/usr/bin/autorandr-launcher#$(subst #,\#,${PREFIX})/bin/autorandr-launcher#g' ${DESTDIR}/${XDG_AUTOSTART_DIR}/autorandr-launcher.desktop
+endif
 
 uninstall_launcher:
-       rm -f ${DESTDIR}${PREFIX}/bin/autorandr_launcher
+       rm -f ${DESTDIR}${PREFIX}/bin/autorandr-launcher
+       rm -f ${DESTDIR}/${XDG_AUTOSTART_DIR}/autorandr-launcher.desktop
 
 TARGETS=$(DEFAULT_TARGETS)
 install: $(patsubst %,install_%,$(TARGETS))
@@ -151,3 +162,7 @@ uninstall: $(patsubst %,uninstall_%,$(TARGETS))
 
 deb:
        ./contrib/packaging/debian/make_deb.sh
+
+rpm:
+       spectool -g -R $(RPM_SPEC)
+       rpmbuild -ba $(RPM_SPEC)