Joey Armstrong | cacdaa0 | 2024-02-08 16:40:55 -0500 | [diff] [blame] | 1 | # -*- makefile -*- |
| 2 | # ----------------------------------------------------------------------- |
| 3 | # Copyright 2017-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 | ## ----------------------------------------------------------------------- |
| 22 | ## ----------------------------------------------------------------------- |
| 23 | .PHONY: mod-update |
| 24 | mod-update: mod-tidy mod-vendor |
| 25 | |
| 26 | ## ----------------------------------------------------------------------- |
| 27 | ## Intent: Invoke the golang mod tidy command |
| 28 | ## ----------------------------------------------------------------------- |
| 29 | .PHONY: mod-tidy |
| 30 | mod-tidy : |
| 31 | $(call banner-enter,Target $@) |
| 32 | $(if $(LOCAL_FIX_PERMS),chmod o+w $(CURDIR)) |
| 33 | ${GO} mod tidy |
| 34 | $(if $(LOCAL_FIX_PERMS),chmod o-w $(CURDIR)) |
| 35 | $(call banner-leave,Target $@) |
| 36 | |
| 37 | ## ----------------------------------------------------------------------- |
| 38 | ## ----------------------------------------------------------------------- |
| 39 | .PHONY: mod-vendor |
| 40 | mod-vendor : mod-tidy |
| 41 | mod-vendor : |
| 42 | $(call banner-enter,Target $@) |
| 43 | $(if $(LOCAL_FIX_PERMS),chmod o+w $(CURDIR)) |
| 44 | ${GO} mod vendor |
| 45 | $(if $(LOCAL_FIX_PERMS),chmod o-w $(CURDIR)) |
| 46 | $(call banner-leave,Target $@) |
| 47 | |
| 48 | ## ----------------------------------------------------------------------- |
| 49 | ## Intent: Display topic help |
| 50 | ## Usage: |
| 51 | ## % make help |
| 52 | ## ----------------------------------------------------------------------- |
| 53 | help-summary :: |
| 54 | @printf ' %-30s %s\n' 'mod-update' \ |
| 55 | 'Alias for make mod-tidy mod-update (GOLANG)' |
| 56 | ifdef VERBOSE |
| 57 | @$(MAKE) --no-print-directory mod-update-help |
| 58 | endif |
| 59 | |
| 60 | ## ----------------------------------------------------------------------- |
| 61 | ## Intent: Display extended topic help |
| 62 | ## Usage: |
| 63 | ## % make mod-update-help |
| 64 | ## % make help VERBOSE=1 |
| 65 | ## ----------------------------------------------------------------------- |
| 66 | .PHONY: mod-update-help |
| 67 | mod-update-help :: |
| 68 | @printf ' %-30s %s\n' 'mod-tidy'\ |
| 69 | 'Invoke go mod tidy' |
| 70 | @printf ' %-30s %s\n' 'mod-vendor'\ |
| 71 | 'Invoke go mod vendor' |
| 72 | @echo |
| 73 | @echo '[MODIFIER]' |
| 74 | @printf ' %-30s %s\n' 'LOCAL_FIX_PERMS=1' \ |
| 75 | 'Local dev hack to fix docker uid/gid volume problem' |
| 76 | |
| 77 | # [EOF] |