Skip to content

Commit

Permalink
Added Git Version number (*NIX only)
Browse files Browse the repository at this point in the history
  • Loading branch information
George Smart committed Mar 9, 2017
1 parent 960e4d8 commit d3377e7
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ MMDVMHost
*.VC.db
.vs
*.ambe
gitversion.h
2 changes: 2 additions & 0 deletions MMDVMHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "LCDproc.h"
#include "Thread.h"
#include "Log.h"
#include "gitversion.h"

#if defined(HD44780)
#include "HD44780.h"
Expand Down Expand Up @@ -235,6 +236,7 @@ int CMMDVMHost::run()
LogInfo(HEADER4);

LogMessage("MMDVMHost-%s is starting", VERSION);
LogMessage("Built %s %s (GitID #%.7s)", __TIME__, __DATE__, gitversion);

readParams();

Expand Down
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,19 @@ OBJECTS = \

all: MMDVMHost

MMDVMHost: $(OBJECTS)
MMDVMHost: gitversion.h $(OBJECTS)
$(CXX) $(OBJECTS) $(CFLAGS) $(LIBS) -o MMDVMHost

%.o: %.cpp
$(CXX) $(CFLAGS) -c -o $@ $<

clean:
$(RM) MMDVMHost *.o *.d *.bak *~

$(RM) MMDVMHost *.o *.d *.bak *~ gitversion.h

# Export the current git version if the index file exists, else 000...
gitversion.h:
ifneq ("$(wildcard .git/index)","")
echo "const char *gitversion = \"$(shell git rev-parse HEAD)\";" > $@
else
echo "const char *gitversion = \"0000000000000000000000000000000000000000\";" > $@
endif
13 changes: 10 additions & 3 deletions Makefile.Pi
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,19 @@ OBJECTS = \

all: MMDVMHost

MMDVMHost: $(OBJECTS)
MMDVMHost: gitversion.h $(OBJECTS)
$(CXX) $(OBJECTS) $(CFLAGS) $(LIBS) -o MMDVMHost

%.o: %.cpp
$(CXX) $(CFLAGS) -c -o $@ $<

clean:
$(RM) MMDVMHost *.o *.d *.bak *~

$(RM) MMDVMHost *.o *.d *.bak *~ gitversion.h

# Export the current git version if the index file exists, else 000...
gitversion.h:
ifneq ("$(wildcard .git/index)","")
echo "const char *gitversion = \"$(shell git rev-parse HEAD)\";" > $@
else
echo "const char *gitversion = \"0000000000000000000000000000000000000000\";" > $@
endif
13 changes: 10 additions & 3 deletions Makefile.Pi.Adafruit
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,19 @@ OBJECTS = \

all: MMDVMHost

MMDVMHost: $(OBJECTS)
MMDVMHost: gitversion.h $(OBJECTS)
$(CXX) $(OBJECTS) $(CFLAGS) $(LIBS) -o MMDVMHost

%.o: %.cpp
$(CXX) $(CFLAGS) -c -o $@ $<

clean:
$(RM) MMDVMHost *.o *.d *.bak *~

$(RM) MMDVMHost *.o *.d *.bak *~ gitversion.h

# Export the current git version if the index file exists, else 000...
gitversion.h:
ifneq ("$(wildcard .git/index)","")
echo "const char *gitversion = \"$(shell git rev-parse HEAD)\";" > $@
else
echo "const char *gitversion = \"0000000000000000000000000000000000000000\";" > $@
endif
13 changes: 10 additions & 3 deletions Makefile.Pi.HD44780
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,19 @@ OBJECTS = \

all: MMDVMHost

MMDVMHost: $(OBJECTS)
MMDVMHost: gitversion.h $(OBJECTS)
$(CXX) $(OBJECTS) $(CFLAGS) $(LIBS) -o MMDVMHost

%.o: %.cpp
$(CXX) $(CFLAGS) -c -o $@ $<

clean:
$(RM) MMDVMHost *.o *.d *.bak *~

$(RM) MMDVMHost *.o *.d *.bak *~ gitversion.h

# Export the current git version if the index file exists, else 000...
gitversion.h:
ifneq ("$(wildcard .git/index)","")
echo "const char *gitversion = \"$(shell git rev-parse HEAD)\";" > $@
else
echo "const char *gitversion = \"0000000000000000000000000000000000000000\";" > $@
endif
13 changes: 10 additions & 3 deletions Makefile.Pi.OLED
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,19 @@ OBJECTS = \

all: MMDVMHost

MMDVMHost: $(OBJECTS)
MMDVMHost: gitversion.h $(OBJECTS)
$(CXX) $(OBJECTS) $(CFLAGS) $(LIBS) -o MMDVMHost

%.o: %.cpp
$(CXX) $(CFLAGS) -c -o $@ $<

clean:
$(RM) MMDVMHost *.o *.d *.bak *~

$(RM) MMDVMHost *.o *.d *.bak *~ gitversion.h

# Export the current git version if the index file exists, else 000...
gitversion.h:
ifneq ("$(wildcard .git/index)","")
echo "const char *gitversion = \"$(shell git rev-parse HEAD)\";" > $@
else
echo "const char *gitversion = \"0000000000000000000000000000000000000000\";" > $@
endif
12 changes: 10 additions & 2 deletions Makefile.Pi.PCF8574
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,19 @@ OBJECTS = \

all: MMDVMHost

MMDVMHost: $(OBJECTS)
MMDVMHost: gitversion.h $(OBJECTS)
$(CXX) $(OBJECTS) $(CFLAGS) $(LIBS) -o MMDVMHost

%.o: %.cpp
$(CXX) $(CFLAGS) -c -o $@ $<

clean:
$(RM) MMDVMHost *.o *.d *.bak *~
$(RM) MMDVMHost *.o *.d *.bak *~ gitversion.h

# Export the current git version if the index file exists, else 000...
gitversion.h:
ifneq ("$(wildcard .git/index)","")
echo "const char *gitversion = \"$(shell git rev-parse HEAD)\";" > $@
else
echo "const char *gitversion = \"0000000000000000000000000000000000000000\";" > $@
endif
13 changes: 10 additions & 3 deletions Makefile.Solaris
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,19 @@ OBJECTS = \

all: MMDVMHost

MMDVMHost: $(OBJECTS)
MMDVMHost: gitversion.h $(OBJECTS)
$(CXX) $(OBJECTS) $(CFLAGS) $(LIBS) -o MMDVMHost

%.o: %.cpp
$(CXX) $(CFLAGS) -c -o $@ $<

clean:
$(RM) MMDVMHost *.o *.d *.bak *~

$(RM) MMDVMHost *.o *.d *.bak *~ gitversion.h

# Export the current git version if the index file exists, else 000...
gitversion.h:
ifneq ("$(wildcard .git/index)","")
echo "const char *gitversion = \"$(shell git rev-parse HEAD)\";" > $@
else
echo "const char *gitversion = \"0000000000000000000000000000000000000000\";" > $@
endif

0 comments on commit d3377e7

Please sign in to comment.