tabbed

Fork of suckless' tabbed with my personal patches
git clone https://git.instinctive.eu/tabbed.git
Log | Files | Refs | README | LICENSE

commit deda1bb016b035f4387a09df8d81c1fc14eaf189
parent 13f13ee5827f082babb121f74ae23548bdd12dd8
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Fri, 14 Oct 2022 19:18:10 +0200

Makefile improvements

* Respect system cflags, ldflags, packages can override them all with
  TABBED_{CFLAGS,LDFLAGS}. Remove -Wall and -Os and -s.
* Install README as documentation.
* dist: stream directly to a gzipped tarball.
* options: remove it.
* Add ".POSIX:"
* Remove config.mk

Diffstat:
MMakefile | 73+++++++++++++++++++++++++++++++++++++++++++------------------------------
Mconfig.mk | 27++++++---------------------
2 files changed, 49 insertions(+), 51 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,56 +1,69 @@ -# tabbed - tabbing interface -# See LICENSE file for copyright and license details. +.POSIX: -include config.mk +NAME = tabbed +VERSION = 0.7 + +# paths +PREFIX = /usr/local +MANPREFIX = ${PREFIX}/share/man +DOCPREFIX = ${PREFIX}/share/doc/${NAME} + +# use system flags. +TABBED_CFLAGS = -I/usr/X11R6/include -I/usr/include/freetype2 ${CFLAGS} +TABBED_LDFLAGS = -L/usr/X11R6/lib -lX11 -lfontconfig -lXft ${LDFLAGS} +TABBED_CPPFLAGS = -DVERSION=\"${VERSION}\" -D_DEFAULT_SOURCE + +# OpenBSD (uncomment) +#TABBED_CFLAGS = -I/usr/X11R6/include -I/usr/X11R6/include/freetype2 ${CPPFLAGS} SRC = tabbed.c xembed.c OBJ = ${SRC:.c=.o} BIN = ${OBJ:.o=} +MAN1 = ${BIN:=.1} +HDR = arg.h config.def.h +DOC = LICENSE README -all: options ${BIN} - -options: - @echo tabbed build options: - @echo "CFLAGS = ${CFLAGS}" - @echo "LDFLAGS = ${LDFLAGS}" - @echo "CC = ${CC}" +all: ${BIN} .c.o: - ${CC} -c ${CFLAGS} $< + ${CC} -o $@ -c $< ${TABBED_CFLAGS} ${TABBED_CPPFLAGS} -${OBJ}: config.h config.mk +${OBJ}: config.h config.h: cp config.def.h $@ .o: - ${CC} -o $@ $< ${LDFLAGS} + ${CC} -o $@ $< ${TABBED_LDFLAGS} clean: - rm -f ${BIN} ${OBJ} tabbed-${VERSION}.tar.gz + rm -f ${BIN} ${OBJ} "${NAME}-${VERSION}.tar.gz" dist: clean - mkdir -p tabbed-${VERSION} - cp -R LICENSE Makefile README config.def.h config.mk \ - tabbed.1 xembed.1 arg.h ${SRC} tabbed-${VERSION} - tar -cf tabbed-${VERSION}.tar tabbed-${VERSION} - gzip tabbed-${VERSION}.tar - rm -rf tabbed-${VERSION} + mkdir -p "${NAME}-${VERSION}" + cp -fR Makefile ${MAN1} ${DOC} ${HDR} ${SRC} "${NAME}-${VERSION}" + tar -cf - "${NAME}-${VERSION}" | gzip -c > "${NAME}-${VERSION}.tar.gz" + rm -rf ${NAME}-${VERSION} install: all + # installing executable files. mkdir -p "${DESTDIR}${PREFIX}/bin" cp -f ${BIN} "${DESTDIR}${PREFIX}/bin" - chmod 755 "${DESTDIR}${PREFIX}/bin/tabbed" + for f in ${BIN}; do chmod 755 "${DESTDIR}${PREFIX}/bin/$$f"; done + # installing doc files. + mkdir -p "${DESTDIR}${DOCPREFIX}" + cp -f README "${DESTDIR}${DOCPREFIX}" + # installing manual pages for general commands: section 1. mkdir -p "${DESTDIR}${MANPREFIX}/man1" - sed "s/VERSION/${VERSION}/g" < tabbed.1 > "${DESTDIR}${MANPREFIX}/man1/tabbed.1" - chmod 644 "${DESTDIR}${MANPREFIX}/man1/tabbed.1" - sed "s/VERSION/${VERSION}/g" < xembed.1 > "${DESTDIR}${MANPREFIX}/man1/xembed.1" - chmod 644 "${DESTDIR}${MANPREFIX}/man1/xembed.1" + for m in ${MAN1}; do sed "s/VERSION/${VERSION}/g" < $$m > "${DESTDIR}${MANPREFIX}/man1/$$m"; done uninstall: - rm -f "${DESTDIR}${PREFIX}/bin/tabbed"\ - "${DESTDIR}${PREFIX}/bin/xembed"\ - "${DESTDIR}${MANPREFIX}/man1/tabbed.1"\ - "${DESTDIR}${MANPREFIX}/man1/xembed.1" + # removing executable files. + for f in ${BIN}; do rm -f "${DESTDIR}${PREFIX}/bin/$$f"; done + # removing doc files. + rm -f "${DESTDIR}${DOCPREFIX}/README" + # removing manual pages. + for m in ${MAN1}; do rm -f "${DESTDIR}${MANPREFIX}/man1/$$m"; done + -rmdir "${DESTDIR}${DOCPREFIX}" -.PHONY: all options clean dist install uninstall +.PHONY: all clean dist install uninstall diff --git a/config.mk b/config.mk @@ -1,27 +1,12 @@ -# tabbed version -VERSION = 0.7 - # paths PREFIX = /usr/local MANPREFIX = ${PREFIX}/share/man +DOCPREFIX = ${PREFIX}/share/doc/${NAME} -X11INC = /usr/X11R6/include -X11LIB = /usr/X11R6/lib +# use system flags. +TABBED_CFLAGS = -I/usr/X11R6/include -I/usr/include/freetype2 ${CPPFLAGS} +TABBED_LDFLAGS = -L/usr/X11R6/lib -lX11 /usr/X11R6/lib ${LDFLAGS} +TABBED_CPPFLAGS = -DVERSION=\"${VERSION}\" -D_DEFAULT_SOURCE -# freetype -FREETYPELIBS = -lfontconfig -lXft -FREETYPEINC = /usr/include/freetype2 # OpenBSD (uncomment) -#FREETYPEINC = ${X11INC}/freetype2 - -# includes and libs -INCS = -I. -I/usr/include -I$(X11INC) -I${FREETYPEINC} -LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 ${FREETYPELIBS} - -# flags -CPPFLAGS = -DVERSION=\"${VERSION}\" -D_DEFAULT_SOURCE -CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS} -LDFLAGS = -s ${LIBS} - -# compiler and linker -CC = cc +#TABBED_CFLAGS = -I/usr/X11R6/include -I/usr/X11R6/include/freetype2 ${CPPFLAGS}