From ec2591c92659cb5e3257195bbe7a9c41ac65d29a Mon Sep 17 00:00:00 2001 From: Squibid Date: Thu, 19 Dec 2024 11:46:19 -0600 Subject: bump version info and add compile info to version --- Makefile | 2 +- XD.c | 12 ++++++++++-- config.mk | 12 +++++++++++- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 883deab..e09f983 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ install: XD chmod 755 $(PREFIX)/bin/XD mkdir -p $(MANDIR)/man1 cp -f XD.1 $(MANDIR)/man1 - chmod 644 $(PREFIX)/man1/XD.1 + chmod 644 $(MANDIR)/man1/XD.1 uninstall: XD rm -f $(PREFIX)/bin/XD $(MANDIR)/man1/XD.1 diff --git a/XD.c b/XD.c index a76909b..6132218 100644 --- a/XD.c +++ b/XD.c @@ -1,8 +1,8 @@ #include #include +#include #ifdef ERR #include -#include #endif #ifdef GIT @@ -155,9 +155,17 @@ has_staged(git_repository *repo) int main(int argc, char *argv[]) { - int code = -1; + int i, code = -1; char face[] = { ':', 0, '|' }; + /* print version information */ + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-v") == 0) { + printf("XD v%s\n", VERSION); + return 0; + } + } + #ifdef GIT git_repository *repo; int git_ok = 0; diff --git a/config.mk b/config.mk index bf199e0..e2d946c 100644 --- a/config.mk +++ b/config.mk @@ -1,4 +1,4 @@ -VERSION = 1.0 +VERSION = 1.1 PKG_CONFIG = pkg-config @@ -16,4 +16,14 @@ ERR = # uncomment to enable errors # ERR = -DERR +# add compilation details to VERSION variable +ifneq ($(GIT),) + VERSION := $(VERSION)"\\nlibgit2 "`$(PKG_CONFIG) --modversion $(GITLIB)` +endif +ifeq ($(ERR),) + VERSION := $(VERSION)"\\nerrors disabled" +else + VERSION := $(VERSION)"\\nerrors enabled" +endif + CC = cc -- cgit v1.2.1