Added Git Version number (*NIX only)

This commit is contained in:
George Smart
2017-03-09 20:55:41 +00:00
parent 960e4d8d98
commit d3377e776c
9 changed files with 73 additions and 20 deletions

View File

@@ -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