aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: c895ee7a06087c0ac3d6ea85093d7d1ce9b68a81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
VERSION = 0.4
CFLAGS += -std=c99 -g -Wall -Wextra -DVERSION=\"${VERSION}\" -D_POSIX_C_SOURCE=200809L
LDLIBS = -lm

PREFIX ?= /usr
BINDIR = ${DESTDIR}${PREFIX}/bin
MANDIR = ${DESTDIR}${PREFIX}/share/man

INSTALL_UDEV_RULES = 1

INSTALL_UDEV_1 = install_udev_rules
UDEVDIR ?= /lib/udev/rules.d

ifdef ENABLE_SYSTEMD
	CFLAGS += ${shell pkg-config --cflags libsystemd}
	LDLIBS += ${shell pkg-config --libs libsystemd}
	CPPFLAGS += -DENABLE_SYSTEMD
	INSTALL_UDEV_RULES=0
endif

MODE_0 = 4711
MODE_1 = 0755
MODE = ${MODE_${INSTALL_UDEV_RULES}}


all: brightnessctl brightnessctl.1

install: all ${INSTALL_UDEV_${INSTALL_UDEV_RULES}}
	install -d ${BINDIR} ${MANDIR}/man1
	install -m ${MODE} brightnessctl   ${BINDIR}/
	install -m 0644    brightnessctl.1 ${MANDIR}/man1

install_udev_rules:
	install -d ${DESTDIR}${UDEVDIR}
	install -m 0644 90-brightnessctl.rules ${DESTDIR}${UDEVDIR}

clean:
	rm -f brightnessctl

.PHONY: all install clean