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

Clarify make usage slightly #76

Merged
merged 1 commit into from
Oct 4, 2024
Merged

Clarify make usage slightly #76

merged 1 commit into from
Oct 4, 2024

Conversation

xordspar0
Copy link
Contributor

@xordspar0 xordspar0 commented Oct 4, 2024

I noticed that the make help target had some ANSI escape sequences
that didn't seem to do anything:

@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n  make \033[36m\033[0m\n"}

Those escape sequences at the end mean "change the color to blue, then
change it back to normal".

I've seen this pattern copy-pasted around the web for a while, so I was
curious to find what it was originally. I did some historical
spelunking. The earliest example I can find that closely matches this
branch of history is this:
https://www.thapaliya.com/en/writings/well-documented-makefiles/

In this version, there used to be a <target> inside the color
sequences. I can see why that might be helpful. Otherwise, why have the
first line that prints make at all?

Usage:
  make <target>
  help        Display this help
  deps        Check dependencies
  clean       Cleanup the project folders

Other options:

  • Delete the escape sequences but leave the printable output the same:

    Usage:
      make
      help        Display this help
      deps        Check dependencies
      clean       Cleanup the project folders
    
  • Delete the make line and possibly replace the heading with Targets::

    Targets:
      help        Display this help
      deps        Check dependencies
      clean       Cleanup the project folders
    
  • Restore <target> and Targets: as in the original:

    Usage:
      make <target>
    
    Targets:
      help        Display this help
      deps        Check dependencies
      clean       Cleanup the project folders
    
  • Do nothing because this is a tiny detail that doesn't matter. 🙂

I noticed that the `make help` target had some ANSI escape sequences
that didn't seem to do anything:

    @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n  make \033[36m\033[0m\n"}

Those escape sequences at the end mean "change the color to blue, then
change it back to normal".

I've seen this pattern copy-pasted around the web for a while, so I was
curious to find what it was originally. I did some historical
spelunking. The earliest example I can find that closely matches this
help target is this:
https://www.thapaliya.com/en/writings/well-documented-makefiles/

In this version, there used to be a `<target>` inside the color
sequences. I can see why that might be helpful. Otherwise, why have the
first line that prints make at all?
Copy link
Contributor

@colindean colindean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent catch! I've copypasted this around for probably a decade or more and clearly something got lost somewhere along the way. Thanks for the 🦅 👁️ and for bringing it back!

@colindean colindean merged commit 3498097 into target:main Oct 4, 2024
6 checks passed
@xordspar0 xordspar0 deleted the help branch October 10, 2024 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants