cleanup Makefile, add initial man page svkbd.1

This commit is contained in:
Hiltjo Posthuma 2020-05-29 14:24:17 +02:00
parent fc267005ce
commit 1c75314faf
5 changed files with 99 additions and 79 deletions

View File

@ -1,73 +1,68 @@
# svkbd - simple virtual keyboard # svkbd - simple virtual keyboard
# See LICENSE file for copyright and license details. # See LICENSE file for copyright and license details.
.POSIX:
NAME = svkbd
VERSION = 0.1
include config.mk include config.mk
SRC = svkbd.c BIN = ${NAME}-${LAYOUT}
SRC = ${NAME}.c
OBJ = ${NAME}-${LAYOUT}.o
MAN1 = ${NAME}.1
all: options svkbd-${LAYOUT} all: ${BIN}
options: options:
@echo svkbd build options: @echo svkbd build options:
@echo "CFLAGS = ${CFLAGS}" @echo "CFLAGS = ${SVKBD_CFLAGS}"
@echo "LDFLAGS = ${LDFLAGS}" @echo "CPPLAGS = ${SVKBD_CPPFLAGS}"
@echo "LDFLAGS = ${SVKBD_LDFLAGS}"
@echo "CC = ${CC}" @echo "CC = ${CC}"
config.h: config.mk config.h:
@echo creating $@ from config.def.h cp config.def.h $@
@cp config.def.h $@
svkbd-%: layout.%.h config.h ${SRC} ${BIN}: config.h ${OBJ}
@echo creating layout.h from $<
@cp $< layout.h ${OBJ}: config.h
@echo CC -o $@
@${CC} -o $@ ${SRC} ${LDFLAGS} ${CFLAGS} ${OBJ}:
${CC} -o $@ -c ${SRC} ${SVKBD_CFLAGS} ${SVKBD_CPPFLAGS}
${BIN}:
${CC} -o ${BIN} ${OBJ} ${SVKBD_LDFLAGS}
clean: clean:
@echo cleaning rm -f ${NAME}-?? ${NAME}-??.o ${OBJ}
@for i in svkbd-*; \
do \
if [ -x $$i ]; \
then \
rm -f $$i 2> /dev/null; \
fi \
done; true
@rm -f ${OBJ} svkbd-${VERSION}.tar.gz 2> /dev/null; true
dist: clean dist:
@echo creating dist tarball rm -rf "${NAME}-${VERSION}"
@mkdir -p svkbd-${VERSION} mkdir -p "${NAME}-${VERSION}"
@cp LICENSE Makefile README config.def.h config.mk \ cp LICENSE Makefile README config.def.h config.mk ${MAN1} \
${SRC} svkbd-${VERSION} ${SRC} ${NAME}-${VERSION}
@for i in layout.*.h; \ for i in layout.*.h; \
do \ do \
cp $$i svkbd-${VERSION}; \ cp $$i ${NAME}-${VERSION}; \
done done
@tar -cf svkbd-${VERSION}.tar svkbd-${VERSION} tar -cf - "${NAME}-${VERSION}" | \
@gzip svkbd-${VERSION}.tar gzip -c > "${NAME}-${VERSION}.tar.gz"
@rm -rf svkbd-${VERSION} rm -rf "${NAME}-${VERSION}"
install: all install: all
@echo installing executable files to ${DESTDIR}${PREFIX}/bin mkdir -p ${DESTDIR}${PREFIX}/bin
@mkdir -p ${DESTDIR}${PREFIX}/bin for i in ${NAME}-??; \
@for i in svkbd-*; \
do \ do \
if [ -x $$i ]; \ cp $$i ${DESTDIR}${PREFIX}/bin; \
then \ chmod 755 ${DESTDIR}${PREFIX}/bin/$$i; \
echo CP $$i; \
cp $$i ${DESTDIR}${PREFIX}/bin; \
chmod 755 ${DESTDIR}${PREFIX}/bin/$$i; \
fi \
done done
# @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1 mkdir -p "${DESTDIR}${MANPREFIX}/man1"
# @mkdir -p ${DESTDIR}${MANPREFIX}/man1 sed "s/VERSION/${VERSION}/g" < ${MAN1} > ${DESTDIR}${MANPREFIX}/man1/${MAN1}
# @sed "s/VERSION/${VERSION}/g" < svkbd.1 > ${DESTDIR}${MANPREFIX}/man1/svkbd.1 chmod 644 ${DESTDIR}${MANPREFIX}/man1/${MAN1}
# @chmod 644 ${DESTDIR}${MANPREFIX}/man1/svkbd.1
uninstall: uninstall:
@echo removing executable files from ${DESTDIR}${PREFIX}/bin rm -f ${DESTDIR}${PREFIX}/bin/${NAME}-??
@rm -f ${DESTDIR}${PREFIX}/bin/svkbd-* rm -f ${DESTDIR}${MANPREFIX}/man1/${MAN1}
# @echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
# @rm -f ${DESTDIR}${MANPREFIX}/man1/svkbd.1
.PHONY: all options clean dist install uninstall .PHONY: all clean dist install uninstall

