Use git describe for the version string
authorJoseph C. Lehner <joseph.c.lehner@gmail.com>
Mon, 8 Feb 2016 14:43:43 +0000 (15:43 +0100)
committerJoseph C. Lehner <joseph.c.lehner@gmail.com>
Mon, 8 Feb 2016 14:45:51 +0000 (15:45 +0100)
Makefile
main.c
nmrpd.h

index 0a644e2e586edb379666dcd87d4c2d1d657a217b..e6f64bbdc101fca63999fb542688886f52c2bfcf 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 CC ?= gcc
 PREFIX ?= /usr/local
-CFLAGS += -Wall -g
+CFLAGS += -Wall -g -DNMRPFLASH_VERSION=\"$(shell git describe --always)\"
 LIBS = -lpcap
 
 .PHONY: clean install release release/osx release/linux
@@ -28,8 +28,10 @@ install: nmrp-flash
 
 release/osx:
        make release CFLAGS="-arch i686 -arch x86_64"
+       cp nmrp-flash binaries/osx/
 
 release/linux: release
+       cp nmrp-flash binaries/linux/
 
 release: clean nmrp-flash
        strip nmrp-flash
diff --git a/main.c b/main.c
index b8963e9e3ca0a65c7aaf5ad3a1a0b699301ef1b6..2b8738577379302bd54ca2fb8b2f2b522047e222 100644 (file)
--- a/main.c
+++ b/main.c
@@ -57,11 +57,11 @@ void usage(FILE *fp)
                        "C:\\> nmrp-flash.exe -i net0 -a 192.168.1.254 -f firmware.bin\n"
 #endif
                        "\n"
-                       "nmrp-flash v%s, Copyright (C) 2016 Joseph C. Lehner\n"
+                       "nmrp-flash %s, Copyright (C) 2016 Joseph C. Lehner\n"
                        "nmrp-flash is free software, licensed under the GNU GPLv3.\n"
                        "Source code at https://github.com/jclehner/nmrp-flash\n"
                        "\n",
-                       NMRPD_VERSION
+                       NMRPFLASH_VERSION
          );
 }
 
@@ -131,7 +131,7 @@ int main(int argc, char **argv)
 
                                break;
                        case 'V':
-                               printf("nmrp-flash v%s\n", NMRPD_VERSION);
+                               printf("nmrp-flash %s\n", NMRPFLASH_VERSION);
                                val = 0;
                                goto out;
                        case 'v':
diff --git a/nmrpd.h b/nmrpd.h
index 0f9e6ac949ffb5ab481606cd1a6de478b6710ec3..bcbe5228d5ef3054412d6e532c042593fb5be08d 100644 (file)
--- a/nmrpd.h
+++ b/nmrpd.h
@@ -44,8 +44,6 @@
 #include <windows.h>
 #endif
 
-#define NMRPD_VERSION "0.9"
-
 enum nmrp_op {
        NMRP_UPLOAD_FW = 0,
        NMRP_UPLOAD_ST = 1,