From 2ab5473fc48d91ecce1f11c49e5decdcf821e3d4 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 2 Jul 2023 09:09:58 +0200 Subject: Improve makefile and add man page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- .gitignore | 9 ++++++++- LICENSE | 2 +- Makefile | 34 ++++++++++++++++++++++++++++------ README | 6 +++--- config.mk | 10 ++++++++++ xkbdbind.1 | 14 ++++++++++++++ 6 files changed, 64 insertions(+), 11 deletions(-) create mode 100644 config.mk create mode 100644 xkbdbind.1 diff --git a/.gitignore b/.gitignore index 66d9ded..069d7c5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,11 @@ +*\#* *~ -\#*\# *.o +*.a +*.lo +*.so +*.su +*.gcov +*.gcno +*.gcda /xkbdbind diff --git a/LICENSE b/LICENSE index 05839b1..91bd2c1 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ ISC License -© 2018, 2021 Mattias Andrée +© 2018, 2021, 2023 Mattias Andrée Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above 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 diff --git a/README b/README index 55a0bc3..bdbcfb7 100644 --- a/README +++ b/README @@ -12,9 +12,9 @@ DESCRIPTION config.h source file and recompiling the program. The user shall therefore have a local copy of the software, and a personal installation of it. Thus, xkbdbind is - not a program that is top be installed system-wide. + not a program that is to be installed system-wide. Download xkbdbind to ~/.local/src/xkbdbind, run make(1) in ~/.local/src/xkbdbind, link ~/.local/bin/xkbdbind to - ~/.local/src/xkbdbind/xkbdbind, and ~/.local/bin to the - PATH environment variable if you haven't already. + ~/.local/src/xkbdbind/xkbdbind, and add ~/.local/bin to + PATthe H environment variable if you haven't already. diff --git a/config.mk b/config.mk new file mode 100644 index 0000000..e8e1344 --- /dev/null +++ b/config.mk @@ -0,0 +1,10 @@ +PREFIX = /usr +MANPREFIX = $(PREFIX)/share/man + +PACKAGE = xkbdbind + +CC = c99 + +CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700 +CFLAGS = -Wall -O2 $(CPPFLAGS) +LDFLAGS = -lxcb -lxcb-keysyms diff --git a/xkbdbind.1 b/xkbdbind.1 new file mode 100644 index 0000000..1694789 --- /dev/null +++ b/xkbdbind.1 @@ -0,0 +1,14 @@ +.TH XKBDBIND 1 xkbdbind +.SH NAME +xkbdbind - global hotkeys for X +.SH SYNOPSIS +.B xkbdbind +.SH DESCRIPTION +.B xkbdbind +lets the user configure keybindings to start programs. +.PP +xkbdbind is a configured by the user by editing the +.I config.h +source file and recompiling the program. The user shall +therefore have a local copy of the software, and a personal +installation of it. -- cgit v1.2.3-70-g09d2