~kaction/dvtm

83c6d1496a05dad62d12100cdfc5bfc22a5dac16 — Dmitry Bogatov 7 months ago d55678d
Makefile: fix variable substitution syntax

Makefile uses $(VAR) syntax, but exports some variables into subshell,
so ${VAR}, which is substituted by /bin/sh ocassionally works too.
2 files changed, 26 insertions(+), 26 deletions(-)

M Makefile
M config.mk
M Makefile => Makefile +23 -23
@@ 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-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,30 @@ clean:

dist: clean
	@echo creating dist tarball
	@git archive --prefix=dvtm-${VERSION}/ -o dvtm-${VERSION}.tar.gz HEAD
	@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"; \
	@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"; \
	@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
	@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

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