diff --git a/Makefile b/Makefile index c17ccda..5440039 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ +VERSION = 1.0.0 + CC = gcc -CFLAGS = -W -Wall -pedantic -ansi -std=c99 -g +CFLAGS = -W -Wall -pedantic -ansi -std=c99 -g -DTS_VERSION=\"$(VERSION)\" LDFLAGS = -lncursesw diff --git a/VERSION b/VERSION deleted file mode 100644 index 3eefcb9..0000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.0.0 diff --git a/src/ttysolitaire.c b/src/ttysolitaire.c index b7091a1..cbc5442 100644 --- a/src/ttysolitaire.c +++ b/src/ttysolitaire.c @@ -8,6 +8,10 @@ #include "keyboard.h" #include "common.h" +#ifndef TS_VERSION +#define TS_VERSION "n/a" +#endif + const char *program_name; struct game game; @@ -123,16 +127,5 @@ void usage(const char *program_name) { } void version() { - FILE *version_file; - char version_string[6]; - - if (!(version_file = fopen("VERSION", "rb"))) { - tty_solitaire_generic_error(errno, __FILE__, __LINE__); - } - if (!fread(version_string, 1, 5, version_file)) { - // TODO: handle this. - } - version_string[5] = '\0'; - printf("%s\n", version_string); - fclose(version_file); + printf("%s\n", TS_VERSION); }