Skip to content
Browse files

Use adam greens suggestion to simplify the way the git version string…

… is generated
  • Loading branch information...
1 parent 0833955 commit e4738895354705de040b42f09758ac072d2ccbb7 @wolfmanjm wolfmanjm committed Jun 7, 2013
Showing with 11 additions and 16 deletions.
  1. +1 −1 .gitignore
  2. +0 −8 generate-version.sh
  3. +0 −6 makefile
  4. +2 −0 src/generate-version.sh
  5. +7 −0 src/makefile
  6. +1 −1 src/{version.cpp.placeholder → version.cpp}
View
2 .gitignore
@@ -21,4 +21,4 @@ debug
/mac_install.log
/win_install.log
/linux_install.log
-/src/version.cpp
+
View
8 generate-version.sh
@@ -1,8 +0,0 @@
-echo "#include \"version.h\"" > src/version.cpp
-echo "const char *Version::get_build(void) const {" >> src/version.cpp
-echo " return \"`git symbolic-ref HEAD 2> /dev/null | cut -b 12-`-`git log --pretty=format:\"%h\" -1`\";" >> src/version.cpp
-echo "}" >> src/version.cpp
-echo "const char *Version::get_build_date(void) const {" >> src/version.cpp
-echo " return __DATE__ \" \" __TIME__;" >> src/version.cpp
-echo "}" >> src/version.cpp
-
View
6 makefile
@@ -4,12 +4,6 @@ DIRS = mbed src
DIRSCLEAN = $(addsuffix .clean,$(DIRS))
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
@echo Building Smoothie
@ $(MAKE) -C src
View
2 src/generate-version.sh
@@ -0,0 +1,2 @@
+echo `git symbolic-ref HEAD 2> /dev/null | cut -b 12-`-`git log --pretty=format:%h -1`
+touch version.cpp
View
7 src/makefile
@@ -39,6 +39,13 @@ MRI_BREAK_ON_INIT=0
MRI_SEMIHOST_STDIO=0
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
CONSOLE?=/dev/arduino_A900K10V
View
2 src/version.cpp.placeholder → src/version.cpp
@@ -1,6 +1,6 @@
#include "version.h"
const char *Version::get_build(void) const {
- return "placeholder";
+ return __GITVERSIONSTRING__;
}
const char *Version::get_build_date(void) const {
return __DATE__ " " __TIME__;

0 comments on commit e473889

Please sign in to comment.
Something went wrong with that request. Please try again.