From 797c56e0e7d199b728e9f929cb2e78a72f7cb916 Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Sat, 25 Jun 2022 19:49:39 -0700 Subject: Move git tag generation entirely into the Makefile. --- Makefile | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'Makefile') 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} .DEFAULT: issim +VERSION := $(shell git describe --always --dirty --long --tags 2> /dev/null) +ifndef VERSION +VERSION := unknown +endif +$(info Version ${VERSION}) + +define GITTAGCPP = +#include + +std::string GIT_TAG = "$(subst ",\",${VERSION})"; +endef +export GITTAGCPP + libname = $(shell realpath --canonicalize-missing --relative-to . build/$(dir $(1))/lib$(notdir $(1))) define mklib = @@ -35,7 +48,7 @@ endif endef -PARTS := $(patsubst ./%,%,$(shell find -mindepth 1 -type d -\( -name .\* -prune -o -name build -prune -o -name tools -prune -o -print -\))) +PARTS := $(patsubst ./%,%,$(shell find -mindepth 1 -type d -\( -name .\* -prune -o -name build -prune -o -print -\))) PARTARS := PARTSOS := @@ -68,7 +81,7 @@ clean: build/git-tag.cpp: @mkdir -p $(dir $@) - tools/get-git-tag > $@ + @echo "$$GITTAGCPP" > $@ .PHONY: build/git-tag.cpp include $(shell find -type f -name \*.d) -- cgit v1.2.3