My Marlin configs for Fabrikator Mini and CTC i3 Pro B
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.

generate_version_header_for_marlin 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/usr/bin/env bash
  2. # generate_version_header_for_marlin
  3. DIR="$1" export DIR
  4. OUTFILE="$2" export OUTFILE
  5. BUILDATE=$(date '+"%s"')
  6. DISTDATE=$(date '+"%Y-%m-%d %H:%M"')
  7. cat > "$OUTFILE" <<EOF
  8. /**
  9. * THIS FILE IS AUTOMATICALLY GENERATED DO NOT MANUALLY EDIT IT.
  10. * IT DOES NOT GET COMMITTED TO THE REPOSITORY.
  11. */
  12. #define BUILD_UNIX_DATETIME ${BUILDATE}
  13. #define STRING_DISTRIBUTION_DATE ${DISTDATE}
  14. #define PROTOCOL_VERSION "1.0"
  15. #define MACHINE_NAME "Travis CI"
  16. #define SOURCE_CODE_URL "https://github.com/MarlinFirmware/Marlin"
  17. #define DEFAULT_MACHINE_UUID "3442baa1-08ee-435b-8a10-99d185bd43b8"
  18. #define WEBSITE_URL "http://marlinfw.org"
  19. EOF
  20. ( set +e
  21. cd "$DIR"
  22. BRANCH=`git symbolic-ref -q --short HEAD`
  23. if [ "x$BRANCH" == "x" ] ; then
  24. BRANCH=""
  25. elif [ "x$BRANCH" == "xDevelopment" ] ; then
  26. BRANCH=" dev"
  27. else
  28. BRANCH=" $BRANCH"
  29. fi
  30. VERSION=`git describe --tags --first-parent 2>/dev/null`
  31. if [ "x$VERSION" != "x" ] ; then
  32. echo "#define SHORT_BUILD_VERSION \"$VERSION\"" | sed "s/-.*/$BRANCH\"/" >>"$OUTFILE"
  33. echo "#define DETAILED_BUILD_VERSION \"$VERSION\"" | sed "s/-/$BRANCH-/" >>"$OUTFILE"
  34. else
  35. VERSION=`git describe --tags --first-parent --always 2>/dev/null`
  36. echo "#define SHORT_BUILD_VERSION \"$BRANCH\"" >>"$OUTFILE"
  37. echo "#define DETAILED_BUILD_VERSION \"${BRANCH}-$VERSION\"" >>"$OUTFILE"
  38. fi
  39. )