From: Ian Jackson Date: Sun, 9 Mar 2014 02:45:08 +0000 (+0000) Subject: show git version in output X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=matchsticks-search.git;a=commitdiff_plain;h=33c2116932d26da928f87e70cb16c97358d8bf0c;hp=5bab6fc9666dfd922b4b705dc75fa81d2c1351f9 show git version in output --- diff --git a/Makefile b/Makefile index 96ede56..c8e179f 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ CFLAGS += -Wall -Wwrite-strings -Wstrict-prototypes -g -O2 -std=gnu99 +CPPFLAGS += -DVERSION="\"`git-describe --tags --dirty=+`\"" LC_CTYPE=C LDLIBS = -lpub -lglpk -lm diff --git a/main.c b/main.c index b02e98c..3fa6ad3 100644 --- a/main.c +++ b/main.c @@ -42,6 +42,10 @@ #include +#ifndef VERSION +#define VERSION "(unknown-version)" +#endif + /* * Algorithm. * @@ -651,7 +655,7 @@ static void report(void) { continue; a[x][y] = min + glp_get_col_prim(best_prob, i); } - printf("%d into %d: min fragment %g\n", n, m, min); + printf("%d into %d: min fragment %g [%s]\n", n, m, min, VERSION); for (i = 0; i < n; i++) { for (j = 0; j < m; j++) { if (a[i][j])