View File

@ -6,13 +6,13 @@ where no keyboard is available.
Installation Installation
------------ ------------
% make $ make
% make install $ make install
This will create by default `svkbd-en`, which is svkbd using an English This will create by default `svkbd-en`, which is svkbd using an English
keyboard layout. You can create svkbd for additional layouts by doing: keyboard layout. You can create svkbd for additional layouts by doing:
% make svkbd-$layout $ make LAYOUT=$layout
This will take the file `layout.$layout.h` and create `svkbd-$layout`. This will take the file `layout.$layout.h` and create `svkbd-$layout`.
`make install` will then pick up the new file and install it accordingly. `make install` will then pick up the new file and install it accordingly.
@ -20,19 +20,19 @@ This will take the file `layout.$layout.h` and create `svkbd-$layout`.
Usage Usage
----- -----
% svkbd-en $ svkbd-en
This will open svkbd at the bottom of the screen, showing the default This will open svkbd at the bottom of the screen, showing the default
English layout. English layout.
% svkbd-en -d $ svkbd-en -d
This tells svkbd-en to announce itself being a dock window, which then This tells svkbd-en to announce itself being a dock window, which then
is managed differently between different window managers. If using dwm is managed differently between different window managers. If using dwm
and the dock patch, then this will make svkbd being managed by dwm and and the dock patch, then this will make svkbd being managed by dwm and
some space of the screen being reserved for it. some space of the screen being reserved for it.
% svkbd-en -g 400x200+1+1 $ svkbd-en -g 400x200+1+1
This will start svkbd-en with a size of 400x200 and at the upper left This will start svkbd-en with a size of 400x200 and at the upper left
window corner. window corner.
@ -40,5 +40,5 @@ window corner.
Repository Repository
---------- ----------
git clone http://git.suckless.org/svkbd git clone https://git.suckless.org/svkbd

View File

@ -1,31 +1,17 @@
# svkbd version LAYOUT = en
VERSION = 0.1
LAYOUT ?= en
# Customize below to fit your system
# paths # paths
PREFIX ?= /usr/local PREFIX = /usr/local
MANPREFIX = ${PREFIX}/share/man MANPREFIX = ${PREFIX}/share/man
X11INC = /usr/X11R6/include X11INC = /usr/X11R6/include
X11LIB = /usr/X11R6/lib X11LIB = /usr/X11R6/lib
# includes and libs # includes and libs
INCS = -I. -I./layouts -I/usr/include -I${X11INC} INCS = -I. -I./layouts -I${X11INC}
LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 -lXtst LIBS = -L${X11LIB} -lX11 -lXtst
# flags
CPPFLAGS = -DVERSION=\"${VERSION}\" \
${XINERAMAFLAGS}
CFLAGS = -g -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS}
LDFLAGS = -g ${LIBS}
# Solaris
#CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\"
#LDFLAGS = ${LIBS}
# compiler and linker
CC = cc
# use system flags
SVKBD_CFLAGS = ${CFLAGS}
SVKBD_LDFLAGS = ${LDFLAGS} ${LIBS}
SVKBD_CPPFLAGS = ${CPPFLAGS} ${INCS} -DVERSION=\"VERSION\" -DLAYOUT=\"layout.${LAYOUT}.h\"

36
svkbd.1 Normal file
View File

@ -0,0 +1,36 @@
.Dd May 29, 2020
.Dt SVKBD 1
.Os
.Sh NAME
.Nm svkbd
.Nd simple virtual keyboard
.Sh SYNOPSIS
.Nm
.Op Fl d
.Op Fl g Ar geometry
.Op Fl h
.Op Fl v
.Sh DESCRIPTION
.Nm
is a simple virtual keyboard, intended to be used in environments, where no
keyboard is available.
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl d
Set the _NET_WM_WINDOW_TYPE_DOCK property to hint windowmanagers it is
dockable, by default off.
.It Fl g Ar geometry
Adjust the initial window position or size as specified by the standard X11
geometry format.
.It Fl h
Show the usage information.
.It Fl v
Show the version information.
.El
.Sh SEE ALSO
.Xr XParseGeometry 3
.Sh AUTHORS
.An Christoph Lohmann Aq Mt 20h@r-36.net
and
.An Enno Boland Aq Mt gottox@s01.de

View File

@ -101,7 +101,10 @@ Bool ispressing = False;
/* configuration, allows nested code to access above variables */ /* configuration, allows nested code to access above variables */
#include "config.h" #include "config.h"
#include "layout.h" #ifndef LAYOUT
#error "make sure to define LAYOUT"
#endif
#include LAYOUT
void void
motionnotify(XEvent *e) motionnotify(XEvent *e)