Skip to content

Commit

Permalink
Support staged installations
Browse files Browse the repository at this point in the history
  • Loading branch information
Hendrikto committed Dec 30, 2017
1 parent 0cac449 commit 9a0bb63
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ CFLAGS += -Wall -Wextra -O3 -march=native
prefix = /usr/local
backlight_dir = /sys/class/backlight/intel_backlight/
max_brightness = $(shell cat $(backlight_dir)max_brightness)
backlight_rule = $(USER) ALL=NOPASSWD: $(prefix)/bin/backlight_control
backlight_rule = ALL ALL=NOPASSWD: $(prefix)/bin/backlight_control

DEFINES += -D BACKLIGHT_DIR=\"$(backlight_dir)\"
DEFINES += -D MAX_BRIGHTNESS=$(max_brightness)

all: install
all: backlight_control

%: %.c
$(CC) $(CFLAGS) $(DEFINES) $< -o $@
Expand All @@ -18,9 +18,9 @@ clean:
rm -f backlight_control

install: backlight_control
echo $(backlight_rule) | sudo tee /etc/sudoers.d/backlight
sudo mv $< $(prefix)/bin
mv $< $(DESTDIR)$(prefix)/bin
tee $(DESTDIR)/etc/sudoers.d/backlight <<< "$(backlight_rule)"

uninstall:
sudo rm -f /etc/sudoers.d/backlight
sudo rm -f $(prefix)/bin/backlight_control
rm -f $(DESTDIR)$(prefix)/bin/backlight_control
rm -f $(DESTDIR)/etc/sudoers.d/backlight
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ I had some problems with `xbacklight` in combination with the proprietary nvidia

## Build
```sh
make backlight_control
make
```

## Install
```sh
make install
sudo make install
```

## Uninstall
```sh
make uninstall
sudo make uninstall
```

## Usage
Expand Down

0 comments on commit 9a0bb63

Please sign in to comment.