Skip to content

Commit 3949c50

Browse files
committed
added automatically generated version generation via git
1 parent d937318 commit 3949c50

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ CC ?= gcc
22
DEBUG := -ggdb -O0 -march=native
33
OUTPUT := -MMD -MP
44

5+
# Version
6+
VER ?= $(shell git describe --tags --always --dirty)
7+
58
# Include Directories
69
INCLUDE := $(shell pkg-config --cflags libzip)
710
INCLUDE += -I/usr/include
@@ -10,7 +13,7 @@ INCLUDE += -I/usr/local/opt/curl/include
1013
INCLUDE += -I/usr/local/opt/libzip/include
1114

1215
# Compiler Flags
13-
CFLAGS := $(CFLAGS) $(DEBUG) $(INCLUDE)
16+
CFLAGS := $(CFLAGS) $(DEBUG) $(INCLUDE) -DVERSION='"$(VER)"'
1417
CFLAGS += -W -Wall -Wextra -pedantic -ansi
1518
CFLAGS += -Wstrict-overflow -fno-strict-aliasing
1619

src/tldr.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@
1818
#include <pwd.h>
1919
#include <time.h>
2020

21-
#define VERSION_MAJOR 1
22-
#define VERSION_MINOR 1
23-
#define VERSION_PATCH 0
24-
#define VERSION_PRETTY "v1.1.0"
21+
#ifndef VERSION
22+
#define VERSION_PRETTY "Version Unknown"
23+
#else
24+
#define VERSION_PRETTY VERSION
25+
#endif
2526

2627
#if defined(_WIN32)
2728
#define BINARY O_BINARY

0 commit comments

Comments
 (0)