My Marlin configs for Fabrikator Mini and CTC i3 Pro B
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

generate_version 4.1KB

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