Joey Armstrong | cb986bf | 2023-12-12 17:22:05 -0500 | [diff] [blame] | 1 | # -*- makefile -*- |
| 2 | # ----------------------------------------------------------------------- |
| 3 | # Copyright 2024 Open Networking Foundation (ONF) and the ONF Contributors |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | # |
| 17 | # SPDX-FileCopyrightText: 2024 Open Networking Foundation (ONF) and the ONF Contributors |
| 18 | # SPDX-License-Identifier: Apache-2.0 |
| 19 | # ----------------------------------------------------------------------- |
| 20 | |
| 21 | $(if $(DEBUG),$(warning ENTER)) |
| 22 | |
| 23 | ##-------------------## |
| 24 | ##---] GLOBALS [---## |
| 25 | ##-------------------### |
| 26 | # repo:voltha-protos v1.16.3 |
| 27 | # [VOL-5222] v1.21.5 |
| 28 | golang-version-upgrade ?= \ |
| 29 | $(error $(MAKE) $@: golang-version-upgrade= is required) |
| 30 | |
| 31 | ## ----------------------------------------------------------------------- |
| 32 | ## Intent: Display version of the golang interpreter. |
| 33 | ## ----------------------------------------------------------------------- |
| 34 | ## Note: |
| 35 | ## - Two versions are available: |
| 36 | ## - The first is installed on the local system |
| 37 | ## - The second is installed and access through a docker image. |
| 38 | ## ----------------------------------------------------------------------- |
| 39 | .PHONY: golang-version golang-version-help |
| 40 | golang-version: |
| 41 | |
| 42 | $(call banner-enter,$@) |
| 43 | ${GO} version |
| 44 | $(call banner-leave,$@) |
| 45 | |
| 46 | help-golang += golang-version-help |
| 47 | golang-version-help: |
| 48 | @printf ' %-33.33s %s\n' "$@" \ |
| 49 | 'Display golang interpreter version' |
| 50 | |
| 51 | ## ----------------------------------------------------------------------- |
| 52 | ## Intent: Update intrepter version to install (go.mod) |
| 53 | ## ----------------------------------------------------------------------- |
| 54 | .PHONY: golang-upgrade golang-upgrade-help |
| 55 | golang-upgrade: |
| 56 | |
| 57 | # Access early to avoid error manifestation in docker |
| 58 | @assigned_for_side_effects="$(golang-version-upgrade)" |
| 59 | |
| 60 | $(call banner-enter,$@) |
| 61 | |
| 62 | ${GO} mod edit -go $(golang-version-upgrade) |
| 63 | ${GO} version |
| 64 | |
| 65 | $(GO) mod edit -go $(golang-version-upgrade) |
| 66 | $(GO) version |
| 67 | |
| 68 | $(call banner-leave,$@) |
| 69 | |
| 70 | help-golang += golang-upgrade-help |
| 71 | golang-upgrade-help: |
| 72 | @printf ' %-33.33s %s\n' "$@" \ |
| 73 | 'Upgrade installed version of the golang interpreter (go.mod)' |
| 74 | |
| 75 | help-golang : $(help-golang) |
| 76 | |
| 77 | $(if $(DEBUG),$(warning LEAVE)) |
| 78 | |
| 79 | # [EOF] |