aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Makefile23
1 files changed, 9 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index 8cbdd23..f7ac48a 100644
--- a/Makefile
+++ b/Makefile
@@ -3,19 +3,18 @@
CONFIGFILE = config.mk
include $(CONFIGFILE)
-all: adjbacklight test
+BIN = adjbacklight test
+OBJ = $(BIN:=.o)
-adjbacklight.o: adjbacklight.c arg.h
- $(CC) -c -o adjbacklight.o adjbacklight.c $(CCFLAGS) $(CPPFLAGS)
-adjbacklight: adjbacklight.o
- $(CC) -o adjbacklight adjbacklight.o $(LDFLAGS)
+all: adjbacklight test
+$(OBJ): arg.h
-test.o: test.c adjbacklight.c arg.h
- $(CC) -c -o test.o test.c $(CCFLAGS) $(CPPFLAGS)
+.c.o:
+ $(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS)
-test: test.o
- $(CC) -o test test.o $(LDFLAGS)
+.o:
+ $(CC) -o $@ $< $(LDFLAGS)
check: test
./test.sh
@@ -23,10 +22,8 @@ check: test
install: adjbacklight
mkdir -p -- "$(DESTDIR)$(PREFIX)/bin"
mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man1"
- mkdir -p -- "$(DESTDIR)$(PREFIX)/share/licenses/adjbacklight"
cp -- adjbacklight "$(DESTDIR)$(PREFIX)/bin"
cp -- adjbacklight.1 "$(DESTDIR)$(MANPREFIX)/man1"
- cp -- LICENSE "$(DESTDIR)$(PREFIX)/share/licenses/adjbacklight"
post-install:
chown -- '0:$(VIDEO_GROUP)' "$(DESTDIR)$(PREFIX)/bin/adjbacklight"
@@ -35,10 +32,8 @@ post-install:
uninstall:
-rm -- "$(DESTDIR)$(PREFIX)/bin/adjbacklight"
-rm -- "$(DESTDIR)$(MANPREFIX)/man1/adjbacklight.1"
- -rm -- "$(DESTDIR)$(PREFIX)/share/licenses/adjbacklight/LICENSE"
- -rmdir -- "$(DESTDIR)$(PREFIX)/share/licenses/adjbacklight"
clean:
- -rm -rf -- adjbacklight test *.o .testdir
+ -rm -rf -- adjbacklight test .testdir *.o *.su
.PHONY: all check install post-install uninstall clean