blob: 938dcb5b5bdc7059d920bc9fb4b6fdf67fa72bcd [file] [log] [blame]
Joey Armstrong7f8436c2023-07-09 20:23:27 -04001# -*- makefile -*-
2# -----------------------------------------------------------------------
Joey Armstrong9cdee9f2024-01-03 04:56:14 -05003# Copyright 2017-2024 Open Networking Foundation (ONF) and the ONF Contributors
Joey Armstrong7f8436c2023-07-09 20:23:27 -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# -----------------------------------------------------------------------
17
18##-------------------##
19##---] GLOBALS [---##
20##-------------------##
21.PHONY: help help-summary help-simple help-verbose
22
23##-------------------##
24##---] TARGETS [---##
25##-------------------##
26
27## -----------------------------------------------------------------------
28## Intent: Render topic/tool based makefile help
29## -----------------------------------------------------------------------
30## Three targets are used to render conditional makefile help
31## help-summary A one-line target summary for the topic
32## help-simple Common targets for the topic (lint-helm, build, test)
33## help-verbose Exhaustive display of supported targets
34## -----------------------------------------------------------------------
35## [COOKBOOK]
36## help colon-colon All 'help' targets are evaluated for 'make help'
37## help-banner Display a usage banner for help
38## help-summary Display all one-line topic summary help
39## [conditonal]
40## help-simple Display all common topic makefile targets.
41## help-verbose Exhaustive display of makefile target help.
42## VERBOSE=
43## -----------------------------------------------------------------------
44## [See Also] makefiles/gerrit/{include.mk, help.mk}
45## help-gerrit Summary targets can always be used to display topic help
46## help-verbose Exhaustive gerrit target display.
47## -----------------------------------------------------------------------
48help :: help-banner help-summary
49
50## -----------------------------------------------------------------------
51## Intent: Display a usage banner for help. Target will be evaluated
52## before all other help display.
53## -----------------------------------------------------------------------
54help-banner:
55 @echo "Usage: $(MAKE) [options] [target] ..."
56
57## -----------------------------------------------------------------------
58## Intent: Display extended help.
59## -----------------------------------------------------------------------
60## Question:
61## o Help display can be long based on volume of targets.
62## o Should a 3rd case be added to display:
63## - help-simple (one-liner help) by default
64## - conditional display of extended help:
65## - help-simple or help-verbose
66## o Current logic displays extended help by default.
67## -----------------------------------------------------------------------
68## Usage: see makefiles/targets/test.mk
69## test-verbose += help-check# # append help target to help-verbose
70## -----------------------------------------------------------------------
71ifdef VERBOSE
72 help-verbose += help-verbose
73 help :: $(help-verbose)
74else
75 help :: help-simple
76endif
77
78## -----------------------------------------------------------------------
79## Intent: Display context specific help for named targets.
80## -----------------------------------------------------------------------
81## [TODO] Display a list of help-* tokens for target specific content:
82## % make help-check
83## % make help-test
84## -----------------------------------------------------------------------
85## [TODO] Define LEVEL= or helper targets (help-lint-{level})
86## for extended help w/o information overload
87## [0] help # make help
88## [1] help-lint # make help-verbose or (VERBOSE=1)
89## [2] help-lint-shell # make help-lint VERBOSE=1 (??)
90## [2] help-lint-yaml
91## -----------------------------------------------------------------------
92help-index ::
93 @echo
94 @echo '[HELP] - An index of help context for common targets'
95 @echo ' help-index This message'
96 $(HIDE)\
97 for name in $(sort $(help-verbose)); do\
98 echo " $$name";\
99 done
100
101## -----------------------------------------------------------------------
102## Intent: Display simple extended target help
103## -----------------------------------------------------------------------
104help-simple :: help-index
105 @echo
106 @echo '[VIEW]'
107 @echo ' reload Setup to auto-reload sphinx doc changes in browser'
108 @echo ' view-html View generated documentation'
109 @echo
110 @echo '[TEST]'
111 @echo " test $(MAKE) lint linkcheck"
112 @echo " test-all $(MAKE) all-generation-targets"
113
114# [EOF]