Add makefile

This commit is contained in:
2020-06-20 19:01:39 -07:00
parent d317e63a00
commit 92bbccfd0f

29
Makefile Normal file
View File

@@ -0,0 +1,29 @@
.PHONY: help test
PROJECT := Bg
VERSION := 0.0.1
GIT_REPO := ssh://git@git.famcosi.duckdns.org:222/gcordova/go-do.git
GIT_REF := $(shell git symbolic-ref --short HEAD)
GIT_HASH := $(shell git rev-parse --short HEAD)
help:
@echo "Project: $(PROJECT) v$(VERSION)"
@echo "Repository: $(GIT_REPO)"
@echo "Branch: $(GIT_REF) [$(GIT_HASH)]"
@echo ""
@echo "Usage:"
@echo " make [help] - Display this message"
@echo " make test - Run unit tests"
test: $(patsubst %.test,%.stdout,$(call rwildcard,,%.test))
rwildcard = $(foreach d,$(wildcard $1*),$(call rwildcard,$d/$2) $(filter $2,$d))
%.stdout: %.test
./$< > $@ 2> $(patsubst %.stdout,%.stderr,%@) \
|| (touch --date=@0 $@; false)
git diff --exit-code --src-prefix=expected/ --dst-prefix=actual/ $@ $(patsubst %.stdout,%.stderr,$@) \
|| (touch --date=@0 $@; false)
# vim: ai noet ts=8 sw=8: