commit c2cc0db
uint
·
2026-01-28 23:44:07 +0000 UTC
parent b3dc5f8
add git versioning in builds
2 files changed,
+9,
-3
M
Makefile
+2,
-1
1@@ -1,5 +1,6 @@
2 CC ?= cc
3-CPPFLAGS = -D_POSIX_C_SOURCE=200809L
4+GIT_VER != git describe --always --tags 2>/dev/null || echo unknown
5+CPPFLAGS = -D_POSIX_C_SOURCE=200809L -DGIT_VER=\"$(GIT_VER)\"
6 CFLAGS = -std=c99 -Wall -Wextra -Iserver/include
7 OUT = parados
8
+7,
-2
1@@ -31,6 +31,10 @@
2 #include "log.h"
3 #include "scan.h"
4
5+#ifndef GIT_VER
6+#define GIT_VER "unknown"
7+#endif /* GIT_VER */
8+
9 static void apply_rlimits(void);
10 static void fd_set_cloexec(int fd);
11 static void sock_set_timeouts(int fd);
12@@ -170,13 +174,14 @@ int main(int argc, char* argv[])
13 if (argc > 1) {
14 if (strcmp(argv[1], "-v") == 0) {
15 printf(
16- "parados v"VERSION"\n"
17+ "parados v%s-%s\n"
18 "\n"
19 "This software is licensed under ISC.\n"
20 "See LICENSE for license information.\n"
21 "\n"
22 "See parados(1), parados(7), parados.conf(5)\n"
23- "for usage information\n"
24+ "for usage information\n",
25+ VERSION, GIT_VER
26 );
27 return EXIT_SUCCESS;
28 }