kubernetes/hack
Kubernetes Submit Queue 23d7615e7f Merge pull request #29683 from xiangpengzhao/add-make-help
Automatic merge from submit-queue

Add "make help" to list all make targets and help info

As discussed in [PR#29320comment](https://github.com/kubernetes/kubernetes/pull/29320#issuecomment-234420145), add a `make help` to make the use of `make` easy. Though it works well on my Ubuntu now (see the output as below, not sure if it still works on other systems), I believe the scripts are somewhat ugly, so, any suggestion for optimization is welcome.

BTW, I intended to list targets by groups, but it's hard to do that automatically. So I just list them in alphabetical order. I think this may be enough.

There are still some TODOs (also mentioned in the Makefile):
1. make EXCLUDE_TARGET auto-generated when there are other files in cmd/
2. should we exclude the target "cmd/libs" but include "cmd/libs/go2idl/*"?
3. should we let `help` be the first/default target? It will show the help when we just type `make`.

1 and 2 are to exclude the invalid targets generated by `$(notdir $(abspath $(wildcard cmd/*/)))`:
- OWNERS is just a file, it can't be a target
- libs itself cannot be built

/cc @thockin @jfrazelle @MHBauer @dims 

Output:

```
root@vm:/home/paas/zxp/code/k8s/fork/kubernetes# make help
--------------------------------------------------------------------------------
all
# Build code.
#
# Args:
#   WHAT: Directory names to build.  If any of these directories has a 'main'
#     package, the build will produce executable files under _output/go/bin.
#     If not specified, "everything" will be built.
#   GOFLAGS: Extra flags to pass to 'go' when building.
#   GOLDFLAGS: Extra linking flags passed to 'go' when building.
#   GOGCFLAGS: Additional go compile flags passed to 'go' when building.
#
# Example:
#   make
#   make all
#   make all WHAT=cmd/kubelet GOFLAGS=-v
#   make all GOGCFLAGS="-N -l"
#     Note: Use the -N -l options to disable compiler optimizations an inlining.
#           Using these build options allows you to subsequently use source
#           debugging tools like delve.
---------------------------------------------------------------------------------
check
# Build and run tests.
#
# Args:
#   WHAT: Directory names to test.  All *_test.go files under these
#     directories will be run.  If not specified, "everything" will be tested.
#   TESTS: Same as WHAT.
#   GOFLAGS: Extra flags to pass to 'go' when building.
#   GOLDFLAGS: Extra linking flags to pass to 'go' when building.
#   GOGCFLAGS: Additional go compile flags passed to 'go' when building.
#
# Example:
#   make check
#   make test
#   make check WHAT=pkg/kubelet GOFLAGS=-v
---------------------------------------------------------------------------------
clean
# Remove all build artifacts.
#
# Example:
#   make clean
#
# TODO(thockin): call clean_generated when we stop committing generated code.
---------------------------------------------------------------------------------
clean_generated
# Remove all auto-generated artifacts.
#
# Example:
#   make clean_generated
---------------------------------------------------------------------------------
clean_meta
# Remove make-related metadata files.
#
# Example:
#   make clean_meta
---------------------------------------------------------------------------------
cross
# Cross-compile for all platforms
#
# Example:
#   make cross
---------------------------------------------------------------------------------
federation-apiserver
federation-controller-manager
genfeddocs
# Add rules for all directories in federation/cmd/
#
# Example:
#   make federation-apiserver federation-controller-manager
---------------------------------------------------------------------------------
gendocs
genkubedocs
genman
genswaggertypedocs
genutils
genyaml
hyperkube
kube-apiserver
kube-controller-manager
kubectl
kube-dns
kubelet
kubemark
kube-proxy
kubernetes-discovery
libs
linkcheck
mungedocs
# Add rules for all directories in cmd/
#
# Example:
#   make kubectl kube-proxy
---------------------------------------------------------------------------------
generated_files
# Produce auto-generated files needed for the build.
#
# Example:
#   make generated_files
---------------------------------------------------------------------------------
ginkgo
# Build ginkgo
#
# Example:
# make ginkgo
---------------------------------------------------------------------------------
help
# Print make targets and help info
#
# Example:
# make help
---------------------------------------------------------------------------------
quick-release
# Build a release, but skip tests
#
# Example:
#   make release-skip-tests
---------------------------------------------------------------------------------
release
# Build a release
#
# Example:
#   make release
---------------------------------------------------------------------------------
release-skip-tests
# Build a release, but skip tests
#
# Example:
#   make release-skip-tests
---------------------------------------------------------------------------------
test
# Build and run tests.
#
# Args:
#   WHAT: Directory names to test.  All *_test.go files under these
#     directories will be run.  If not specified, "everything" will be tested.
#   TESTS: Same as WHAT.
#   GOFLAGS: Extra flags to pass to 'go' when building.
#   GOLDFLAGS: Extra linking flags to pass to 'go' when building.
#   GOGCFLAGS: Additional go compile flags passed to 'go' when building.
#
# Example:
#   make check
#   make test
#   make check WHAT=pkg/kubelet GOFLAGS=-v
---------------------------------------------------------------------------------
test-cmd
# Build and run cmdline tests.
#
# Example:
#   make test-cmd
---------------------------------------------------------------------------------
test-e2e
# Build and run end-to-end tests.
#
# Example:
#   make test-e2e
---------------------------------------------------------------------------------
test-e2e-node
# Build and run node end-to-end tests.
#
# Args:
#  FOCUS: Regexp that matches the tests to be run.  Defaults to "".
#  SKIP: Regexp that matches the tests that needs to be skipped.  Defaults
#    to "".
#  RUN_UNTIL_FAILURE: If true, pass --untilItFails to ginkgo so tests are run
#    repeatedly until they fail.  Defaults to false.
#  REMOTE: If true, run the tests on a remote host instance on GCE.  Defaults
#    to false.
#  IMAGES: For REMOTE=true only.  Comma delimited list of images for creating
#    remote hosts to run tests against.  Defaults to a recent image.
#  LIST_IMAGES: If true, don't run tests.  Just output the list of available
#    images for testing.  Defaults to false.
#  HOSTS: For REMOTE=true only.  Comma delimited list of running gce hosts to
#    run tests against.  Defaults to "".
#  DELETE_INSTANCES: For REMOTE=true only.  Delete any instances created as
#    part of this test run.  Defaults to false.
#  ARTIFACTS: For REMOTE=true only.  Local directory to scp test artifacts into
#    from the remote hosts.  Defaults to ""/tmp/_artifacts".
#  REPORT: For REMOTE=false only.  Local directory to write juntil xml results
#    to.  Defaults to "/tmp/".
#  CLEANUP: For REMOTE=true only.  If false, do not stop processes or delete
#    test files on remote hosts.  Defaults to true.
#  IMAGE_PROJECT: For REMOTE=true only.  Project containing images provided to
#  IMAGES.  Defaults to "kubernetes-node-e2e-images".
#  INSTANCE_PREFIX: For REMOTE=true only.  Instances created from images will
#    have the name "-".  Defaults to "test".
#  INSTANCE_METADATA: For REMOTE=true and running on GCE only.
#
# Example:
#   make test-e2e-node FOCUS=Kubelet SKIP=container
#   make test-e2e-node REMOTE=true DELETE_INSTANCES=true
#   make test-e2e-node TEST_ARGS="--cgroups-per-qos=true"
# Build and run tests.
---------------------------------------------------------------------------------
test-integration
# Build and run integration tests.
#
# Example:
#   make test-integration
---------------------------------------------------------------------------------
verify
# Runs all the presubmission verifications.
#
# Args:
#   BRANCH: Branch to be passed to verify-godeps.sh script.
#
# Example:
#   make verify
#   make verify BRANCH=branch_x
---------------------------------------------------------------------------------
vet
# Run 'go vet'.
#
# Args:
#   WHAT: Directory names to vet.  All *.go files under these
#     directories will be vetted.  If not specified, "everything" will be
#     vetted.
#
# Example:
#   make vet
#   make vet WHAT=pkg/kubelet
---------------------------------------------------------------------------------
```
2016-12-06 13:00:31 -08:00
..
boilerplate bazel: implement set-gen as a bazel genrule 2016-10-27 15:16:30 -07:00
cmd/teststale Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
e2e-internal Fixed e2e tests for HA master. 2016-11-22 12:03:28 +01:00
gen-swagger-doc change the relative links to definition in operations.html to satisfy the new path set in the kubernetes.io 2016-07-29 13:29:34 -07:00
jenkins Build vendored copy of go-bindata and use that in go generate step 2016-11-30 22:23:40 -08:00
lib Merge pull request #38111 from henrynash/pipe141error 2016-12-05 14:14:39 -08:00
make-rules Merge pull request #29683 from xiangpengzhao/add-make-help 2016-12-06 13:00:31 -08:00
testdata Remove initialized annotation from statefulset examples 2016-11-23 10:40:42 -08:00
verify-flags Remove setup-node, which is not needed after we run the whole test as 2016-12-05 16:16:08 -08:00
.linted_packages Add generated informers 2016-11-30 09:17:12 -05:00
autogenerated_placeholder.txt Revamp doc generation 2016-06-08 17:22:12 -07:00
benchmark-go.sh Use make as the main build tool 2016-07-12 21:52:00 -07:00
benchmark-integration.sh Use make as the main build tool 2016-07-12 21:52:00 -07:00
build-cross.sh Make releases work 2016-07-12 21:52:54 -07:00
build-go.sh Use make as the main build tool 2016-07-12 21:52:00 -07:00
build-ui.sh Cleanup non-rest apiserver handlers 2016-09-15 13:22:45 +02:00
cherry_pick_pull.sh hack/: update cherry-pick script to have settings to override remote names 2016-10-17 16:10:49 -07:00
dev-build-and-push.sh rename build/ to build-tools/ 2016-10-24 14:41:56 -07:00
dev-build-and-up.sh rename build/ to build-tools/ 2016-10-24 14:41:56 -07:00
dev-push-hyperkube.sh rename build/ to build-tools/ 2016-10-24 14:41:56 -07:00
e2e-node-test.sh Use make as the main build tool 2016-07-12 21:52:00 -07:00
e2e.go Merge pull request #37866 from fejta/log 2016-12-02 10:17:58 -08:00
federated-ginkgo-e2e.sh Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
generate-bindata.sh Build vendored copy of go-bindata and use that in go generate step 2016-11-30 22:23:40 -08:00
generate-docs.sh Use make as the main build tool 2016-07-12 21:52:00 -07:00
get-build.sh Merge pull request #26755 from david-mcmahon/fix-headers 2016-06-29 18:46:07 -07:00
ginkgo-e2e.sh e2e.go/kops: Make up timeout configurable, bump to 20m 2016-11-01 14:56:34 -07:00
godep-save.sh Ensure verify-godep passes godep to godep-save 2016-11-02 23:49:30 -07:00
grab-profiles.sh Make all useage of sort deterministic 2016-10-20 16:47:20 -04:00
install-etcd.sh Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
list-feature-tests.sh Make all useage of sort deterministic 2016-10-20 16:47:20 -04:00
local-up-cluster.sh change prompt for enabling RBAC on local-up-cluster 2016-12-02 11:04:25 +08:00
lookup_pull.py Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
OWNERS Add jbeda to OWNERS for build, cluster, hack 2016-09-27 14:53:16 -07:00
run-in-gopath.sh Allow make to run from outside GOPATH 2016-07-15 08:42:12 -07:00
test-cmd.sh fix hack/test-cmd 2016-08-02 10:27:29 -04:00
test-go.sh Use make as the main build tool 2016-07-12 21:52:00 -07:00
test-integration.sh choose a particular directory test-integration 2016-08-26 12:33:06 -04:00
test-update-storage-objects.sh Bump etcd to 3.0.14 in tests 2016-11-07 08:41:17 +01:00
update_owners.py Remove girishkalele from most places 2016-12-05 19:29:34 -05:00
update-all.sh Sync update-all with verfiy targets 2016-12-05 12:43:54 +01:00
update-api-reference-docs.sh update generation scripts to share API group version constants 2016-09-22 13:30:41 -04:00
update-bazel.sh fix realpath issue on mac 2016-10-24 17:10:47 -07:00
update-codecgen.sh Make all useage of sort deterministic 2016-10-20 16:47:20 -04:00
update-codegen.sh Use xargs -n1 dirname for greater bash compat on Mac 2016-12-03 18:57:31 -05:00
update-federation-api-reference-docs.sh Adding a script to update federation API reference docs 2016-08-31 13:21:42 -07:00
update-federation-generated-swagger-docs.sh Adding a script to update federation API reference docs 2016-08-31 13:21:42 -07:00
update-federation-openapi-spec.sh - Add GroupVersion as tags to OpenAPI spec 2016-10-25 14:27:48 -07:00
update-federation-swagger-spec.sh Adding update-federation-generated-swagger-docs to generate comment funcs for federation gvs 2016-08-30 14:15:21 -07:00
update-generated-docs.sh Use make as the main build tool 2016-07-12 21:52:00 -07:00
update-generated-protobuf-dockerized.sh add UpdateRuntimeConfig interface 2016-10-12 22:33:58 -07:00
update-generated-protobuf.sh rename build/ to build-tools/ 2016-10-24 14:41:56 -07:00
update-generated-runtime-dockerized.sh Make update-generated-runtime work 2016-07-12 21:52:54 -07:00
update-generated-runtime.sh rename build/ to build-tools/ 2016-10-24 14:41:56 -07:00
update-generated-swagger-docs.sh Switch generator logic to use pkg/apis/meta/v1 2016-12-03 18:57:30 -05:00
update-godep-licenses.sh make godep licenses/copyright check case insensitive 2016-10-24 18:00:08 -07:00
update-gofmt.sh Merge pull request #31547 from mbohlool/fix2 2016-09-14 05:35:51 -07:00
update-munge-docs.sh Remove 'this is HEAD' warning on docs 2016-10-26 00:06:59 +02:00
update-openapi-spec.sh Update OpenAPI spec generator to enable all APIs 2016-11-11 16:29:49 -08:00
update-staging-client-go.sh add update-staging-client-go.sh and verify-staging-client-go.sh; 2016-10-29 14:20:39 -07:00
update-swagger-spec.sh update generation scripts to share API group version constants 2016-09-22 13:30:41 -04:00
verify-all.sh Use make as the main build tool 2016-07-12 21:52:00 -07:00
verify-api-groups.sh add script to check for updates to the files for generation 2016-11-01 15:59:50 -04:00
verify-api-reference-docs.sh Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
verify-bazel.sh fix verify-bazel.sh on mac and windows 2016-11-02 13:14:00 -07:00
verify-boilerplate.sh Add verbose mode to boilerplate 2016-10-22 21:40:08 -07:00
verify-cli-conventions.sh Tools for checking CLI conventions 2016-10-17 11:50:02 -02:00
verify-codecgen.sh Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
verify-codegen.sh Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
verify-description.sh Use make as the main build tool 2016-07-12 21:52:00 -07:00
verify-federation-openapi-spec.sh Add verify script federation OpenAPI spec generation 2016-11-07 02:41:50 -08:00
verify-flags-underscore.py ignore BUILD in the flags-underscore.py validation 2016-10-21 17:32:33 -07:00
verify-generated-docs.sh Use make as the main build tool 2016-07-12 21:52:00 -07:00
verify-generated-protobuf.sh utils: Use macOS copatible copying method 2016-10-18 11:09:38 +02:00
verify-generated-runtime.sh add update-staging-client-go.sh and verify-staging-client-go.sh; 2016-10-29 14:20:39 -07:00
verify-generated-swagger-docs.sh docs generation: Use macos compatible copy method 2016-10-18 11:11:03 +02:00
verify-godep-licenses.sh Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
verify-godeps.sh Move godeps to version v74 instead of v73 2016-11-03 00:43:06 -07:00
verify-gofmt.sh ignore staging in munge scripts 2016-08-24 13:09:13 -07:00
verify-golint.sh Use LC_ALL=C with sort 2016-10-19 09:47:21 -04:00
verify-govet.sh Use make as the main build tool 2016-07-12 21:52:00 -07:00
verify-import-boss.sh Use make as the main build tool 2016-07-12 21:52:00 -07:00
verify-linkcheck.sh Use make as the main build tool 2016-07-12 21:52:00 -07:00
verify-munge-docs.sh Remove 'this is HEAD' warning on docs 2016-10-26 00:06:59 +02:00
verify-openapi-spec.sh verify-openapi-spec.sh should not ignore extra file in the spec folder api/openapi-spec 2016-11-01 01:13:11 -07:00
verify-pkg-names.sh Add hack/verify-pkg-names.sh 2016-11-30 15:23:35 +08:00
verify-staging-client-go.sh add update-staging-client-go.sh and verify-staging-client-go.sh; 2016-10-29 14:20:39 -07:00
verify-swagger-spec.sh Use make as the main build tool 2016-07-12 21:52:00 -07:00
verify-symbols.sh Use make as the main build tool 2016-07-12 21:52:00 -07:00
verify-test-images.sh Make all useage of sort deterministic 2016-10-20 16:47:20 -04:00
verify-test-owners.sh Disable the test-owners verify step until the merge conflicts are resolved. 2016-11-02 15:39:06 -07:00