Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 1 | ################################################################################ |
| 2 | # |
| 3 | # pkg-versions |
| 4 | # |
| 5 | # Read VERSION.readme in the current directory to learn about the version |
| 6 | # string structure |
| 7 | # |
| 8 | ################################################################################ |
| 9 | |
| 10 | define OPENPOWER_SUBPACKAGE_VERSION |
| 11 | |
| 12 | $(2)_VERSION_FILE = $$(OPENPOWER_VERSION_DIR)/$(1).version.txt |
Deb McLemore | 6821501 | 2022-02-11 10:59:34 -0600 | [diff] [blame] | 13 | $(2)_FW_VERSION_SHORT_FILE = $$(OPENPOWER_VERSION_DIR)/$(1).fwversion_short.txt |
| 14 | $(2)_FW_VERSION_LONG_FILE = $$(OPENPOWER_VERSION_DIR)/$(1).fwversion_long.txt |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 15 | ALL_SUBPACKAGE_VERSIONS += $$($(2)_VERSION_FILE) |
| 16 | |
| 17 | ### Create subpackage patch file |
| 18 | define $(2)_OPENPOWER_PATCH_FILE |
| 19 | |
| 20 | mkdir -p "$$(OPENPOWER_VERSION_DIR)"; |
| 21 | |
| 22 | # Remove patch file to start off fresh |
| 23 | if [ -f $$(OPENPOWER_VERSION_DIR)/$(1).patch.txt ]; then \ |
| 24 | rm -rf $$(OPENPOWER_VERSION_DIR)/$(1).patch.txt; \ |
| 25 | fi |
| 26 | |
| 27 | # Check all global patch directories |
| 28 | $$(foreach path, $$(BR2_GLOBAL_PATCH_DIR),if ls $$(path)/$(1)/*.patch 2>/dev/null; then \ |
| 29 | sha512sum $$(path)/$(1)/*.patch | sha512sum | \ |
| 30 | xargs echo >> $$(OPENPOWER_VERSION_DIR)/$(1).tmp_patch.txt; fi;) |
| 31 | |
| 32 | # Check the package patch dir, $$(PKGDIR) doesn't exist when running the version rules |
| 33 | if [ -n "$$(PKGDIR)" ]; then \ |
| 34 | if ls $$(PKGDIR)*.patch 2>/dev/null; then sha512sum $$(PKGDIR)*.patch | sha512sum | \ |
| 35 | xargs echo >> $$(OPENPOWER_VERSION_DIR)/$(1).tmp_patch.txt; \ |
| 36 | fi; \ |
| 37 | else \ |
Joel Stanley | 5ab5fdb | 2016-10-31 23:10:24 +1030 | [diff] [blame] | 38 | if ls $$(BR2_EXTERNAL_OP_BUILD_PATH)/package/$(1)/*.patch 2>/dev/null; then sha512sum \ |
| 39 | $$(BR2_EXTERNAL_OP_BUILD_PATH)/package/$(1)/*.patch | sha512sum | \ |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 40 | xargs echo >> $$(OPENPOWER_VERSION_DIR)/$(1).tmp_patch.txt; \ |
| 41 | fi; \ |
| 42 | fi |
| 43 | |
Sam Mendoza-Jonas | e56617a | 2016-03-09 11:59:08 +1100 | [diff] [blame] | 44 | # If this is for linux, also check openpower/linux |
Stewart Smith | fd7a226 | 2017-02-17 17:20:54 +1100 | [diff] [blame] | 45 | if [ "LINUX" == "$(2)" ]; then \ |
Joel Stanley | 5ab5fdb | 2016-10-31 23:10:24 +1030 | [diff] [blame] | 46 | if ls $$(BR2_EXTERNAL_OP_BUILD_PATH)/$(1)/*.patch 2>/dev/null; then sha512sum \ |
| 47 | $$(BR2_EXTERNAL_OP_BUILD_PATH)/$(1)/*.patch | sha512sum | \ |
Sam Mendoza-Jonas | e56617a | 2016-03-09 11:59:08 +1100 | [diff] [blame] | 48 | xargs echo >> $$(OPENPOWER_VERSION_DIR)/$(1).tmp_patch.txt; \ |
| 49 | fi; \ |
| 50 | fi; |
| 51 | |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 52 | # Combine all the patches found in the package and global package directories |
| 53 | if [ -f $$(OPENPOWER_VERSION_DIR)/$(1).tmp_patch.txt ]; then \ |
| 54 | cat $$(OPENPOWER_VERSION_DIR)/$(1).tmp_patch.txt | sha512sum | cut -c 1-7 | \ |
| 55 | xargs echo -n > $$(OPENPOWER_VERSION_DIR)/$(1).patch.txt; \ |
| 56 | fi |
| 57 | |
| 58 | # Remove the tmp_patch file |
| 59 | if [ -f $$(OPENPOWER_VERSION_DIR)/$(1).tmp_patch.txt ]; then \ |
| 60 | rm -rf $$(OPENPOWER_VERSION_DIR)/$(1).tmp_patch.txt; \ |
| 61 | fi |
| 62 | |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 63 | endef # $(2)_OPENPOWER_PATCH_FILE |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 64 | |
| 65 | ### Create subpackage version file |
| 66 | define $(2)_OPENPOWER_VERSION_FILE |
| 67 | |
| 68 | mkdir -p "$$(OPENPOWER_VERSION_DIR)" |
| 69 | |
| 70 | # Add package name |
| 71 | echo -n " $(1)-" > $$($(2)_VERSION_FILE) |
| 72 | |
| 73 | # If site local |
| 74 | # Add site local and user, local commit, if local is dirty |
| 75 | # Else not local |
Sam Mendoza-Jonas | ddc5fab | 2016-03-11 14:37:04 +1100 | [diff] [blame] | 76 | # Add package version, extraversion if linux, op-build is dirty, op-build patches |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 77 | if [ "$$($(2)_SITE_METHOD)" == "local" ]; then \ |
| 78 | echo -n "site_local-" >> $$($(2)_VERSION_FILE); \ |
| 79 | whoami | xargs echo -n >> $$($(2)_VERSION_FILE); \ |
| 80 | echo -n "-" >> $$($(2)_VERSION_FILE); \ |
| 81 | \ |
Stewart Smith | fd7a226 | 2017-02-17 17:20:54 +1100 | [diff] [blame] | 82 | cd "$$($(2)_SITE)"; (git describe --always --dirty || echo "unknown") \ |
| 83 | |sed -e 's/$(1)-//' | xargs echo -n\ |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 84 | >> $$($(2)_VERSION_FILE); \ |
| 85 | \ |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 86 | else \ |
| 87 | \ |
| 88 | [ `echo -n $$($(2)_VERSION) | wc -c` == "40" ] && (echo -n $$($(2)_VERSION) | \ |
Stewart Smith | 93157d1 | 2015-05-14 16:01:44 +1000 | [diff] [blame] | 89 | sed "s/^\([0-9a-f]\{7\}\).*/\1/;s/$(1)-//;" >> $$($(2)_VERSION_FILE)) \ |
| 90 | || echo -n $$($(2)_VERSION) | sed -e 's/$(1)-//' >> $$($(2)_VERSION_FILE); \ |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 91 | \ |
Stewart Smith | fd7a226 | 2017-02-17 17:20:54 +1100 | [diff] [blame] | 92 | if [ "LINUX" == "$(2)" ]; then \ |
Sam Mendoza-Jonas | ddc5fab | 2016-03-11 14:37:04 +1100 | [diff] [blame] | 93 | if ls $$(BUILD_DIR)/$(1)-$$($(2)_VERSION)/Makefile 1>/dev/null; then \ |
| 94 | head $$(BUILD_DIR)/$(1)-$$($(2)_VERSION)/Makefile | grep EXTRAVERSION \ |
| 95 | | cut -d ' ' -f 3 | \ |
| 96 | xargs echo -n >> $$($(2)_VERSION_FILE); \ |
| 97 | fi; \ |
| 98 | fi; \ |
| 99 | \ |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 100 | if [ -f $$(OPENPOWER_VERSION_DIR)/$(1).patch.txt ]; then \ |
Stewart Smith | fd7a226 | 2017-02-17 17:20:54 +1100 | [diff] [blame] | 101 | echo -n "-p" >> $$($(2)_VERSION_FILE); \ |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 102 | cat $$(OPENPOWER_VERSION_DIR)/$(1).patch.txt >> $$($(2)_VERSION_FILE); fi \ |
| 103 | fi |
| 104 | |
Deb McLemore | 6821501 | 2022-02-11 10:59:34 -0600 | [diff] [blame] | 105 | # Check the package name against HOSTBOOT_P to filter out other |
| 106 | # packages such as HOSTBOOT_BINARIES, we only want HOSTBOOT_P10, HOSTBOOT_P11, etc. |
| 107 | # This allows future usage of this logic since the Hostboot repo build process |
| 108 | # seeds from this output file and does -NOT- know about package names, etc. |
| 109 | # All Hostboot repo build needs is the git hashes built which are cat'd to the |
| 110 | # _FW_VERSION_*_FILE |
| 111 | # |
| 112 | # If OPBUILD_VERSION is used in the environment then we trim |
| 113 | # the string since we are limited to 16 chars for the PELs in Hostboot. |
| 114 | # If OPBUILD_VERSION is empty we run the git commands to get the hashes. |
| 115 | # Sample OPBUILD_VERSION OP10-v2.7-10.146 gets trimmed to v2.7-10.146 |
| 116 | # sed 's/[^\-]*-//' up until first dash |
| 117 | # |
| 118 | # The *_FW_VERSION_SHORT_FILE is the FW subsystem identifier to aide |
| 119 | # mapping op-build images to proper build level. The FW subsystem |
| 120 | # string is subsequently embedded in the Hostboot images built. |
| 121 | # |
| 122 | $(if $(findstring HOSTBOOT_P, $(2)), |
| 123 | if [ -n "$$(OPBUILD_VERSION)" ]; then \ |
| 124 | echo -n "$$(OPBUILD_VERSION)" \ |
| 125 | | sed 's/[^\-]*-//' | xargs echo -n\ |
| 126 | > $$($(2)_FW_VERSION_SHORT_FILE); \ |
| 127 | else \ |
| 128 | cd "$$(BR2_EXTERNAL_OP_BUILD_PATH)"; (git describe --always || echo "unknown") \ |
| 129 | | sed -e 's/\(.*\)-.*/\1/' | xargs echo -n\ |
| 130 | > $$($(2)_FW_VERSION_SHORT_FILE); \ |
| 131 | fi\) |
| 132 | |
| 133 | # Remove with sed any empty line |
| 134 | # /./ matches any character, including newline |
| 135 | # ! negates the select, makes the command apply to lines which do -NOT- match selector, i.e. empty lines |
| 136 | # d deletes the selected lines |
| 137 | # sed `/./!d' |
| 138 | $(if $(findstring HOSTBOOT_P, $(2)), |
| 139 | cd "$$(BR2_EXTERNAL_OP_BUILD_PATH)"; (git describe --always --long || echo "unknown") \ |
| 140 | | sed '/./!d' | xargs echo -n\ |
| 141 | > $$($(2)_FW_VERSION_LONG_FILE); \) |
| 142 | |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 143 | # Add new line to version.txt |
| 144 | echo "" >> $$($(2)_VERSION_FILE); |
Deb McLemore | 6821501 | 2022-02-11 10:59:34 -0600 | [diff] [blame] | 145 | echo "" >> $$($(2)_FW_VERSION_SHORT_FILE); |
| 146 | echo "" >> $$($(2)_FW_VERSION_LONG_FILE); |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 147 | |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 148 | endef # $(2)_OPENPOWER_VERSION_FILE |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 149 | |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 150 | # Add appropriate templates to hooks if they're not there already |
| 151 | ifeq (,$$(findstring $(2)_OPENPOWER_PATCH_FILE,$$($(2)_POST_PATCH_HOOKS))) |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 152 | $(2)_POST_PATCH_HOOKS += $(2)_OPENPOWER_PATCH_FILE |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 153 | endif |
| 154 | ifeq (,$$(findstring $(2)_OPENPOWER_VERSION_FILE,$$($(2)_PRE_CONFIGURE_HOOKS))) |
Samuel Mendoza-Jonas | d38455d | 2016-07-15 16:32:18 +1000 | [diff] [blame] | 155 | $(2)_PRE_CONFIGURE_HOOKS += $(2)_OPENPOWER_VERSION_FILE |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 156 | endif |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 157 | |
| 158 | # Top-level rule to print or generate a subpackage version |
| 159 | $(1)-version: $$(if $$(wildcard $$($(2)_VERSION_FILE)),$(1)-print-version,$(1)-build-version) |
| 160 | |
| 161 | # Rule to print out subpackage version |
| 162 | $(1)-print-version: |
| 163 | @echo "=== $(2)_VERSION ===" |
| 164 | @cat $$($(2)_VERSION_FILE) | xargs echo |
| 165 | |
| 166 | # Rule to generate subpackage version |
| 167 | $(1)-build-version: |
| 168 | @echo "=== $(2)_VERSION ===" |
| 169 | @echo " Searching for patches..." |
| 170 | @$$($(2)_OPENPOWER_PATCH_FILE) |
| 171 | @echo " End of patches..."; |
| 172 | @echo " Creating version string (various output may display)..." |
| 173 | @$$($(2)_OPENPOWER_VERSION_FILE) |
| 174 | @echo " End creating version string..." |
| 175 | @echo -n " version: "; cat $$($(2)_VERSION_FILE) | xargs echo |
| 176 | |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 177 | endef # OPENPOWER_SUBPACKAGE_VERSION |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 178 | |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 179 | |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 180 | #### |
| 181 | # $(1) is the lowercase package version |
Daniel Crowell | 2aa26f3 | 2022-01-27 16:14:28 -0600 | [diff] [blame] | 182 | # $(2) is the uppercase package version |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 183 | #### |
| 184 | define INNER_OPENPOWER_VERSION |
| 185 | |
| 186 | $(2)_VERSION_FILE = $$(OPENPOWER_VERSION_DIR)/$(1).version.txt |
| 187 | ifeq ($$(BR2_PACKAGE_OPENPOWER_PNOR_P10),y) |
| 188 | UPPER_CASE_SIGN_MODE = $(call UPPERCASE,$$(BR2_OPENPOWER_P10_SECUREBOOT_SIGN_MODE)) |
| 189 | CONFIG_NAME = $$(BR2_OPENPOWER_P10_CONFIG_NAME) |
| 190 | VERSIONED_SUBPACKAGES = $$(OPENPOWER_PNOR_P10_VERSIONED_SUBPACKAGES) |
| 191 | else |
Nick Bofferding | 6fafd62 | 2017-09-28 15:23:23 -0500 | [diff] [blame] | 192 | UPPER_CASE_SIGN_MODE = $(call UPPERCASE,$$(BR2_OPENPOWER_SECUREBOOT_SIGN_MODE)) |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 193 | CONFIG_NAME = $$(BR2_OPENPOWER_CONFIG_NAME) |
| 194 | VERSIONED_SUBPACKAGES = $$(OPENPOWER_VERSIONED_SUBPACKAGES) |
| 195 | endif |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 196 | |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 197 | $$(eval $$(foreach pkg,$$(VERSIONED_SUBPACKAGES), \ |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 198 | $$(call OPENPOWER_SUBPACKAGE_VERSION,$$(pkg),$$(call UPPERCASE,$$(pkg))))) |
| 199 | |
| 200 | ### Combine subpackage files into one version file |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 201 | define $(2)_OPENPOWER_VERSION_FILE |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 202 | |
| 203 | mkdir -p "$$(OPENPOWER_VERSION_DIR)" |
| 204 | |
| 205 | # Add vendor or default open-power |
Deb McLemore | 6821501 | 2022-02-11 10:59:34 -0600 | [diff] [blame] | 206 | |
Stewart Smith | fd7a226 | 2017-02-17 17:20:54 +1100 | [diff] [blame] | 207 | if [ -n "$$(OPBUILD_VENDOR)" ]; then \ |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 208 | echo -n "$$(OPBUILD_VENDOR)-" > $$($(2)_VERSION_FILE); \ |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 209 | else \ |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 210 | echo -n "open-power-" > $$($(2)_VERSION_FILE); \ |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 211 | fi |
| 212 | |
| 213 | # Add platform or default from defconfig |
Stewart Smith | fd7a226 | 2017-02-17 17:20:54 +1100 | [diff] [blame] | 214 | if [ -n "$$(OPBUILD_PLATFORM)" ]; then \ |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 215 | echo -n "$$(OPBUILD_PLATFORM)-" >> $$($(2)_VERSION_FILE); \ |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 216 | else \ |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 217 | echo -n "$$(CONFIG_NAME)-" >> $$($(2)_VERSION_FILE); \ |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 218 | fi |
| 219 | |
| 220 | # Add op-build version |
| 221 | # Order: OPBUILD_VERSION, tag, commit, unknown |
Stewart Smith | fd7a226 | 2017-02-17 17:20:54 +1100 | [diff] [blame] | 222 | if [ -n "$$(OPBUILD_VERSION)" ]; then \ |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 223 | echo -n "$$(OPBUILD_VERSION)" >> $$($(2)_VERSION_FILE); \ |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 224 | else \ |
Stewart Smith | fd7a226 | 2017-02-17 17:20:54 +1100 | [diff] [blame] | 225 | cd "$$(BR2_EXTERNAL_OP_BUILD_PATH)"; (git describe --always --dirty || echo "unknown") \ |
| 226 | | xargs echo -n \ |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 227 | >> $$($(2)_VERSION_FILE); \ |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 228 | fi |
| 229 | |
Nick Bofferding | 6fafd62 | 2017-09-28 15:23:23 -0500 | [diff] [blame] | 230 | # Flag whether op-build is production signed |
| 231 | if [ "$$(UPPER_CASE_SIGN_MODE)" == 'PRODUCTION' ]; then \ |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 232 | echo -n "-prod" >> $$($(2)_VERSION_FILE); \ |
Nick Bofferding | 6fafd62 | 2017-09-28 15:23:23 -0500 | [diff] [blame] | 233 | fi |
| 234 | |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 235 | # Add new line to $$($(2)_VERSION_FILE) |
| 236 | echo "" >> $$($(2)_VERSION_FILE); |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 237 | |
Sam Mendoza-Jonas | dc7e238 | 2016-03-09 16:13:02 +1100 | [diff] [blame] | 238 | # Add a specific line for op-build if it has been overwritten |
Stewart Smith | fd7a226 | 2017-02-17 17:20:54 +1100 | [diff] [blame] | 239 | if [ -n "$$(OPBUILD_VENDOR)" ]; then \ |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 240 | echo -n " op-build-" >> $$($(2)_VERSION_FILE); \ |
Stewart Smith | fd7a226 | 2017-02-17 17:20:54 +1100 | [diff] [blame] | 241 | (cd "$$(BR2_EXTERNAL_OP_BUILD_PATH)"; (git describe --always --dirty || echo "unknown")) \ |
| 242 | | xargs echo \ |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 243 | >> $$($(2)_VERSION_FILE); \ |
Sam Mendoza-Jonas | dc7e238 | 2016-03-09 16:13:02 +1100 | [diff] [blame] | 244 | fi |
| 245 | |
| 246 | # Include the currently checked-out buildroot version |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 247 | echo -n " buildroot-" >> $$($(2)_VERSION_FILE); |
Stewart Smith | fd7a226 | 2017-02-17 17:20:54 +1100 | [diff] [blame] | 248 | (git describe --always --dirty || echo "unknown") \ |
| 249 | | xargs echo \ |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 250 | >> $$($(2)_VERSION_FILE); \ |
Sam Mendoza-Jonas | dc7e238 | 2016-03-09 16:13:02 +1100 | [diff] [blame] | 251 | |
Daniel Crowell | 2aa26f3 | 2022-01-27 16:14:28 -0600 | [diff] [blame] | 252 | # Include the named pnor build name if there is one |
| 253 | if [ -n "$$(OPBUILD_BUILDNAME)" ]; then \ |
| 254 | echo -n " op-build-buildname-" >> $$($(2)_VERSION_FILE); \ |
| 255 | echo $$(OPBUILD_BUILDNAME) >> $$($(2)_VERSION_FILE); \ |
| 256 | fi |
Sam Mendoza-Jonas | dc7e238 | 2016-03-09 16:13:02 +1100 | [diff] [blame] | 257 | |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 258 | # Combing subpackage version files into $$($(2)_VERSION_FILE) |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 259 | $$(foreach verFile,$$(ALL_SUBPACKAGE_VERSIONS), |
| 260 | if [ -f $$(verFile) ]; then cat $$(verFile) \ |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 261 | >>$$($(2)_VERSION_FILE); fi ) |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 262 | |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 263 | endef # $(2)_OPENPOWER_VERSION_FILE |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 264 | |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 265 | $(2)_PRE_BUILD_HOOKS += $(2)_OPENPOWER_VERSION_FILE |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 266 | |
| 267 | # Top-level rule to print or generate openpower-pnor version |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 268 | $(1)-version: $$(if $$(wildcard $$($(2)_VERSION_FILE)),$(1)-print-version,$(1)-build-version) |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 269 | |
| 270 | # Rule to print out pnor version |
| 271 | $(1)-print-version: |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 272 | @echo "=== $(2)_VERSION ===" |
| 273 | @cat $$($(2)_VERSION_FILE) |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 274 | @echo ""; echo "**See openpower/package/VERSION.readme for detailed info on package strings"; echo "" |
| 275 | |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 276 | # Rule to generate pnor version |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 277 | $(1)-build-version: $$(foreach pkg,$$(VERSIONED_SUBPACKAGES), $$(pkg)-version) |
| 278 | @$$($(2)_OPENPOWER_VERSION_FILE) |
| 279 | @echo "=== $(2)_VERSION ===" |
| 280 | @cat $$($(2)_VERSION_FILE) |
Stephen Cprek | e7254c7 | 2015-02-19 14:33:38 -0600 | [diff] [blame] | 281 | @echo ""; echo "**See openpower/package/VERSION.readme for detailed info on package strings"; echo "" |
| 282 | |
Stephen Cprek | ded98fb | 2015-04-15 17:11:52 -0500 | [diff] [blame] | 283 | # Rule to force re-generation of all versioned subpackages |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 284 | $(1)-build-version-all: $$(foreach pkg,$$(VERSIONED_SUBPACKAGES), $$(pkg)-build-version) |
| 285 | @$$($(2)_OPENPOWER_VERSION_FILE) |
| 286 | @echo "=== $(2)_VERSION ===" |
| 287 | @cat $$($(2)_VERSION_FILE) |
Stephen Cprek | ded98fb | 2015-04-15 17:11:52 -0500 | [diff] [blame] | 288 | @echo ""; echo "**See openpower/package/VERSION.readme for detailed info on package strings"; echo "" |
| 289 | |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 290 | endef # INNER_OPENPOWER_VERSION |
| 291 | |
| 292 | OPENPOWER_VERSION = $(call INNER_OPENPOWER_VERSION,$(pkgname),$(call UPPERCASE,$(pkgname))) |
| 293 | |