Skip to content
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

Self documenting Makefile #3290

Merged
merged 1 commit into from
Aug 14, 2016

Conversation

rickard-von-essen
Copy link
Collaborator

Make the Makefile self documented allowing a developer to understand the targets by running make help.

Example:
screen shot 2016-03-01 at 18 51 47

I'll add more documentation if I get a 👍.

Optionally we can change to .PHONY: help if that don't brake anything important.

@cbednarski
Copy link
Contributor

This looks super cool. I've always wanted to find a good way to do this. +2 from me!

@rickard-von-essen
Copy link
Collaborator Author

@cbednarski I'll improve the docs and also need to test this on Windows and Linux. Linux should be no problem but Windows might require some fiddling and worst case do nothing for Windows.

Do you thing .PHONY is important? or can I change it when I'm done?

@cbednarski
Copy link
Contributor

Do you thing .PHONY is important? or can I change it when I'm done?

.PHONY is a best practice but technically not required because there is no file/folder named help; feel free to change it later.

@tylert
Copy link
Contributor

tylert commented Mar 7, 2016

Nice!

Using .PHONY is recommended when the target is a "fake" one (i.e.: one for which no file named the same as the target is expected to be created).

@tylert
Copy link
Contributor

tylert commented Mar 7, 2016

NOTE: You can choose to either of the following in a makefile...

...
.PHONY: ultraclean
ultraclean:
    rm more stuff

.PHONY: clean
clean:
    rm stuff
...

or

...
ultraclean:
    rm more stuff

clean:
    rm stuff
...
.PHONY: clean ultraclean
...

It depends on whether you prefer keeping each PHONY right next to the target it references or putting them all together as has been done in this file.

@rickard-von-essen
Copy link
Collaborator Author

LGTM

@rickard-von-essen rickard-von-essen merged commit 936aaa0 into hashicorp:master Aug 14, 2016
watters pushed a commit to watters/packer that referenced this pull request Aug 28, 2016
@ghost ghost locked and limited conversation to collaborators Apr 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants