Joey Armstrong | 811e954 | 2022-12-25 21:45:27 -0500 | [diff] [blame] | 1 | # -*- makefile -*- |
| 2 | # -----------------------------------------------------------------------# |
Joey Armstrong | 7a9af44 | 2024-01-03 19:26:36 -0500 | [diff] [blame] | 3 | # Copyright 2016-2024 Open Networking Foundation (ONF) and the ONF Contributors |
Joey Armstrong | 393daca | 2023-07-06 08:47:54 -0400 | [diff] [blame] | 4 | # |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 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. |
Joey Armstrong | 811e954 | 2022-12-25 21:45:27 -0500 | [diff] [blame] | 16 | # ----------------------------------------------------------------------- |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 17 | |
Joey Armstrong | 393daca | 2023-07-06 08:47:54 -0400 | [diff] [blame] | 18 | $(if $(DEBUG),$(warning ENTER)) |
| 19 | |
Joey Armstrong | 1a78c6c | 2024-05-03 18:55:00 -0400 | [diff] [blame^] | 20 | ##-------------------## |
| 21 | ##---] GLOBALS [---## |
| 22 | ##-------------------## |
| 23 | ifndef .DEFAULT_GOAL |
| 24 | .DEFAULT_GOAL := help # ?= help evaluated late |
| 25 | endif |
| 26 | MAKECMDGOALS ?= help |
Joey Armstrong | 811e954 | 2022-12-25 21:45:27 -0500 | [diff] [blame] | 27 | |
Joey Armstrong | 1a78c6c | 2024-05-03 18:55:00 -0400 | [diff] [blame^] | 28 | $(if $(findstring disabled-joey,$(USER)),\ |
| 29 | $(eval USE_LF_MK := 1)) # special snowflake |
Joey Armstrong | 811e954 | 2022-12-25 21:45:27 -0500 | [diff] [blame] | 30 | |
| 31 | ##--------------------## |
| 32 | ##---] INCLUDES [---## |
| 33 | ##--------------------## |
Joey Armstrong | 1a78c6c | 2024-05-03 18:55:00 -0400 | [diff] [blame^] | 34 | ifdef USE_LF_MK |
| 35 | include lf/include.mk |
| 36 | else |
| 37 | include lf/transition.mk |
| 38 | endif # ifdef USE_LF_MK |
Kent Hagerman | 074d0e0 | 2019-04-24 17:58:16 -0400 | [diff] [blame] | 39 | |
Zack Williams | 27f59a4 | 2019-05-10 09:12:07 -0700 | [diff] [blame] | 40 | # Variables |
Kent Hagerman | f4a3aab | 2019-05-22 14:42:34 -0400 | [diff] [blame] | 41 | VERSION ?= $(shell cat ./VERSION) |
Zack Williams | 27f59a4 | 2019-05-10 09:12:07 -0700 | [diff] [blame] | 42 | |
Maninder | 9a1bc0d | 2020-10-26 11:34:02 +0530 | [diff] [blame] | 43 | # Packages |
| 44 | PACKAGES = $(shell go list ./...) |
| 45 | |
Kent Hagerman | f4a3aab | 2019-05-22 14:42:34 -0400 | [diff] [blame] | 46 | DOCKER_LABEL_VCS_DIRTY = false |
| 47 | ifneq ($(shell git ls-files --others --modified --exclude-standard 2>/dev/null | wc -l | sed -e 's/ //g'),0) |
| 48 | DOCKER_LABEL_VCS_DIRTY = true |
| 49 | endif |
Joey Armstrong | 811e954 | 2022-12-25 21:45:27 -0500 | [diff] [blame] | 50 | |
Matt Jeanneret | 2e3051a | 2019-05-11 15:01:46 -0400 | [diff] [blame] | 51 | ## Docker related |
David K. Bainbridge | e14914d | 2019-05-24 13:43:05 -0700 | [diff] [blame] | 52 | DOCKER_EXTRA_ARGS ?= |
Kent Hagerman | f4a3aab | 2019-05-22 14:42:34 -0400 | [diff] [blame] | 53 | DOCKER_REGISTRY ?= |
| 54 | DOCKER_REPOSITORY ?= |
| 55 | DOCKER_TAG ?= ${VERSION}$(shell [[ ${DOCKER_LABEL_VCS_DIRTY} == "true" ]] && echo "-dirty" || true) |
David K. Bainbridge | 4183514 | 2021-04-01 17:26:12 +0000 | [diff] [blame] | 56 | DOCKER_TARGET ?= prod |
Kent Hagerman | f4a3aab | 2019-05-22 14:42:34 -0400 | [diff] [blame] | 57 | RWCORE_IMAGENAME := ${DOCKER_REGISTRY}${DOCKER_REPOSITORY}voltha-rw-core |
Andrea Campanella | 7a6cce2 | 2019-12-17 14:10:27 -0800 | [diff] [blame] | 58 | TYPE ?= minimal |
Matt Jeanneret | 2e3051a | 2019-05-11 15:01:46 -0400 | [diff] [blame] | 59 | |
| 60 | ## Docker labels. Only set ref and commit date if committed |
Kent Hagerman | f4a3aab | 2019-05-22 14:42:34 -0400 | [diff] [blame] | 61 | DOCKER_LABEL_VCS_URL ?= $(shell git remote get-url $(shell git remote)) |
| 62 | DOCKER_LABEL_VCS_REF = $(shell git rev-parse HEAD) |
| 63 | DOCKER_LABEL_BUILD_DATE ?= $(shell date -u "+%Y-%m-%dT%H:%M:%SZ") |
| 64 | DOCKER_LABEL_COMMIT_DATE = $(shell git show -s --format=%cd --date=iso-strict HEAD) |
Matt Jeanneret | 2e3051a | 2019-05-11 15:01:46 -0400 | [diff] [blame] | 65 | |
Kent Hagerman | f4a3aab | 2019-05-22 14:42:34 -0400 | [diff] [blame] | 66 | DOCKER_BUILD_ARGS ?= \ |
David K. Bainbridge | e14914d | 2019-05-24 13:43:05 -0700 | [diff] [blame] | 67 | ${DOCKER_EXTRA_ARGS} \ |
Kent Hagerman | f4a3aab | 2019-05-22 14:42:34 -0400 | [diff] [blame] | 68 | --build-arg org_label_schema_version="${VERSION}" \ |
| 69 | --build-arg org_label_schema_vcs_url="${DOCKER_LABEL_VCS_URL}" \ |
| 70 | --build-arg org_label_schema_vcs_ref="${DOCKER_LABEL_VCS_REF}" \ |
| 71 | --build-arg org_label_schema_build_date="${DOCKER_LABEL_BUILD_DATE}" \ |
| 72 | --build-arg org_opencord_vcs_commit_date="${DOCKER_LABEL_COMMIT_DATE}" \ |
| 73 | --build-arg org_opencord_vcs_dirty="${DOCKER_LABEL_VCS_DIRTY}" |
| 74 | |
| 75 | DOCKER_BUILD_ARGS_LOCAL ?= ${DOCKER_BUILD_ARGS} \ |
Kent Hagerman | f4a3aab | 2019-05-22 14:42:34 -0400 | [diff] [blame] | 76 | --build-arg LOCAL_PROTOS=${LOCAL_PROTOS} |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 77 | |
David K. Bainbridge | 4183514 | 2021-04-01 17:26:12 +0000 | [diff] [blame] | 78 | .PHONY: docker-build local-protos local-lib-go help |
| 79 | .DEFAULT_GOAL := help |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 80 | |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 81 | |
David K. Bainbridge | 1678e19 | 2019-05-17 11:48:29 -0700 | [diff] [blame] | 82 | ## Local Development Helpers |
David K. Bainbridge | 4183514 | 2021-04-01 17:26:12 +0000 | [diff] [blame] | 83 | local-protos: ## Copies a local version of the voltha-protos dependency into the vendor directory |
David K. Bainbridge | 1678e19 | 2019-05-17 11:48:29 -0700 | [diff] [blame] | 84 | ifdef LOCAL_PROTOS |
Joey Armstrong | 393daca | 2023-07-06 08:47:54 -0400 | [diff] [blame] | 85 | $(RM) -r vendor/github.com/opencord/voltha-protos/v5/go |
khenaidoo | d948f77 | 2021-08-11 17:49:24 -0400 | [diff] [blame] | 86 | mkdir -p vendor/github.com/opencord/voltha-protos/v5/go |
| 87 | cp -r ${LOCAL_PROTOS}/go/* vendor/github.com/opencord/voltha-protos/v5/go |
David K. Bainbridge | 1678e19 | 2019-05-17 11:48:29 -0700 | [diff] [blame] | 88 | endif |
| 89 | |
Scott Baker | cb7c88a | 2019-10-16 18:32:48 -0700 | [diff] [blame] | 90 | ## Local Development Helpers |
David K. Bainbridge | 4183514 | 2021-04-01 17:26:12 +0000 | [diff] [blame] | 91 | local-lib-go: ## Copies a local version of the voltha-lib-go dependency into the vendor directory |
Scott Baker | cb7c88a | 2019-10-16 18:32:48 -0700 | [diff] [blame] | 92 | ifdef LOCAL_LIB_GO |
Joey Armstrong | 393daca | 2023-07-06 08:47:54 -0400 | [diff] [blame] | 93 | $(RM) -r vendor/github.com/opencord/voltha-lib-go/v7/pkg |
khenaidoo | d948f77 | 2021-08-11 17:49:24 -0400 | [diff] [blame] | 94 | mkdir -p vendor/github.com/opencord/voltha-lib-go/v7/pkg |
| 95 | cp -r ${LOCAL_LIB_GO}/pkg/* vendor/github.com/opencord/voltha-lib-go/v7/pkg/ |
Scott Baker | cb7c88a | 2019-10-16 18:32:48 -0700 | [diff] [blame] | 96 | endif |
| 97 | |
Joey Armstrong | 811e954 | 2022-12-25 21:45:27 -0500 | [diff] [blame] | 98 | ## ----------------------------------------------------------------------- |
Matt Jeanneret | 2e3051a | 2019-05-11 15:01:46 -0400 | [diff] [blame] | 99 | ## Docker targets |
Joey Armstrong | 811e954 | 2022-12-25 21:45:27 -0500 | [diff] [blame] | 100 | ## ----------------------------------------------------------------------- |
David K. Bainbridge | 4183514 | 2021-04-01 17:26:12 +0000 | [diff] [blame] | 101 | build: docker-build ## Alias for 'docker-build' |
khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame] | 102 | |
Joey Armstrong | 811e954 | 2022-12-25 21:45:27 -0500 | [diff] [blame] | 103 | docker-build-args += --debug |
| 104 | docker-build-args += --log-level 'debug' |
| 105 | docker-build-args := $(null)# comment line for debug mode |
| 106 | |
David K. Bainbridge | 4183514 | 2021-04-01 17:26:12 +0000 | [diff] [blame] | 107 | docker-build: local-protos local-lib-go ## Build core docker image (set BUILD_PROFILED=true to also build the profiled image) |
Joey Armstrong | 393daca | 2023-07-06 08:47:54 -0400 | [diff] [blame] | 108 | |
| 109 | $(call banner-enter,$@) |
| 110 | $(MAKE) --no-print-directory test-coverage-init |
Joey Armstrong | 811e954 | 2022-12-25 21:45:27 -0500 | [diff] [blame] | 111 | |
| 112 | docker $(docker-build-args) build $(DOCKER_BUILD_ARGS) -t ${RWCORE_IMAGENAME}:${DOCKER_TAG} --target ${DOCKER_TARGET} -f docker/Dockerfile.rw_core . |
Matteo Scandolo | 450933a | 2020-04-30 07:47:08 -0700 | [diff] [blame] | 113 | ifdef BUILD_PROFILED |
Andrea Campanella | 8d4f3e3 | 2021-04-13 10:02:03 +0200 | [diff] [blame] | 114 | # Force target to dev as profile build must be built with dynamic linking |
| 115 | docker build $(DOCKER_BUILD_ARGS) --target dev --build-arg EXTRA_GO_BUILD_TAGS="-tags profile" --build-arg CGO_PARAMETER="CGO_ENABLED=1" -t ${RWCORE_IMAGENAME}:${DOCKER_TAG}-profile -f docker/Dockerfile.rw_core . |
Matteo Scandolo | 450933a | 2020-04-30 07:47:08 -0700 | [diff] [blame] | 116 | endif |
David K. Bainbridge | 3768fde | 2020-07-29 21:15:35 -0700 | [diff] [blame] | 117 | ifdef BUILD_RACE |
Andrea Campanella | 8d4f3e3 | 2021-04-13 10:02:03 +0200 | [diff] [blame] | 118 | # Force target to dev as race detection build must be built with dynamic linking |
| 119 | docker build $(DOCKER_BUILD_ARGS) --target dev --build-arg GOLANG_IMAGE=golang:1.13.8-buster --build-arg CGO_PARAMETER="CGO_ENABLED=1" --build-arg DEPLOY_IMAGE=debian:buster-slim --build-arg EXTRA_GO_BUILD_TAGS="--race" -t ${RWCORE_IMAGENAME}:${DOCKER_TAG}-rd -f docker/Dockerfile.rw_core . |
David K. Bainbridge | 3768fde | 2020-07-29 21:15:35 -0700 | [diff] [blame] | 120 | endif |
Don Newton | 8eca462 | 2020-02-10 16:44:48 -0500 | [diff] [blame] | 121 | |
Joey Armstrong | 393daca | 2023-07-06 08:47:54 -0400 | [diff] [blame] | 122 | $(call banner-leave,$@) |
| 123 | |
Joey Armstrong | 811e954 | 2022-12-25 21:45:27 -0500 | [diff] [blame] | 124 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 5f51f2e | 2023-01-17 17:06:26 -0500 | [diff] [blame] | 125 | ## Intent: |
Joey Armstrong | 811e954 | 2022-12-25 21:45:27 -0500 | [diff] [blame] | 126 | ## ----------------------------------------------------------------------- |
David K. Bainbridge | 4183514 | 2021-04-01 17:26:12 +0000 | [diff] [blame] | 127 | docker-push: ## Push the docker images to an external repository |
Joey Armstrong | 393daca | 2023-07-06 08:47:54 -0400 | [diff] [blame] | 128 | |
| 129 | $(call banner-enter,$@) |
| 130 | |
Jan Klare | 07d5bb1 | 2023-11-01 14:55:42 +0100 | [diff] [blame] | 131 | docker push ${RWCORE_IMAGENAME}:${DOCKER_TAG} |
Matteo Scandolo | 8ed186a | 2020-05-04 10:52:42 -0700 | [diff] [blame] | 132 | ifdef BUILD_PROFILED |
| 133 | docker push ${RWCORE_IMAGENAME}:${DOCKER_TAG}-profile |
| 134 | endif |
David K. Bainbridge | 3768fde | 2020-07-29 21:15:35 -0700 | [diff] [blame] | 135 | ifdef BUILD_RACE |
| 136 | docker push ${RWCORE_IMAGENAME}:${DOCKER_TAG}-rd |
| 137 | endif |
David K. Bainbridge | 4183514 | 2021-04-01 17:26:12 +0000 | [diff] [blame] | 138 | docker-kind-load: ## Load docker images into a KinD cluster |
Andrea Campanella | 7a6cce2 | 2019-12-17 14:10:27 -0800 | [diff] [blame] | 139 | @if [ "`kind get clusters | grep voltha-$(TYPE)`" = '' ]; then echo "no voltha-$(TYPE) cluster found" && exit 1; fi |
| 140 | kind load docker-image ${RWCORE_IMAGENAME}:${DOCKER_TAG} --name=voltha-$(TYPE) --nodes $(shell kubectl get nodes --template='{{range .items}}{{.metadata.name}},{{end}}' | rev | cut -c 2- | rev) |
Andrea Campanella | 7a6cce2 | 2019-12-17 14:10:27 -0800 | [diff] [blame] | 141 | |
Joey Armstrong | 393daca | 2023-07-06 08:47:54 -0400 | [diff] [blame] | 142 | $(call banner-leave,$@) |
| 143 | |
| 144 | ## ----------------------------------------------------------------------- |
Matt Jeanneret | 2e3051a | 2019-05-11 15:01:46 -0400 | [diff] [blame] | 145 | ## lint and unit tests |
Joey Armstrong | 393daca | 2023-07-06 08:47:54 -0400 | [diff] [blame] | 146 | ## ----------------------------------------------------------------------- |
| 147 | |
| 148 | # [TODO] |
| 149 | # o Merge lint-* targets with repo:openolt-adapter/Makefile |
khenaidoo | d2b6df9 | 2018-12-13 16:37:20 -0500 | [diff] [blame] | 150 | |
David K. Bainbridge | 4183514 | 2021-04-01 17:26:12 +0000 | [diff] [blame] | 151 | lint-dockerfile: ## Perform static analysis on Dockerfile |
Kent Hagerman | dcd4dcc | 2020-02-25 17:56:17 -0500 | [diff] [blame] | 152 | @echo "Running Dockerfile lint check..." |
Kent Hagerman | 812b257 | 2020-01-28 11:57:51 -0500 | [diff] [blame] | 153 | @${HADOLINT} $$(find . -name "Dockerfile.*") |
David Bainbridge | 5f3619c | 2019-07-10 22:51:09 +0000 | [diff] [blame] | 154 | @echo "Dockerfile lint check OK" |
| 155 | |
David K. Bainbridge | 4183514 | 2021-04-01 17:26:12 +0000 | [diff] [blame] | 156 | lint-mod: ## Verify the Go dependencies |
Kent Hagerman | ca4c51e | 2019-05-02 12:28:55 -0400 | [diff] [blame] | 157 | @echo "Running dependency check..." |
Kent Hagerman | 812b257 | 2020-01-28 11:57:51 -0500 | [diff] [blame] | 158 | @${GO} mod verify |
Scott Baker | e4c2a98 | 2019-11-21 16:32:03 -0800 | [diff] [blame] | 159 | @echo "Dependency check OK. Running vendor check..." |
| 160 | @git status > /dev/null |
Kent Hagerman | dcd4dcc | 2020-02-25 17:56:17 -0500 | [diff] [blame] | 161 | @git diff-index --quiet HEAD -- go.mod go.sum vendor || (echo "ERROR: Staged or modified files must be committed before running this test" && git status -- go.mod go.sum vendor && exit 1) |
| 162 | @[[ `git ls-files --exclude-standard --others go.mod go.sum vendor` == "" ]] || (echo "ERROR: Untracked files must be cleaned up before running this test" && git status -- go.mod go.sum vendor && exit 1) |
Joey Armstrong | 811e954 | 2022-12-25 21:45:27 -0500 | [diff] [blame] | 163 | |
Joey Armstrong | 653504f | 2024-01-18 12:58:56 -0500 | [diff] [blame] | 164 | $(HIDE)$(MAKE) --no-print-directory mod-update |
Joey Armstrong | 811e954 | 2022-12-25 21:45:27 -0500 | [diff] [blame] | 165 | |
Scott Baker | e4c2a98 | 2019-11-21 16:32:03 -0800 | [diff] [blame] | 166 | @git status > /dev/null |
Kent Hagerman | dcd4dcc | 2020-02-25 17:56:17 -0500 | [diff] [blame] | 167 | @git diff-index --quiet HEAD -- go.mod go.sum vendor || (echo "ERROR: Modified files detected after running go mod tidy / go mod vendor" && git status -- go.mod go.sum vendor && git checkout -- go.mod go.sum vendor && exit 1) |
| 168 | @[[ `git ls-files --exclude-standard --others go.mod go.sum vendor` == "" ]] || (echo "ERROR: Untracked files detected after running go mod tidy / go mod vendor" && git status -- go.mod go.sum vendor && git checkout -- go.mod go.sum vendor && exit 1) |
Scott Baker | e4c2a98 | 2019-11-21 16:32:03 -0800 | [diff] [blame] | 169 | @echo "Vendor check OK." |
| 170 | |
Joey Armstrong | 811e954 | 2022-12-25 21:45:27 -0500 | [diff] [blame] | 171 | ## ----------------------------------------------------------------------- |
| 172 | ## ----------------------------------------------------------------------- |
David K. Bainbridge | 4183514 | 2021-04-01 17:26:12 +0000 | [diff] [blame] | 173 | lint: lint-mod lint-dockerfile ## Run all lint targets |
Kent Hagerman | 074d0e0 | 2019-04-24 17:58:16 -0400 | [diff] [blame] | 174 | |
Joey Armstrong | 1a78c6c | 2024-05-03 18:55:00 -0400 | [diff] [blame^] | 175 | include $(legacy-mk)/analysis/include.mk |
Scott Baker | 18ea5a4 | 2019-10-15 16:08:42 -0700 | [diff] [blame] | 176 | |
Joey Armstrong | 811e954 | 2022-12-25 21:45:27 -0500 | [diff] [blame] | 177 | ## ----------------------------------------------------------------------- |
| 178 | ## ----------------------------------------------------------------------- |
| 179 | tests-dir := ./tests/results |
| 180 | tests-coverage := $(tests-dir)/go-test-coverage |
| 181 | tests-results := $(tests-dir)/go-test-results |
Joey Armstrong | 393daca | 2023-07-06 08:47:54 -0400 | [diff] [blame] | 182 | |
| 183 | test :: test-coverage ## Run unit tests |
| 184 | test-coverage : local-lib-go |
Kent Hagerman | 074d0e0 | 2019-04-24 17:58:16 -0400 | [diff] [blame] | 185 | |
Joey Armstrong | 367d76b | 2023-06-08 17:16:46 -0400 | [diff] [blame] | 186 | clean :: distclean ## Removes any local filesystem artifacts generated by a build |
David K. Bainbridge | 1678e19 | 2019-05-17 11:48:29 -0700 | [diff] [blame] | 187 | |
Joey Armstrong | 367d76b | 2023-06-08 17:16:46 -0400 | [diff] [blame] | 188 | distclean sterile :: ## Removes any local filesystem artifacts generated by a build or test run |
Joey Armstrong | 811e954 | 2022-12-25 21:45:27 -0500 | [diff] [blame] | 189 | $(RM) -r ./sca-report |
David K. Bainbridge | 1678e19 | 2019-05-17 11:48:29 -0700 | [diff] [blame] | 190 | |
Joey Armstrong | 1a78c6c | 2024-05-03 18:55:00 -0400 | [diff] [blame^] | 191 | fmt: ## Formats the source code to go best practice style |
Joey Armstrong | 7a9af44 | 2024-01-03 19:26:36 -0500 | [diff] [blame] | 192 | gofmt -s -e -w $(PACKAGES) |
| 193 | # @go fmt ${PACKAGES} |
David K. Bainbridge | 4183514 | 2021-04-01 17:26:12 +0000 | [diff] [blame] | 194 | |
Joey Armstrong | 653504f | 2024-01-18 12:58:56 -0500 | [diff] [blame] | 195 | |
Joey Armstrong | 393daca | 2023-07-06 08:47:54 -0400 | [diff] [blame] | 196 | ## ----------------------------------------------------------------------- |
| 197 | ## ----------------------------------------------------------------------- |
| 198 | .PHONY: mod-update |
Joey Armstrong | 653504f | 2024-01-18 12:58:56 -0500 | [diff] [blame] | 199 | mod-update: go-version mod-tidy mod-vendor |
| 200 | |
| 201 | ## ----------------------------------------------------------------------- |
| 202 | ## ----------------------------------------------------------------------- |
| 203 | .PHONY: go-version |
| 204 | go-version : |
| 205 | $(call banner-enter,Target $@) |
| 206 | ${GO} version |
| 207 | $(call banner-leave,Target $@) |
Joey Armstrong | 393daca | 2023-07-06 08:47:54 -0400 | [diff] [blame] | 208 | |
| 209 | ## ----------------------------------------------------------------------- |
| 210 | ## ----------------------------------------------------------------------- |
| 211 | .PHONY: mod-tidy |
Joey Armstrong | 653504f | 2024-01-18 12:58:56 -0500 | [diff] [blame] | 212 | mod-tidy : |
| 213 | $(call banner-enter,Target $@) |
Joey Armstrong | 393daca | 2023-07-06 08:47:54 -0400 | [diff] [blame] | 214 | ${GO} mod tidy |
Joey Armstrong | 653504f | 2024-01-18 12:58:56 -0500 | [diff] [blame] | 215 | $(call banner-leave,Target $@) |
Joey Armstrong | 393daca | 2023-07-06 08:47:54 -0400 | [diff] [blame] | 216 | |
| 217 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 393daca | 2023-07-06 08:47:54 -0400 | [diff] [blame] | 218 | ## ----------------------------------------------------------------------- |
| 219 | .PHONY: mod-vendor |
Joey Armstrong | 653504f | 2024-01-18 12:58:56 -0500 | [diff] [blame] | 220 | mod-vendor : mod-tidy |
| 221 | mod-vendor : |
| 222 | $(call banner-enter,Target $@) |
| 223 | $(if $(LOCAL_FIX_PERMS),chmod o+w $(CURDIR)) |
Joey Armstrong | 393daca | 2023-07-06 08:47:54 -0400 | [diff] [blame] | 224 | ${GO} mod vendor |
Joey Armstrong | 653504f | 2024-01-18 12:58:56 -0500 | [diff] [blame] | 225 | $(if $(LOCAL_FIX_PERMS),chmod o-w $(CURDIR)) |
| 226 | $(call banner-leave,Target $@) |
Joey Armstrong | 393daca | 2023-07-06 08:47:54 -0400 | [diff] [blame] | 227 | |
| 228 | ## ----------------------------------------------------------------------- |
| 229 | ## ----------------------------------------------------------------------- |
| 230 | help :: |
| 231 | @echo '[MOD UPDATE]' |
| 232 | @echo ' mod-update' |
| 233 | @echo ' LOCAL_FIX_PERMS=1 Hack to fix docker filesystem access problems' |
| 234 | @echo ' mod-tidy' |
| 235 | @echo ' mod-vendor' |
Joey Armstrong | 811e954 | 2022-12-25 21:45:27 -0500 | [diff] [blame] | 236 | |
| 237 | ## --------------------------------------------------------------------------- |
David K. Bainbridge | 4183514 | 2021-04-01 17:26:12 +0000 | [diff] [blame] | 238 | # For each makefile target, add ## <description> on the target line and it will be listed by 'make help' |
Joey Armstrong | 811e954 | 2022-12-25 21:45:27 -0500 | [diff] [blame] | 239 | ## --------------------------------------------------------------------------- |
Joey Armstrong | 367d76b | 2023-06-08 17:16:46 -0400 | [diff] [blame] | 240 | help :: ## Print help for each Makefile target |
Joey Armstrong | 7a9af44 | 2024-01-03 19:26:36 -0500 | [diff] [blame] | 241 | @echo 'Usage: make [options] [target] ...' |
| 242 | @printf ' %-33.33s %s\n' 'fmt' 'Run gofmt -s -e -w to normalize syntax' |
Joey Armstrong | 811e954 | 2022-12-25 21:45:27 -0500 | [diff] [blame] | 243 | @echo " help This message" |
| 244 | @echo " todo Future enhancements" |
| 245 | @echo " versions Display version-by-tool used while building" |
| 246 | ifdef VERBOSE |
David K. Bainbridge | 4183514 | 2021-04-01 17:26:12 +0000 | [diff] [blame] | 247 | @echo |
Joey Armstrong | 811e954 | 2022-12-25 21:45:27 -0500 | [diff] [blame] | 248 | endif |
| 249 | @echo |
| 250 | @grep --no-filename '^[[:alpha:]_-]*:.* ##' $(MAKEFILE_LIST) \ |
| 251 | | sort \ |
| 252 | | awk 'BEGIN {FS=":.* ## "}; {printf "%-25s : %s\n", $$1, $$2};' |
| 253 | |
Joey Armstrong | 393daca | 2023-07-06 08:47:54 -0400 | [diff] [blame] | 254 | $(if $(DEBUG),$(warning LEAVE)) |
| 255 | |
Joey Armstrong | 811e954 | 2022-12-25 21:45:27 -0500 | [diff] [blame] | 256 | # [EOF] |