You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
942 B
Makefile

#!/usr/bin/make -f
TAG_COMMIT := $(shell git rev-list --abbrev-commit --tags --max-count=1)
TAG := $(shell git describe --abbrev=0 --tags ${TAG_COMMIT} 2>/dev/null || true)
COMMIT := $(shell git rev-parse --short HEAD)
DATE := $(shell git log -1 --format=%cd --date=format:"%Y%m%d")
VERSION := $(TAG:v%=%)
ifeq ($(VERSION),)
VERSION := $(COMMIT)-$(DATE)
else
ifneq ($(COMMIT), $(TAG_COMMIT))
VERSION := $(VERSION)-next-$(COMMIT)-$(DATE)
endif
endif
ifneq ($(shell git status --porcelain),)
VERSION := $(VERSION)-dirty
endif
%:
dh $@ --builddirectory=_build --buildsystem=golang --with=golang
override_dh_auto_build:
dh_auto_build -- -ldflags '-w -s -X github.com/webmeisterei/lql-api/version.Version=${VERSION}'
override_dh_auto_install:
dh_auto_install -- --no-source
override_dh_installinit:
dh_installinit --noscripts
override_dh_auto_install:
dh_auto_install -- --no-source
dh_installsystemd --no-start -- lql-api@.service