blob: 74401424070903eb5460c7864598fd89a7d60d4c [file] [log] [blame]
Joey Armstrong96bcf1b2023-06-27 14:49:40 -04001# -*- makefile -*-
2# -----------------------------------------------------------------------
Joey Armstrong2c039362024-02-04 18:51:52 -05003# Copyright 2017-2024 Open Networking Foundation (ONF) and the ONF Contributors
Joey Armstrong96bcf1b2023-06-27 14:49:40 -04004#
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# -----------------------------------------------------------------------
Joey Armstrong2c039362024-02-04 18:51:52 -050017# SPDX-FileCopyrightText: 2024 Open Networking Foundation (ONF) and the ONF Contributors
Joey Armstrong96bcf1b2023-06-27 14:49:40 -040018# SPDX-License-Identifier: Apache-2.0
19# -----------------------------------------------------------------------
Joey Armstrong96bcf1b2023-06-27 14:49:40 -040020
21## -----------------------------------------------------------------------
22## -----------------------------------------------------------------------
Joey Armstrong96bcf1b2023-06-27 14:49:40 -040023.PHONY: mod-update
24mod-update: mod-tidy mod-vendor
25
26## -----------------------------------------------------------------------
Joey Armstrong4d6878e2024-02-08 16:29:26 -050027## Intent: Invoke the golang mod tidy command
Joey Armstrong96bcf1b2023-06-27 14:49:40 -040028## -----------------------------------------------------------------------
29.PHONY: mod-tidy
30mod-tidy :
31 $(call banner-enter,Target $@)
Joey Armstrong4d6878e2024-02-08 16:29:26 -050032 $(if $(LOCAL_FIX_PERMS),chmod o+w $(CURDIR))
Joey Armstrong96bcf1b2023-06-27 14:49:40 -040033 ${GO} mod tidy
Joey Armstrong4d6878e2024-02-08 16:29:26 -050034 $(if $(LOCAL_FIX_PERMS),chmod o-w $(CURDIR))
Joey Armstrong96bcf1b2023-06-27 14:49:40 -040035 $(call banner-leave,Target $@)
36
37## -----------------------------------------------------------------------
38## -----------------------------------------------------------------------
39.PHONY: mod-vendor
40mod-vendor : mod-tidy
41mod-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## -----------------------------------------------------------------------
Joey Armstrong4d6878e2024-02-08 16:29:26 -050049## Intent: Display topic help
50## Usage:
51## % make help
Joey Armstrong96bcf1b2023-06-27 14:49:40 -040052## -----------------------------------------------------------------------
Joey Armstrong4d6878e2024-02-08 16:29:26 -050053help-summary ::
54 @printf ' %-30s %s\n' 'mod-update' \
55 'Alias for make mod-tidy mod-update (GOLANG)'
Joey Armstrong96bcf1b2023-06-27 14:49:40 -040056 ifdef VERBOSE
Joey Armstrong4d6878e2024-02-08 16:29:26 -050057 @$(MAKE) --no-print-directory mod-update-help
Joey Armstrong96bcf1b2023-06-27 14:49:40 -040058 endif
59
Joey Armstrong4d6878e2024-02-08 16:29:26 -050060## -----------------------------------------------------------------------
61## Intent: Display extended topic help
62## Usage:
63## % make mod-update-help
64## % make help VERBOSE=1
65## -----------------------------------------------------------------------
66.PHONY: mod-update-help
67mod-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
Joey Armstrong96bcf1b2023-06-27 14:49:40 -040077# [EOF]