-
Notifications
You must be signed in to change notification settings - Fork 380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Makefile: Cleanup and generate help from comment #2669
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Anna Kapuscinska <anna@isovalent.com>
Admittedly grouping multiple .PHONY annotations together makes sense, but then it's harder to track which targets are marked as .PHONY and which not. Most of the time it doesn't matter, but when it does it can be extremely confusing. Signed-off-by: Anna Kapuscinska <anna@isovalent.com>
It's not used. Targets for building docker images are defined in the main Makefile. Signed-off-by: Anna Kapuscinska <anna@isovalent.com>
Makefile targets used to be documented under the help target. However, such documentation is hard to keep up-to-date. This commit reqwrites the help target to generate documentation from per-target comments. This approach is based on https://www.thapaliya.com/en/writings/well-documented-makefiles/ The generated documentation doesn't group targets - this will be done in the following commits. It also doesn't yet include additional options. Signed-off-by: Anna Kapuscinska <anna@isovalent.com>
This is only moving code around and adding groups comments. The result of `make help` is: ``` Usage: make <target> Build and install tetragon Compile the Tetragon agent. tetragon-operator Compile the Tetragon operator. tetra Compile the Tetragon gRPC client. tetragon-bpf Compile bpf programs (use LOCAL_CLANG=0 to compile in a Docker build env). compile-commands Generate a compile_commands.json with bear for bpf programs. install Install tetragon agent and tetra as standalone binaries. Container images image Build the Tetragon agent container image. image-operator Build the Tetragon operator container image. Packages tarball Build Tetragon compressed tarball. tarball-release Build Tetragon release tarball. Test tester-progs Compile helper programs for unit testing. test-compile Compile unit tests. Development Chores and generated files protogen Generate code based on .proto files. crds Generate kubebuilder files. vendor Tidy and vendor Go modules. clang-format Run code formatter on BPF code. go-format Run code formatter on Go code. format Convenience alias for clang-format and go-format. generate-flags Generate Tetragon daemon flags for documentation. metrics-docs Generate metrics reference documentation page. lint-metrics-md Check if metrics documentation is up to date. Documentation help Display this help, based on https://www.thapaliya.com/en/writings/well-documented-makefiles/ docs Preview documentation website. CLI cli-release Compile tetra CLI release binaries. ``` The following commits will add missing doc comments. Signed-off-by: Anna Kapuscinska <anna@isovalent.com>
Additional lines for `make help` are rendered from comments following the format: ## <target with options>: ## <description> Signed-off-by: Anna Kapuscinska <anna@isovalent.com>
These are options that were documented by former `make help`, just re-adding them to the new target. Signed-off-by: Anna Kapuscinska <anna@isovalent.com>
Signed-off-by: Anna Kapuscinska <anna@isovalent.com>
Remove $(QUIET) from commands already prefixed with @, as it does nothing. Signed-off-by: Anna Kapuscinska <anna@isovalent.com>
We're using `make check` instead. Signed-off-by: Anna Kapuscinska <anna@isovalent.com>
These targets were using undefined COPYRIGHT_DIRS variable and nonexistent contrib/copyright-headers tool. Seems a historical leftover. Signed-off-by: Anna Kapuscinska <anna@isovalent.com>
lambdanis
added
the
release-note/misc
This PR makes changes that have no direct user impact.
label
Jul 12, 2024
kkourt
approved these changes
Jul 12, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
This is awesome |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See commits.
The main goal here is to generate Makefile help from per-target doc comments instead of having all docs in the help target, which is hard to keep up-to-date. I used the approach from https://www.thapaliya.com/en/writings/well-documented-makefiles/. The result (in reality it's nicer, there are colors):