|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# Copyright 2019 The Kubernetes Authors. |
| 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 | +# |
| 18 | +# Makefile with some common workflow for dev, build and test |
| 19 | +# |
| 20 | + |
| 21 | +##@ General |
| 22 | + |
| 23 | +# The help will print out all targets with their descriptions organized bellow their categories. The categories are represented by `##@` and the target descriptions by `##`. |
| 24 | +# The awk commands is responsable to read the entire set of makefiles included in this invocation, looking for lines of the file as xyz: ## something, and then pretty-format the target and help. Then, if there's a line with ##@ something, that gets pretty-printed as a category. |
| 25 | +# More info over the usage of ANSI control characters for terminal formatting: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters |
| 26 | +# More info over awk command: http://linuxcommand.org/lc3_adv_awk.php |
| 27 | +.PHONY: help |
| 28 | +help: ## Display this help |
| 29 | + @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) |
| 30 | + |
| 31 | +##@ Tests |
| 32 | + |
| 33 | +.PHONY: check-all |
| 34 | +test: ## Run the script check-everything.sh which will check all |
| 35 | + GO111MODULE=on TRACE=1 ./hack/check-everything.sh |
| 36 | + |
0 commit comments