From f0b3d3d01d32645ec439a28a0a5c15d7a4aa156f Mon Sep 17 00:00:00 2001 From: "Geoffrey D. Bennett" Date: Tue, 15 Mar 2022 03:19:01 +1030 Subject: [PATCH] Don't hardcode the version number in the about dialog Update the Makefile to use git describe to get the version number and define that as a macro that about.c can use. --- src/Makefile | 2 ++ src/about.c | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Makefile b/src/Makefile index 614248b..992d6c3 100644 --- a/src/Makefile +++ b/src/Makefile @@ -4,10 +4,12 @@ # Credit to Tom Tromey and Paul D. Smith: # http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/ +VERSION := $(shell git describe --abbrev=4 --dirty --always --tags) DEPDIR := .deps DEPFLAGS = -MT $@ -MMD -MP -MF $(DEPDIR)/$*.d CFLAGS := -Wall -Werror -ggdb -fno-omit-frame-pointer -O2 -D_FORTIFY_SOURCE=2 +CFLAGS += -DVERSION=\"$(VERSION)\" PKG_CONFIG=pkg-config diff --git a/src/about.c b/src/about.c index 11aee07..17d2b61 100644 --- a/src/about.c +++ b/src/about.c @@ -18,7 +18,7 @@ void activate_about( gtk_show_about_dialog( w, "program-name", "ALSA Scarlett Gen 2/3 Control Panel", - "version", "Version 0.1", + "version", "Version " VERSION, "comments", "GTK4 interface to the ALSA Scarlett Gen 2/3 Mixer controls", "website", "https://github.com/geoffreybennett/alsa-scarlett-gui", "copyright", "Copyright 2022 Geoffrey D. Bennett", @@ -29,4 +29,3 @@ void activate_about( NULL ); } -