aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-09-16 16:05:05 +0200
committerMattias Andrée <maandree@kth.se>2021-09-16 16:05:05 +0200
commit744f1b4d36f1671c03f63820246746a5b52f24be (patch)
treefc5c86167c63d1771add281ac77a7ad8f588f206 /Makefile
parentUpdate man page (diff)
downloadadjbacklight-ae393f80c10e0784dbe9768043b814d89aaba5c9.tar.gz
adjbacklight-ae393f80c10e0784dbe9768043b814d89aaba5c9.tar.bz2
adjbacklight-ae393f80c10e0784dbe9768043b814d89aaba5c9.tar.xz
Improve makefile and fix warnings8.2.1
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'Makefile')
-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