You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
750 B
28 lines
750 B
GitVersion.h : FORCE
|
|
ifneq ("$(wildcard ../.git/index)","")
|
|
@echo "#pragma once" > /tmp/$@
|
|
@echo "#include <string>" >> /tmp/$@
|
|
@echo "const std::string gitversion(\"$(shell git rev-parse --short HEAD)\");" >> /tmp/$@
|
|
@echo "const std::string gitBranch(\"$(shell git branch --show-current)\");" >> /tmp/$@
|
|
else
|
|
@echo "#pragma once" > /tmp/$@
|
|
@echo "#include <string>" >> /tmp/$@
|
|
@echo "const std::string gitversion(\"0000000\");" >> /tmp/$@
|
|
@echo "const std::string gitBranch(\"UNKNOWN BRANCH\");" >> /tmp/$@
|
|
endif
|
|
@cmp -s /tmp/$@ $@; \
|
|
RETVAL=$$?; \
|
|
if [ $$RETVAL -ne 0 ]; then \
|
|
echo "Git version has changed"; \
|
|
cp -f /tmp/$@ $@; \
|
|
fi; \
|
|
rm /tmp/$@;
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
$(RM) *.o *.d GitVersion.h
|
|
|
|
.PHONY: FORCE
|
|
FORCE:
|
|
@true
|