diff --git a/Makefile b/Makefile index 6f7a3ab..ccacf26 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,13 @@ -GITREV ?= $(shell git describe --dirty --always) +GITREV ?= $(shell git describe --dirty --always) BLDDATE ?= $(shell date -I) CR_YEAR ?= $(shell date +%Y) +VERSION ?= "v0.1.2" CFLAGS ?= -Wall -Wextra -Wpedantic -O2 -std=gnu99 CFLAGS += -DGITREV='"$(GITREV)"' CFLAGS += -DBLDDATE='"$(BLDDATE)"' CFLAGS += -DCR_YEAR='"$(CR_YEAR)"' +CFLAGS += -DVERSION='$(VERSION)' # Soon... # CFLAGS += $(shell pkg-config --cflags libudev) diff --git a/writeimg.c b/writeimg.c index f85eca8..ef75026 100644 --- a/writeimg.c +++ b/writeimg.c @@ -10,10 +10,12 @@ #include #include -#ifdef GITREV -#define VERSION GITREV -#else -#define VERSION "1.0.0" +#ifndef GITREV +#define GITREV "unknown" +#endif + +#ifndef VERSION +#define VERSION "unknown" #endif #ifndef CR_YEAR @@ -127,11 +129,11 @@ static const struct option longopts[] = { }; int main(int argc, char *argv[]) { - printf("%s version %s\n", basename(argv[0]), VERSION); + printf("%s %s, Rev. %s\n", basename(argv[0]), VERSION, GITREV); + fprintf(stdout, copyright, CR_YEAR); #ifdef BLDDATE printf("Build date: %s\n", BLDDATE); #endif - fprintf(stdout, copyright, CR_YEAR); printf("\n"); /* Line buffering, system allocated */