Makefile (632B)
1 CC = gcc 2 CFLAGS += -Wall -Wextra -O3 -march=native 3 4 prefix = /usr/local 5 backlight_dir = /sys/class/backlight 6 vendor_backlight_dir = $(backlight_dir)/$(shell ls $(backlight_dir) | head -n1) 7 max_brightness = $(shell cat $(vendor_backlight_dir)/max_brightness) 8 9 DEFINES += -D BRIGHTNESS_FILE=\"$(vendor_backlight_dir)/brightness\" 10 DEFINES += -D MAX_BRIGHTNESS=$(max_brightness) 11 12 all: backlight-control 13 14 %: %.c 15 $(CC) $(CFLAGS) $(DEFINES) $< -o $@ 16 17 clean: 18 rm -f backlight-control 19 20 install: backlight-control 21 install -D -m 4755 -o root -g root $< $(DESTDIR)$(prefix)/bin/$< 22 23 uninstall: 24 rm -f $(DESTDIR)$(prefix)/bin/backlight-control