Skip to content

Commit

Permalink
Use adam greens suggestion to simplify the way the git version string…
Browse files Browse the repository at this point in the history
… is generated
  • Loading branch information
wolfmanjm committed Jun 7, 2013
1 parent 0833955 commit e473889
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ debug
/mac_install.log /mac_install.log
/win_install.log /win_install.log
/linux_install.log /linux_install.log
/src/version.cpp
8 changes: 0 additions & 8 deletions generate-version.sh

This file was deleted.

6 changes: 0 additions & 6 deletions makefile
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ DIRS = mbed src
DIRSCLEAN = $(addsuffix .clean,$(DIRS)) DIRSCLEAN = $(addsuffix .clean,$(DIRS))


all: all:
ifneq "$(OS)" "Windows_NT"
@./generate-version.sh
else
@xcopy /C /I /Y src/version.cpp.placeholder src/version.cpp
endif
@echo Building mbed SDK
@ $(MAKE) -C mbed @ $(MAKE) -C mbed
@echo Building Smoothie @echo Building Smoothie
@ $(MAKE) -C src @ $(MAKE) -C src
Expand Down
2 changes: 2 additions & 0 deletions src/generate-version.sh
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,2 @@
echo `git symbolic-ref HEAD 2> /dev/null | cut -b 12-`-`git log --pretty=format:%h -1`
touch version.cpp
7 changes: 7 additions & 0 deletions src/makefile
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ MRI_BREAK_ON_INIT=0
MRI_SEMIHOST_STDIO=0 MRI_SEMIHOST_STDIO=0
endif endif


# generate a git version string, sorry only on linux and mac osx
ifneq "$(OS)" "Windows_NT"
DEFINES += -D__GITVERSIONSTRING__=\"$(shell ./generate-version.sh)\"
else
DEFINES += -D__GITVERSIONSTRING__=\"placeholder\"
endif

include $(BUILD_DIR)/build.mk include $(BUILD_DIR)/build.mk


CONSOLE?=/dev/arduino_A900K10V CONSOLE?=/dev/arduino_A900K10V
Expand Down
2 changes: 1 addition & 1 deletion src/version.cpp.placeholder → src/version.cpp
Original file line number Original file line Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "version.h" #include "version.h"
const char *Version::get_build(void) const { const char *Version::get_build(void) const {
return "placeholder"; return __GITVERSIONSTRING__;
} }
const char *Version::get_build_date(void) const { const char *Version::get_build_date(void) const {
return __DATE__ " " __TIME__; return __DATE__ " " __TIME__;
Expand Down

0 comments on commit e473889

Please sign in to comment.