summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2026-11-02 02:34:41 +0100
committerDirk Engling <erdgeist@erdgeist.org>2026-11-02 02:34:41 +0100
commit8201a711afc5336242dacb21d880f36f7845f011 (patch)
tree3be28e18ba8826d6d7218fb2be72760f387f09b3 /Makefile
parentbe82b2aa821d0635e8a7d12792b02e9e56675aa2 (diff)
Ensure that the current version has a tag before allowing to roll a distribution tarball
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile9
1 files changed, 7 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 587af67..a665890 100644
--- a/Makefile
+++ b/Makefile
@@ -40,12 +40,15 @@ FEATURES+=-DWANT_FULLSCRAPE
40#FEATURES+=-D_DEBUG_RANDOMTORRENTS 40#FEATURES+=-D_DEBUG_RANDOMTORRENTS
41 41
42VERSION=1.0.0 42VERSION=1.0.0
43+GIT_VERSION=`sh -c 'test -r .tarball-version && read v < .tarball-version && echo "$$v" || { command -v git >/dev/null && test -d .git && git describe --tags --match "v*" --always --dirty 2>/dev/null; }'` 43TARBALL_VERSION=test -r .tarball-version && read v < .tarball-version && echo "$$v"
44HAVE_GIT=command -v git >/dev/null && test -d .git
45GIT_VERSION=`sh -c '$(TARBALL_VERSION) || { $(HAVE_GIT) && git describe --tags --match "v*" --always --dirty 2>/dev/null; }'`
46OT_TAG=`sh -c '$(TARBALL_VERSION) || { $(HAVE_GIT) && git describe --tags --match "v*" --exact-match 2>/dev/null; }'`
44 47
45OPTS_debug=-D_DEBUG -g -ggdb # -pg -fprofile-arcs -ftest-coverage 48OPTS_debug=-D_DEBUG -g -ggdb # -pg -fprofile-arcs -ftest-coverage
46OPTS_production=-O3 49OPTS_production=-O3
47 50
48CFLAGS+=-DOT_VERSION=\"$(VERSION)\" -DGIT_VERSION=\"$(GIT_VERSION)\" -Wall -pipe -pthread -Wextra -Wwrite-strings #-ansi -pedantic 51CFLAGS+=-DOT_VERSION=\"$(VERSION)\" -DGIT_VERSION=\"$(GIT_VERSION)\" -DOT_TAG=\"$(OT_TAG)\" -Wall -pipe -pthread -Wextra -Wwrite-strings #-ansi -pedantic
49LDFLAGS+=-pthread 52LDFLAGS+=-pthread
50 53
51# Record feature flags as a dep to allow rebuild when they change 54# Record feature flags as a dep to allow rebuild when they change
@@ -173,6 +176,8 @@ install:
173DISTNAME=opentracker-$(VERSION) 176DISTNAME=opentracker-$(VERSION)
174 177
175dist: 178dist:
179 @test "`git describe --tags --match 'v*' --exact-match 2>/dev/null`" = "v$(VERSION)" || \
180 { echo "HEAD must carry the tag v$(VERSION). Tag the release, or correct VERSION."; exit 1; }
176 rm -rf $(DISTNAME) $(DISTNAME).tar.gz 181 rm -rf $(DISTNAME) $(DISTNAME).tar.gz
177 git archive --format=tar --prefix=$(DISTNAME)/ HEAD | tar -xf - 182 git archive --format=tar --prefix=$(DISTNAME)/ HEAD | tar -xf -
178 git describe --tags --match "v*" --always > $(DISTNAME)/.tarball-version 183 git describe --tags --match "v*" --always > $(DISTNAME)/.tarball-version