aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2023-07-02 09:09:58 +0200
committerMattias Andrée <maandree@kth.se>2023-07-02 09:09:58 +0200
commit2ab5473fc48d91ecce1f11c49e5decdcf821e3d4 (patch)
tree990bb8866d207f8ba7626e7574a323fbadf9c6d0 /Makefile
parentAdd documentation to config.h (diff)
downloadxkbdbind-2ab5473fc48d91ecce1f11c49e5decdcf821e3d4.tar.gz
xkbdbind-2ab5473fc48d91ecce1f11c49e5decdcf821e3d4.tar.bz2
xkbdbind-2ab5473fc48d91ecce1f11c49e5decdcf821e3d4.tar.xz
Improve makefile and add man page1.2
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile34
1 files changed, 28 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 6eb1f43..018f97c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,17 +1,39 @@
.POSIX:
-CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700
-CFLAGS = -std=c99 -Wall -Wextra -pedantic -O2 $(CPPFLAGS)
-LDFLAGS = -s -lxcb -lxcb-keysyms
+OBJ = xkbdbind.o
+HDR = config.h
+
+CONFIGFILE = config.mk
+include $(CONFIGFILE)
all: xkbdbind
+$(OBJ): $(HDR)
+
+xkbdbind: $(OBJ) $(HDR)
+ $(CC) -o $@ $(OBJ) $(LDFLAGS)
+
+.c.o:
+ $(CC) -c -o $@ $< $(CFLAGS)
+
+install: xkbdbind
+ mkdir -p -- "$(DESTDIR)$(PREFIX)/bin"
+ mkdir -p -- "$(DESTDIR)$(PREFIX)/src/$(PACKAGE)"
+ mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man1"
+ cp -- xkbdbind "$(DESTDIR)$(PREFIX)/bin/"
+ cp -- $(OBJ:.o=.c) $(HDR) Makefile "$(DESTDIR)$(PREFIX)/src/$(PACKAGE)/"
+ test ! -e -- "$(DESTDIR)$(PREFIX)/src/$(PACKAGE)/config.mk"
+ cp -- $(CONFIGFILE) "$(DESTDIR)$(PREFIX)/src/$(PACKAGE)/config.mk"
+ cp -- xkbdbind.1 "$(DESTDIR)$(MANPREFIX)/man1/"
-xkbdbind: xkbdbind.c config.h
- $(CC) -o $@ $@.c $(CFLAGS) $(LDFLAGS)
+uninstall:
+ -rm -f -- "$(DESTDIR)$(PREFIX)/bin/xkbdbind"
+ -rm -rf -- "$(DESTDIR)$(PREFIX)/src/$(PACKAGE)"
+ -rm -f -- "$(DESTDIR)$(MANPREFIX)/man1/xkbdbind.1"
clean:
-rm -f -- xkbdbind *.o
.SUFFIXES:
+.SUFFIXES: .c .o
-.PHONY: all clean
+.PHONY: all install uninstall clean