From 3834573f5e92d42fb17f6af7ef70d1fae6ed97da Mon Sep 17 00:00:00 2001 From: Brett Weir Date: Sun, 8 Feb 2015 11:30:29 -0800 Subject: [PATCH] Added support for dynamic versioning; added gitignore for bin directory. --- .gitignore | 2 ++ Makefile | 7 +++++++ p1load.c | 4 ++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index edf6645..85b78aa 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,5 @@ *.i*86 *.x86_64 *.hex + +bin/ diff --git a/Makefile b/Makefile index fdd4b1b..dff09cc 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,13 @@ $(OBJDIR)/ploader.o OS?=macosx +VERSION := $(shell git describe --tags --long 2>/dev/null) +ifeq ($(VERSION),) + VERSION := '0.0.0' +endif + +CFLAGS += -D'VERSION="$(VERSION)"' + ifeq ($(OS),linux) CFLAGS+=-DLINUX EXT= diff --git a/p1load.c b/p1load.c index 37592cc..c754948 100644 --- a/p1load.c +++ b/p1load.c @@ -276,7 +276,7 @@ int main(int argc, char *argv[]) static void Usage(void) { printf("\ -p1load - a simple loader for the propeller - version 0.010, 2015-02-08\n\ +p1load - a simple loader for the propeller - v%s, %s\n\ usage: p1load\n\ [ -b baud ] baud rate (default is %d)\n\ [ -D var=val ] set variable value\n\ @@ -288,7 +288,7 @@ usage: p1load\n\ [ -T ] enter PST-compatible terminal mode\n\ [ -v ] verbose output\n\ [ -? ] display a usage message and exit\n\ - file file to load\n", BAUD_RATE); + file file to load\n", VERSION, __DATE__, BAUD_RATE); #ifdef RASPBERRY_PI printf("\ \n\