opendoas

A portable version of the OpenBSD `doas` command
git clone https://pi.duncano.de/git/opendoas.git
Log | Files | Refs | README | LICENSE

commit fc0380731a8b1b1e02e2319f2f992b1973526b45
parent 24c8d75c7bdf3d67cbe6167b74fc5151f6d4807b
Author: Nathan Holstein <nathan.holstein@gmail.com>
Date:   Sun,  9 Aug 2015 17:52:39 -0400

Generate a version header file from Git.

This adds a rule to create the version.h file from the Git version. This
enables automatically embedding the Git version information into the
executable.

Diffstat:
.gitignore | 2++
bsd.prog.mk | 8++++++++
2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -1,5 +1,7 @@ doas +version.h + *.a *.o diff --git a/bsd.prog.mk b/bsd.prog.mk @@ -30,12 +30,20 @@ ${BINDIR}: ${BINDIR}/${PROG}: .${PROG}.chmod ${BINDIR} mv $< $@ +VERSION:=\#define VERSION "$(shell git describe --dirty --tags --long --always)" +OLDVERSION:=$(shell [ -f version.h ] && cat version.h) +version.h: ; @echo '$(VERSION)' > $@ +ifneq ($(VERSION),$(OLDVERSION)) +.PHONY: version.h +endif + MAN:=$(join $(addprefix ${MANDIR}/man,$(patsubst .%,%/,$(suffix ${MAN}))),${MAN}) $(foreach M,${MAN},$(eval $M: $(notdir $M); cp $$< $$@)) install: ${BINDIR}/${PROG} ${MAN} clean: + rm -f version.h rm -f libopenbsd.a rm -f ${OPENBSD} rm -f ${OBJS}