My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

generate_version 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. #!/usr/bin/env bash
  2. #
  3. # generate_version
  4. #
  5. # Make a Version.h file to accompany CUSTOM_VERSION_FILE
  6. #
  7. DIR=${1:-"Marlin"}
  8. # MRCC3=$( git merge-base HEAD upstream/bugfix-2.0.x 2>/dev/null )
  9. # MRCC2=$( git merge-base HEAD upstream/bugfix-1.1.x 2>/dev/null )
  10. # MRCC1=$( git merge-base HEAD upstream/1.1.x 2>/dev/null )
  11. # BASE='?'
  12. # if [[ -n $MRCC3 && $MRCC3 != $MRCC2 ]]; then
  13. # BASE=bugfix-2.0.x
  14. # elif [[ -n $MRCC2 ]]; then
  15. # BASE=bugfix-1.1.x
  16. # elif [[ -n $MRCC1 ]]; then
  17. # BASE=1.1.x
  18. # fi
  19. BUILDATE=$(date '+%s')
  20. DISTDATE=$(date '+%Y-%m-%d %H:%M')
  21. BRANCH=$(git -C "${DIR}" symbolic-ref -q --short HEAD)
  22. VERSION=$(git -C "${DIR}" describe --tags --first-parent 2>/dev/null)
  23. [ -z "${BRANCH}" ] && BRANCH=$(echo "${TRAVIS_BRANCH}")
  24. [ -z "${VERSION}" ] && VERSION=$(git -C "${DIR}" describe --tags --first-parent --always 2>/dev/null)
  25. SHORT_BUILD_VERSION=$(echo "${BRANCH}")
  26. DETAILED_BUILD_VERSION=$(echo "${BRANCH}-${VERSION}")
  27. # Gets some misc options from their defaults
  28. DEFAULT_MACHINE_UUID=$(awk -F'"' \
  29. '/#define DEFAULT_MACHINE_UUID/{ print $2 }' < "${DIR}/Version.h")
  30. MACHINE_NAME=$(awk -F'"' \
  31. '/#define MACHINE_NAME/{ print $2 }' < "${DIR}/Version.h")
  32. PROTOCOL_VERSION=$(awk -F'"' \
  33. '/#define PROTOCOL_VERSION/{ print $2 }' < "${DIR}/Version.h")
  34. SOURCE_CODE_URL=$(awk -F'"' \
  35. '/#define SOURCE_CODE_URL/{ print $2 }' < "${DIR}/Version.h")
  36. WEBSITE_URL=$(awk -F'"' \
  37. '/#define WEBSITE_URL/{ print $2 }' < "${DIR}/Version.h")
  38. cat > "${DIR}/Version.h" <<EOF
  39. /**
  40. * Marlin 3D Printer Firmware
  41. * Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  42. *
  43. * Based on Sprinter and grbl.
  44. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  45. *
  46. * This program is free software: you can redistribute it and/or modify
  47. * it under the terms of the GNU General Public License as published by
  48. * the Free Software Foundation, either version 3 of the License, or
  49. * (at your option) any later version.
  50. *
  51. * This program is distributed in the hope that it will be useful,
  52. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  53. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  54. * GNU General Public License for more details.
  55. *
  56. * You should have received a copy of the GNU General Public License
  57. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  58. *
  59. */
  60. #pragma once
  61. /**
  62. * THIS FILE IS AUTOMATICALLY GENERATED DO NOT MANUALLY EDIT IT.
  63. * IT DOES NOT GET COMMITTED TO THE REPOSITORY.
  64. *
  65. * Branch: ${BRANCH}
  66. * Version: ${VERSION}
  67. */
  68. /**
  69. * Marlin release version identifier
  70. */
  71. #ifndef SHORT_BUILD_VERSION
  72. #define SHORT_BUILD_VERSION "${SHORT_BUILD_VERSION}"
  73. #endif
  74. /**
  75. * Verbose version identifier which should contain a reference to the location
  76. * from where the binary was downloaded or the source code was compiled.
  77. */
  78. #ifndef DETAILED_BUILD_VERSION
  79. #define DETAILED_BUILD_VERSION "${DETAILED_BUILD_VERSION}"
  80. #endif
  81. /**
  82. * The STRING_DISTRIBUTION_DATE represents when the binary file was built,
  83. * here we define this default string as the date where the latest release
  84. * version was tagged.
  85. */
  86. #ifndef STRING_DISTRIBUTION_DATE
  87. #define STRING_DISTRIBUTION_DATE "${DISTDATE}"
  88. #endif
  89. /**
  90. * The protocol for communication to the host. Protocol indicates communication
  91. * standards such as the use of ASCII, "echo:" and "error:" line prefixes, etc.
  92. * (Other behaviors are given by the firmware version and capabilities report.)
  93. */
  94. #ifndef PROTOCOL_VERSION
  95. #define PROTOCOL_VERSION "${PROTOCOL_VERSION}"
  96. #endif
  97. /**
  98. * Defines a generic printer name to be output to the LCD after booting Marlin.
  99. */
  100. #ifndef MACHINE_NAME
  101. #define MACHINE_NAME "${MACHINE_NAME}"
  102. #endif
  103. /**
  104. * The SOURCE_CODE_URL is the location where users will find the Marlin Source
  105. * Code which is installed on the device. In most cases —unless the manufacturer
  106. * has a distinct Github fork— the Source Code URL should just be the main
  107. * Marlin repository.
  108. */
  109. #ifndef SOURCE_CODE_URL
  110. #define SOURCE_CODE_URL "${SOURCE_CODE_URL}"
  111. #endif
  112. /**
  113. * Default generic printer UUID.
  114. */
  115. #ifndef DEFAULT_MACHINE_UUID
  116. #define DEFAULT_MACHINE_UUID "${DEFAULT_MACHINE_UUID}"
  117. #endif
  118. /**
  119. * The WEBSITE_URL is the location where users can get more information such as
  120. * documentation about a specific Marlin release.
  121. */
  122. #ifndef WEBSITE_URL
  123. #define WEBSITE_URL "${WEBSITE_URL}"
  124. #endif
  125. EOF