DIR=${1:-“Marlin”}
BUILDATE=$(date ‘+%s’) DISTDATE=$(date ‘+%Y-%m-%d %H:%M’)
BRANCH=$(git -C “${DIR}” symbolic-ref -q --short HEAD) VERSION=$(git -C “${DIR}” describe --tags --first-parent 2>/dev/null)
[ -z “${BRANCH}” ] && BRANCH=$(echo “${TRAVIS_BRANCH}“) [ -z “${VERSION}” ] && VERSION=$(git -C “${DIR}” describe --tags --first-parent --always 2>/dev/null)
SHORT_BUILD_VERSION=$(echo “${BRANCH}”) DETAILED_BUILD_VERSION=$(echo “${BRANCH}-${VERSION}”)
DEFAULT_MACHINE_UUID=$(awk -F’“’ \ ‘/#define DEFAULT_MACHINE_UUID/{ print $2 }’ < “${DIR}/Version.h”) MACHINE_NAME=$(awk -F’“’ \ ‘/#define MACHINE_NAME/{ print $2 }’ < “${DIR}/Version.h”) PROTOCOL_VERSION=$(awk -F’“’ \ ‘/#define PROTOCOL_VERSION/{ print $2 }’ < “${DIR}/Version.h”) SOURCE_CODE_URL=$(awk -F’“’ \ ‘/#define SOURCE_CODE_URL/{ print $2 }’ < “${DIR}/Version.h”) WEBSITE_URL=$(awk -F’“’ \ ‘/#define WEBSITE_URL/{ print $2 }’ < “${DIR}/Version.h”)
cat > “${DIR}/Version.h” <<EOF /**
along with this program. If not, see http://www.gnu.org/licenses/. * */
/**
/**
Marlin release version identifier */
/**
from where the binary was downloaded or the source code was compiled. */
/**
version was tagged. */
/**
(Other behaviors are given by the firmware version and capabilities report.) */
/**
Defines a generic printer name to be output to the LCD after booting Marlin. */
/**
Marlin repository. */
/**
Default generic printer UUID. */
/**
documentation about a specific Marlin release. */
EOF