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
# See LICENSE file for copyright and license details.
.POSIX:
NAME = svkbd
VERSION = 0.1
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:
@echo svkbd build options:
@echo "CFLAGS = ${CFLAGS}"
@echo "LDFLAGS = ${LDFLAGS}"
@echo "CFLAGS = ${SVKBD_CFLAGS}"
@echo "CPPLAGS = ${SVKBD_CPPFLAGS}"
@echo "LDFLAGS = ${SVKBD_LDFLAGS}"
@echo "CC = ${CC}"
config.h: config.mk
@echo creating $@ from config.def.h
@cp config.def.h $@
config.h:
cp config.def.h $@
svkbd-%: layout.%.h config.h ${SRC}
@echo creating layout.h from $<
@cp $< layout.h
@echo CC -o $@
@${CC} -o $@ ${SRC} ${LDFLAGS} ${CFLAGS}
${BIN}: config.h ${OBJ}
${OBJ}: config.h
${OBJ}:
${CC} -o $@ -c ${SRC} ${SVKBD_CFLAGS} ${SVKBD_CPPFLAGS}
${BIN}:
${CC} -o ${BIN} ${OBJ} ${SVKBD_LDFLAGS}
clean:
@echo cleaning
@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
rm -f ${NAME}-?? ${NAME}-??.o ${OBJ}
dist: clean
@echo creating dist tarball
@mkdir -p svkbd-${VERSION}
@cp LICENSE Makefile README config.def.h config.mk \
${SRC} svkbd-${VERSION}
@for i in layout.*.h; \
dist:
rm -rf "${NAME}-${VERSION}"
mkdir -p "${NAME}-${VERSION}"
cp LICENSE Makefile README config.def.h config.mk ${MAN1} \
${SRC} ${NAME}-${VERSION}
for i in layout.*.h; \
do \
cp $$i svkbd-${VERSION}; \
cp $$i ${NAME}-${VERSION}; \
done
@tar -cf svkbd-${VERSION}.tar svkbd-${VERSION}
@gzip svkbd-${VERSION}.tar
@rm -rf svkbd-${VERSION}
tar -cf - "${NAME}-${VERSION}" | \
gzip -c > "${NAME}-${VERSION}.tar.gz"
rm -rf "${NAME}-${VERSION}"
install: all
@echo installing executable files to ${DESTDIR}${PREFIX}/bin
@mkdir -p ${DESTDIR}${PREFIX}/bin
@for i in svkbd-*; \
mkdir -p ${DESTDIR}${PREFIX}/bin
for i in ${NAME}-??; \
do \
if [ -x $$i ]; \
then \
echo CP $$i; \
cp $$i ${DESTDIR}${PREFIX}/bin; \
chmod 755 ${DESTDIR}${PREFIX}/bin/$$i; \
fi \
cp $$i ${DESTDIR}${PREFIX}/bin; \
chmod 755 ${DESTDIR}${PREFIX}/bin/$$i; \
done
# @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1
# @mkdir -p ${DESTDIR}${MANPREFIX}/man1
# @sed "s/VERSION/${VERSION}/g" < svkbd.1 > ${DESTDIR}${MANPREFIX}/man1/svkbd.1
# @chmod 644 ${DESTDIR}${MANPREFIX}/man1/svkbd.1
mkdir -p "${DESTDIR}${MANPREFIX}/man1"
sed "s/VERSION/${VERSION}/g" < ${MAN1} > ${DESTDIR}${MANPREFIX}/man1/${MAN1}
chmod 644 ${DESTDIR}${MANPREFIX}/man1/${MAN1}
uninstall:
@echo removing executable files from ${DESTDIR}${PREFIX}/bin
@rm -f ${DESTDIR}${PREFIX}/bin/svkbd-*
# @echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
# @rm -f ${DESTDIR}${MANPREFIX}/man1/svkbd.1
rm -f ${DESTDIR}${PREFIX}/bin/${NAME}-??
rm -f ${DESTDIR}${MANPREFIX}/man1/${MAN1}
.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
------------
% make
% make install
$ make
$ make install
This will create by default `svkbd-en`, which is svkbd using an English
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`.
`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
-----
% svkbd-en
$ svkbd-en
This will open svkbd at the bottom of the screen, showing the default
English layout.
% svkbd-en -d
$ svkbd-en -d
This tells svkbd-en to announce itself being a dock window, which then
is managed differently between different window managers. If using dwm
and the dock patch, then this will make svkbd being managed by dwm and
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
window corner.
@ -40,5 +40,5 @@ window corner.
Repository
----------
git clone http://git.suckless.org/svkbd
git clone https://git.suckless.org/svkbd

View File

@ -1,31 +1,17 @@
# svkbd version
VERSION = 0.1
LAYOUT ?= en
# Customize below to fit your system
LAYOUT = en
# paths
PREFIX ?= /usr/local
PREFIX = /usr/local
MANPREFIX = ${PREFIX}/share/man
X11INC = /usr/X11R6/include
X11LIB = /usr/X11R6/lib
# includes and libs
INCS = -I. -I./layouts -I/usr/include -I${X11INC}
LIBS = -L/usr/lib -lc -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
INCS = -I. -I./layouts -I${X11INC}
LIBS = -L${X11LIB} -lX11 -lXtst
# 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 */
#include "config.h"
#include "layout.h"
#ifndef LAYOUT
#error "make sure to define LAYOUT"
#endif
#include LAYOUT
void
motionnotify(XEvent *e)