Browse Source

Set git revision in Makefile if .git exists

tags/v1.0
Bernhard Fröhlich 5 years ago
parent
commit
045ca29deb
2 changed files with 9 additions and 2 deletions
  1. 7
    0
      Makefile
  2. 2
    2
      drmdecrypt.c

+ 7
- 0
Makefile View File

@@ -10,6 +10,13 @@ STRIP	= strip
10 10
 PREFIX	= /usr/local
11 11
 BINDIR	= $(PREFIX)/bin
12 12
 
13
+# add git revision if .git exists
14
+ifeq (,$(wildcard .git))
15
+CFLAGS	+= -DREVISION="unknown"
16
+else
17
+CFLAGS	+= -DREVISION="$(shell git rev-parse --short HEAD)"
18
+endif
19
+
13 20
 ifeq ($(DEBUG),1)
14 21
 # for debugging
15 22
 CFLAGS	+= -g -Wall -Werror

+ 2
- 2
drmdecrypt.c View File

@@ -26,7 +26,7 @@
26 26
 #ifndef REVISION
27 27
 #define REVISION  ""
28 28
 #endif
29
-#define VERSION	  "0.9-git" STR(REVISION)
29
+#define VERSION	  "0.9-git"
30 30
 
31 31
 block_state state;
32 32
 int enable_aesni = 0;
@@ -413,7 +413,7 @@ int main(int argc, char *argv[])
413 413
             strcpy(outdir, optarg);
414 414
             break;
415 415
          case 'v':
416
-            fprintf(stderr, "drmdecrypt %s\n\n", VERSION);
416
+            fprintf(stderr, "drmdecrypt %s (%s)\n\n", VERSION, STR(REVISION));
417 417
             fprintf(stderr, "Source: http://github.com/decke/drmdecrypt\n");
418 418
             fprintf(stderr, "License: GNU General Public License\n");
419 419
             exit(EXIT_SUCCESS);

Loading…
Cancel
Save