Browse Source

Add RELEASE file and define version strings.

Georgi Chorbadzhiyski 12 years ago
parent
commit
dae2618a4f
3 changed files with 17 additions and 2 deletions
  1. 12
    1
      Makefile
  2. 1
    0
      RELEASE
  3. 4
    1
      fjfs.c

+ 12
- 1
Makefile View File

@@ -1,3 +1,14 @@
1
+CC = $(CROSS)$(TARGET)gcc
2
+
3
+BUILD_ID = $(shell date +%F_%R)
4
+VERSION = $(shell cat RELEASE)
5
+GIT_VER = $(shell git describe --tags --dirty --always 2>/dev/null)
6
+ifeq "$(GIT_VER)" ""
7
+GIT_VER = "release"
8
+endif
9
+
10
+CFLAGS_BUILD = -DBUILD_ID=\"$(BUILD_ID)\" -DVERSION=\"$(VERSION)\" -DGIT_VER=\"$(GIT_VER)\"
11
+
1 12
 CFLAGS_DBG?=	-ggdb
2 13
 CFLAGS_OPT?=	-O2
3 14
 CFLAGS_WARN?=	-Wall -W -Wextra -Wshadow -Wformat-security \
@@ -7,7 +18,7 @@ CFLAGS_WARN?=	-Wall -W -Wextra -Wshadow -Wformat-security \
7 18
 		-Wredundant-decls -Wstrict-prototypes
8 19
 
9 20
 CFLAGS?=	${CFLAGS_DBG} ${CFLAGS_OPT}
10
-CFLAGS+=	${CFLAGS_WARN}
21
+CFLAGS+=	${CFLAGS_WARN} ${CFLAGS_BUILD}
11 22
 
12 23
 CFLAGS+=	`pkg-config --cflags fuse`
13 24
 LIBS+=		`pkg-config --libs fuse`

+ 1
- 0
RELEASE View File

@@ -0,0 +1 @@
1
+1.0

+ 4
- 1
fjfs.c View File

@@ -40,6 +40,8 @@
40 40
 #include <fnmatch.h>
41 41
 #include <fuse.h>
42 42
 
43
+static const char *program_id = "fjfs v" VERSION " (" GIT_VER ", build " BUILD_ID ")";
44
+
43 45
 /* Handle list of files */
44 46
 struct fileinfo {
45 47
 	int		fd;
@@ -300,7 +302,8 @@ static const struct option long_options[] = {
300 302
 };
301 303
 
302 304
 static void show_usage(void) {
303
-	printf("fjfs - FUSE module for virtual joining of multiple files into one.\n");
305
+	printf("%s\n", program_id);
306
+	printf("FUSE module for virtual joining of multiple files into one.\n");
304 307
 	printf("\n");
305 308
 	printf("Usage: fjfs [file-list-options] [options] mount-point-file file-list\n");
306 309
 	printf("\n");

Loading…
Cancel
Save