Skip to content

Commit

Permalink
Print version (tag + commit)
Browse files Browse the repository at this point in the history
  • Loading branch information
msalau committed Oct 16, 2022
1 parent 4c9b6b2 commit 29969af
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
TAG := $(shell git describe --tags --always)
CFLAGS := -O2 -Wall -Wextra -Werror
CPPFLAGS = -MMD -MP -MF ${@:.o=.d}
CPPFLAGS = -MMD -MP -MF ${@:.o=.d} -DVERSION=\"$(TAG)\"
LDFLAGS :=
LIBS := -lpthread

Expand Down Expand Up @@ -39,7 +40,6 @@ install: rl78flash rl78g10flash
ifneq ($(MAKECMDGOALS),clean)

TAR ?= tar
TAG := $(shell git describe --tags)
VERSION := $(TAG:v%=%)
IS_x86_64 := $(shell $(CC) -dumpmachine | grep x86_64)
ARCH := $(if $(IS_x86_64),amd64,i386)
Expand Down
9 changes: 9 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
int verbose_level = 0;

const char *usage =
"rl78flash " VERSION "\n"
"\n"
"Usage:\n"
"rl78flash [options] <port> [<file>]\n"
"\t-v\tVerbose mode (several times increase verbose level)\n"
"\t-i\tDisplay info about MCU\n"
Expand Down Expand Up @@ -211,6 +214,12 @@ int main(int argc, char *argv[])
return EINVAL;
}
}

if (1 <= verbose_level)
{
printf("rl78flash %s\n", VERSION);
}

if (invert_reset)
{
mode |= MODE_INVERT_RESET;
Expand Down
9 changes: 9 additions & 0 deletions src/main_g10.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
int verbose_level = 0;

const char *usage =
"rl78flash " VERSION "\n"
"\n"
"Usage:\n"
"rl78g10flash [options] <port> [<file> <size>]\n"
"\t-a\tAuto mode (Erase/Write-Verify-Reset)\n"
"\t-w\tWrite memory\n"
Expand Down Expand Up @@ -115,6 +118,12 @@ int main(int argc, char *argv[])
return EINVAL;
}
}

if (1 <= verbose_level)
{
printf("rl78g10flash %s\n", VERSION);
}

if (invert_reset)
{
mode |= MODE_INVERT_RESET;
Expand Down

0 comments on commit 29969af

Please sign in to comment.