Skip to content
This repository has been archived by the owner on Jan 16, 2023. It is now read-only.

Commit

Permalink
New version scheme
Browse files Browse the repository at this point in the history
VERSION string between releases is last release suffixed with '+'.
Additionally, use output of git-describe instead of VERSION string, if it is
not empty.
  • Loading branch information
xyb3rt committed Jun 9, 2018
1 parent b78aaee commit 8bf1adc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = git-20180411
VERSION = 24+

srcdir = .
VPATH = $(srcdir)
Expand All @@ -20,7 +20,7 @@ HAVE_GIFLIB = 1
HAVE_LIBEXIF = 1

ALL_CFLAGS = $(DEF_CFLAGS) $(CFLAGS)
REQ_CPPFLAGS = -I. -D_XOPEN_SOURCE=700 -DVERSION=\"$(VERSION)\" \
REQ_CPPFLAGS = -I. -D_XOPEN_SOURCE=700 \
-DHAVE_GIFLIB=$(HAVE_GIFLIB) -DHAVE_LIBEXIF=$(HAVE_LIBEXIF)
ALL_CPPFLAGS = $(REQ_CPPFLAGS) $(DEF_CPPFLAGS) $(CPPFLAGS)

Expand All @@ -46,6 +46,7 @@ sxiv: $(OBJS)
$(CC) $(LDFLAGS) $(ALL_CFLAGS) -o $@ $(OBJS) $(LDLIBS)

$(OBJS): Makefile sxiv.h commands.lst config.h
options.o: version.h
window.o: icon/data.h

.c.o:
Expand All @@ -56,6 +57,14 @@ config.h:
@echo "GEN $@"
cp $(srcdir)/config.def.h $@

version.h: Makefile .git/index
@echo "GEN $@"
VERSION="$$(cd $(srcdir); git describe 2>/dev/null)"; \
[ -z "$$VERSION" ] && VERSION="$(VERSION)"; \
echo "#define VERSION \"$$VERSION\"" >$@

.git/index:

clean:
rm -f *.o sxiv

Expand Down
3 changes: 2 additions & 1 deletion options.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "sxiv.h"
#define _IMAGE_CONFIG
#include "config.h"
#include "version.h"

#include <stdlib.h>
#include <string.h>
Expand All @@ -36,7 +37,7 @@ void print_usage(void)

void print_version(void)
{
printf("sxiv %s - Simple X Image Viewer\n", VERSION);
puts("sxiv " VERSION);
}

void parse_options(int argc, char **argv)
Expand Down

0 comments on commit 8bf1adc

Please sign in to comment.