diff --git a/.github/workflows/linux_and_macos.yml b/.github/workflows/linux_and_macos.yml index 8a4478b..23f8bb9 100644 --- a/.github/workflows/linux_and_macos.yml +++ b/.github/workflows/linux_and_macos.yml @@ -212,8 +212,10 @@ jobs: ################################################################ EOF + eval `grep ^VERSION Makefile | tr -d ' '` + sed "s/@VERSION@/$VERSION/" recordings/template.txt > recordings/expected.txt diff -u recordings/{expected,actual}.txt - rm -f recordings/actual.txt + rm -f recordings/{expected,actual}.txt - name: 'Clean' env: diff --git a/Makefile b/Makefile index cb06e5f..31b9bbd 100755 --- a/Makefile +++ b/Makefile @@ -1,6 +1,8 @@ +VERSION = 1.6.4 DESTDIR ?= PREFIX ?= /usr/local MANPREFIX ?= $(PREFIX)/man +CPPFLAGS += -DVERSION_STR='"$(VERSION)"' CFLAGS += -Wall -Wextra CFLAGS += `pkg-config --cflags ncursesw` LDLIBS += `pkg-config --libs ncursesw` -lm @@ -22,6 +24,6 @@ clean: .c: @pkg-config --version > /dev/null - $(CC) $(CFLAGS) $(LDFLAGS) $< $(LDLIBS) -o $@ + $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $< $(LDLIBS) -o $@ .PHONY: all clean install uninstall diff --git a/recordings/get_back_in_sync.sh b/recordings/get_back_in_sync.sh index 38a2f16..54413b0 100755 --- a/recordings/get_back_in_sync.sh +++ b/recordings/get_back_in_sync.sh @@ -22,12 +22,13 @@ fi ./record.sh -cp actual.txt expected.txt +eval `grep ^VERSION ../Makefile | tr -d ' '` # get the version number +sed "s/$VERSION/@VERSION@/" actual.txt > template.txt -git add expected.txt +git add template.txt if git diff --cached --exit-code >/dev/null ; then echo 'Already in sync, good.' else - EDITOR=true git commit -m 'recordings: Sync expected.txt' + EDITOR=true git commit -m 'recordings: Sync template.txt' fi diff --git a/recordings/expected.txt b/recordings/template.txt similarity index 98% rename from recordings/expected.txt rename to recordings/template.txt index 0787a65..fb60bee 100644 --- a/recordings/expected.txt +++ b/recordings/template.txt @@ -19,7 +19,7 @@ | │ | | └─────────────────────────────────────────────────────────────────────────────────────> | | X Thu Jan 1 00:00:00 1970 | -|   https://github.com/tenox7/ttyplot 1.6.2 | +|   https://github.com/tenox7/ttyplot @VERSION@ | +------------------------------------------------------------------------------------------+ [90x20] Frame 2: @@ -43,7 +43,7 @@ | │ XX | | └─────────────────────────────────────────────────────────────────────────────────────> | | X last=3.0 min=1.0 max=3.0 avg=2.0 Thu Jan 1 00:00:00 1970 | -|   last=4.0 min=2.0 max=4.0 avg=3.0 https://github.com/tenox7/ttyplot 1.6.2 | +|   last=4.0 min=2.0 max=4.0 avg=3.0 https://github.com/tenox7/ttyplot @VERSION@ | +------------------------------------------------------------------------------------------+ [90x20] Frame 3: @@ -67,6 +67,6 @@ | │ XX | | └─────────────────────────────────────────────────────────────────────────────────────> | | X last=3.0 min=1.0 max=3.0 avg=2.0 Thu Jan 1 00:00:00 1970 | -|   last=4.0 min=2.0 max=4.0 avg=3.0 https://github.com/tenox7/ttyplot 1.6.2 | +|   last=4.0 min=2.0 max=4.0 avg=3.0 https://github.com/tenox7/ttyplot @VERSION@ | +------------------------------------------------------------------------------------------+ diff --git a/ttyplot.c b/ttyplot.c index 23b0f2b..801260d 100644 --- a/ttyplot.c +++ b/ttyplot.c @@ -42,13 +42,6 @@ #include #endif -#define STR_(x) #x -#define STR(x) STR_(x) -#define VERSION_MAJOR 1 -#define VERSION_MINOR 6 -#define VERSION_PATCH 4 -#define VERSION_STR STR(VERSION_MAJOR) "." STR(VERSION_MINOR) "." STR(VERSION_PATCH) - #define T_RARR '>' #define T_UARR '^' #ifdef NOACS