~kaction/dvtm

b68409018d4d466f00363800f88daf32b8a221b9 — Dmitry Bogatov 2 months ago 68d08a5 + 1bbc027
Merge branch 'next'

# By Dmitry Bogatov (2) and Ariadna Vigo (1)
* next:
  Decoupled installation of terminfo profile from 'make install' target
  Revert "Ensure compatibility with v0.15 config"
  Revert "Makefile: fix variable substitution syntax"
4 files changed, 36 insertions(+), 49 deletions(-)

M Makefile
M config.def.h
M config.mk
M dvtm.c
M Makefile => Makefile +32 -26
@@ 5,8 5,8 @@ BIN = dvtm dvtm-status dvtm-editor dvtm-pager
MANUALS = dvtm.1 dvtm-editor.1 dvtm-pager.1

VERSION = $(shell git describe --always --dirty 2>/dev/null || echo "0.15.1-git")
CFLAGS += -DVERSION=\"$(VERSION)\"
DEBUG_CFLAGS = $(CFLAGS) -UNDEBUG -O0 -g -ggdb -Wall -Wextra -Wno-unused-parameter
CFLAGS += -DVERSION=\"${VERSION}\"
DEBUG_CFLAGS = ${CFLAGS} -UNDEBUG -O0 -g -ggdb -Wall -Wextra -Wno-unused-parameter

all: dvtm dvtm-editor



@@ 14,19 14,19 @@ config.h:
	cp config.def.h config.h

dvtm: config.h config.mk *.c *.h
	$(CC) $(CFLAGS) $(SRC) $(LDFLAGS) $(LIBS) -o $@
	${CC} ${CFLAGS} ${SRC} ${LDFLAGS} ${LIBS} -o $@

dvtm-editor: dvtm-editor.c
	$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
	${CC} ${CFLAGS} $^ ${LDFLAGS} -o $@

man:
	@for m in $(MANUALS); do \
	@for m in ${MANUALS}; do \
		echo "Generating $$m"; \
		sed -e "s/VERSION/${VERSION}/" "$$m" | mandoc -W warning -T utf8 -T xhtml -O man=%N.%S.html -O style=mandoc.css 1> "$$m.html" || true; \
	done

debug: clean
	@$(MAKE) CFLAGS='$(DEBUG_CFLAGS)'
	@$(MAKE) CFLAGS='${DEBUG_CFLAGS}'

clean:
	@echo cleaning


@@ 35,30 35,36 @@ clean:

dist: clean
	@echo creating dist tarball
	@git archive --prefix=dvtm-$(VERSION)/ -o dvtm-$(VERSION).tar.gz HEAD

install: all
	@mkdir -p $(DESTDIR)$(PREFIX)/bin
	@for b in $(BIN); do \
		echo "installing $(DESTDIR)$(PREFIX)/bin/$$b"; \
		cp -f "$$b" "$(DESTDIR)$(PREFIX)/bin" && \
		chmod 755 "$(DESTDIR)$(PREFIX)/bin/$$b"; \
	@git archive --prefix=dvtm-${VERSION}/ -o dvtm-${VERSION}.tar.gz HEAD

install: install-binary install-man install-terminfo

install-binary: all
	@mkdir -p ${DESTDIR}${PREFIX}/bin
	@for b in ${BIN}; do \
		echo "installing ${DESTDIR}${PREFIX}/bin/$$b"; \
		cp -f "$$b" "${DESTDIR}${PREFIX}/bin" && \
		chmod 755 "${DESTDIR}${PREFIX}/bin/$$b"; \
	done
	@echo installing manual page to $(DESTDIR)$(MANPREFIX)/man1
	@mkdir -p $(DESTDIR)$(MANPREFIX)/man1
	@for m in $(MANUALS); do \
		sed -e "s/VERSION/$(VERSION)/" < "$$m" >  "$(DESTDIR)$(MANPREFIX)/man1/$$m" && \
		chmod 644 "$(DESTDIR)$(MANPREFIX)/man1/$$m"; \

install-man:
	@echo installing manual page to ${DESTDIR}${MANPREFIX}/man1
	@mkdir -p ${DESTDIR}${MANPREFIX}/man1
	@for m in ${MANUALS}; do \
		sed -e "s/VERSION/${VERSION}/" < "$$m" >  "${DESTDIR}${MANPREFIX}/man1/$$m" && \
		chmod 644 "${DESTDIR}${MANPREFIX}/man1/$$m"; \
	done

install-terminfo:
	@echo installing terminfo description
	@TERMINFO=$(TERMINFO) tic -s dvtm.info
	@TERMINFO=${TERMINFO} tic -s dvtm.info

uninstall:
	@for b in $(BIN); do \
		echo "removing $(DESTDIR)$(PREFIX)/bin/$$b"; \
		rm -f "$(DESTDIR)$(PREFIX)/bin/$$b"; \
	@for b in ${BIN}; do \
		echo "removing ${DESTDIR}${PREFIX}/bin/$$b"; \
		rm -f "${DESTDIR}${PREFIX}/bin/$$b"; \
	done
	@echo removing manual page from $(DESTDIR)$(MANPREFIX)/man1
	@rm -f $(DESTDIR)$(MANPREFIX)/man1/dvtm.1
	@echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
	@rm -f ${DESTDIR}${MANPREFIX}/man1/dvtm.1

.PHONY: all clean dist install uninstall debug
.PHONY: all clean dist install install-binary install-man install-terminfo uninstall debug

M config.def.h => config.def.h +0 -8
@@ 207,11 207,3 @@ static Action actions[] = {
static char const * const keytable[] = {
	/* add your custom key escape sequences */
};

/* Print dvtm's control sequence as it is typed in status bar, similar
 * to :showcmd in vim.
 *
 * Change 0 to 1 to enable.
 */
#define FEATURE_PRINT_KEYS
static const int config_print_keys = 0;

M config.mk => config.mk +3 -3
@@ 1,14 1,14 @@
# Customize below to fit your system

PREFIX ?= /usr/local
MANPREFIX = $(PREFIX)/share/man
MANPREFIX = ${PREFIX}/share/man
# specify your systems terminfo directory
# leave empty to install into your home folder
TERMINFO := $(DESTDIR)$(PREFIX)/share/terminfo
TERMINFO := ${DESTDIR}${PREFIX}/share/terminfo

INCS = -I.
LIBS = -lc -lutil -lncursesw
CPPFLAGS = -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -D_XOPEN_SOURCE_EXTENDED
CFLAGS += -std=c99 $(INCS) -DNDEBUG $(CPPFLAGS)
CFLAGS += -std=c99 ${INCS} -DNDEBUG ${CPPFLAGS}

CC ?= cc

M dvtm.c => dvtm.c +1 -12
@@ 46,17 46,6 @@ int ESCDELAY;
# define set_escdelay(d) (ESCDELAY = (d))
#endif

/*
 * This feature was introduced in 0.15.1, and this code makes sure that
 * it config file from 0.15 will continue compile as work as before.
 */

#ifndef FEATURE_PRINT_KEYS
static const int compat_print_keys = 0;
#else
static const int compat_print_keys = config_print_keys;
#endif

typedef struct {
	float mfact;
	unsigned int nmaster;


@@ 366,7 355,7 @@ drawbar(void) {
	addstr(layout->symbol);
	attrset(TAG_NORMAL);

	if (compat_print_keys && keys) {
	if (keys) {
		unsigned int keycount = 0;
		while (keycount < MAX_KEYS && keys[keycount]) {
			if (keys[keycount] < ' ')