#/bin/sh tmpfile=versionheader.tmp tmpfile2=versionheader.tmp2 echo "*************************" > $tmpfile echo " VERSION INFO" >> $tmpfile if hg status; then echo "hg summary" >> $tmpfile hg summary >> $tmpfile echo "************************" >> $tmpfile echo "hg tip" >> $tmpfile hg tip >> $tmpfile echo "************************" >> $tmpfile elif git status; then echo "************************" >> $tmpfile echo "git log -1" >> $tmpfile git log -1 >> $tmpfile echo "************************" >> $tmpfile fi sed 's/"/\\"/g' $tmpfile | sed 's/^\(.*\)$/"\1\\n"/' > $tmpfile2 echo "#pragma once" > $1 echo "#include " >> $1 echo "static std::string get_version_info() {" >> $1 echo "return std::string(" >> $1 cat $tmpfile2 >> $1 echo ");}" >> $1