summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile17
-rwxr-xr-xtools/get-git-tag15
2 files changed, 15 insertions, 17 deletions
diff --git a/Makefile b/Makefile
index 149f397..debe4b5 100644
--- a/Makefile
+++ b/Makefile
@@ -8,6 +8,19 @@ CXXFLAGS := -Wall -Werror -std=c++20 -fPIC -iquote . ${OPTIMIZE} ${DEBUG}
8 8
9.DEFAULT: issim 9.DEFAULT: issim
10 10
11VERSION := $(shell git describe --always --dirty --long --tags 2> /dev/null)
12ifndef VERSION
13VERSION := unknown
14endif
15$(info Version ${VERSION})
16
17define GITTAGCPP =
18#include <string>
19
20std::string GIT_TAG = "$(subst ",\",${VERSION})";
21endef
22export GITTAGCPP
23
11libname = $(shell realpath --canonicalize-missing --relative-to . build/$(dir $(1))/lib$(notdir $(1))) 24libname = $(shell realpath --canonicalize-missing --relative-to . build/$(dir $(1))/lib$(notdir $(1)))
12 25
13define mklib = 26define mklib =
@@ -35,7 +48,7 @@ endif
35 48
36endef 49endef
37 50
38PARTS := $(patsubst ./%,%,$(shell find -mindepth 1 -type d -\( -name .\* -prune -o -name build -prune -o -name tools -prune -o -print -\))) 51PARTS := $(patsubst ./%,%,$(shell find -mindepth 1 -type d -\( -name .\* -prune -o -name build -prune -o -print -\)))
39PARTARS := 52PARTARS :=
40PARTSOS := 53PARTSOS :=
41 54
@@ -68,7 +81,7 @@ clean:
68 81
69build/git-tag.cpp: 82build/git-tag.cpp:
70 @mkdir -p $(dir $@) 83 @mkdir -p $(dir $@)
71 tools/get-git-tag > $@ 84 @echo "$$GITTAGCPP" > $@
72.PHONY: build/git-tag.cpp 85.PHONY: build/git-tag.cpp
73 86
74include $(shell find -type f -name \*.d) 87include $(shell find -type f -name \*.d)
diff --git a/tools/get-git-tag b/tools/get-git-tag
deleted file mode 100755
index cb4e2fa..0000000
--- a/tools/get-git-tag
+++ /dev/null
@@ -1,15 +0,0 @@
1#!/bin/bash
2
3set -u
4
5TAG="$(git describe --always --tags --long --dirty 2> /dev/null)"
6
7if [[ "$TAG" == "" ]]; then
8 TAG="unknown"
9fi
10
11cat <<END
12#include <string>
13
14std::string GIT_TAG = "$TAG";
15END