From: Christian Loehle <CLoehle@hyperstone.com>
To: "linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
Ulf Hansson <ulf.hansson@linaro.org>,
Avri Altman <avri.altman@wdc.com>
Subject: [PATCH] mmc-utils: Change version string to git hash
Date: Wed, 12 Apr 2023 15:04:42 +0000 [thread overview]
Message-ID: <28623fa7390242e9b003a44016c0235f@hyperstone.com> (raw)
Since mmc-utils versioning has always been 0.1 and changes are not
made frequently and formal releases do not happen, packaged versions
are just pulled from git anyway, using the git hash for version is
probably the best idea for now.
Signed-off-by: Christian Loehle <cloehle@hyperstone.com>
---
Makefile | 3 ++-
mmc.c | 6 ++----
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index aa27ff2..d8d59a4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,7 @@
CC ?= gcc
+GIT_VERSION := "$(shell git describe --abbrev=6 --always --tags)"
AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2
-CFLAGS ?= -g -O2
+CFLAGS ?= -g -O2 -DVERSION=\"$(GIT_VERSION)\"
objects = \
mmc.o \
mmc_cmds.o \
diff --git a/mmc.c b/mmc.c
index b9aa478..795b4e3 100644
--- a/mmc.c
+++ b/mmc.c
@@ -26,8 +26,6 @@
#include "mmc_cmds.h"
-#define MMC_VERSION "0.1"
-
#define BASIC_HELP 0
#define ADVANCED_HELP 1
@@ -319,7 +317,7 @@ static void help(char *np)
printf("\n\t%s help|--help|-h\n\t\tShow the help.\n",np);
printf("\n\t%s <cmd> --help\n\t\tShow detailed help for a command or subset of commands.\n",np);
- printf("\n%s\n", MMC_VERSION);
+ printf("\n%s\n", VERSION);
}
static int split_command(char *cmd, char ***commands)
@@ -500,7 +498,7 @@ static int parse_args(int argc, char **argv,
}
if(helprequested){
- printf("\n%s\n", MMC_VERSION);
+ printf("\n%s\n", VERSION);
return 0;
}
--
2.37.3
Hyperstone GmbH | Reichenaustr. 39a | 78467 Konstanz
Managing Director: Dr. Jan Peter Berns.
Commercial register of local courts: Freiburg HRB381782
next reply other threads:[~2023-04-12 15:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-12 15:04 Christian Loehle [this message]
2023-04-17 8:30 ` [PATCH] mmc-utils: Change version string to git hash Ulf Hansson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=28623fa7390242e9b003a44016c0235f@hyperstone.com \
--to=cloehle@hyperstone.com \
--cc=avri.altman@wdc.com \
--cc=linux-mmc@vger.kernel.org \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox