项目作者: diogocavilha

项目描述 :
A simple Makefile help generator to use on your projects that have a Makefile.
高级语言: Shell
项目地址: git://github.com/diogocavilha/make-help-generator.git
创建时间: 2018-11-30T14:36:56Z
项目社区:https://github.com/diogocavilha/make-help-generator

开源协议:

下载


Makefile Helper Generator :dog:

If you are working on a project which has a Makefile containing lots of commands, this might turn your life easier.

How to use it?

You must to create a file called MakefileHelp.sh containing the same conntent as the MakefileHelp.sh in this project. After that, you must set this file execution permission (chmod +x MakefileHelp.sh).

The following command will do both:

  1. wget https://raw.githubusercontent.com/diogocavilha/make-help-generator/master/MakefileHelp.sh \
  2. -q -O MakefileHelp.sh \
  3. && chmod +x MakefileHelp.sh

How does it work?

  • Your Makefile must have some comments in order to generate a properly help message. Like the Makefile example you can find in this project.
  • You must have a command called help, that will execute the help generator for the Makefile.

Example:

Add help comments to your Makefile commands like:

  1. run:
  2. @# run - Run the project.
  3. # commands...
  4. build:
  5. @# build - Build the project.
  6. # commands...
  7. unit-tests:
  8. @# unit-tests - Run unit tests.
  9. # commands...
  10. integration-tests:
  11. @# integration-tests - Run integration tests.
  12. # commands...
  13. help:
  14. @# help - Show this help.
  15. @./MakefileHelp.sh

Take a look at the last command called help.
The help command will print the Makefile help.

  1. help:
  2. @# help - Show this help.
  3. @./MakefileHelp.sh

Make sure that you have the MakefileHelp.sh file in the right path.

After that, you must only type make help and voilà! The magic happens!

The above example must print that help:

  1. $ make help
  2. run - Run the project.
  3. build - Build the project.
  4. unit-tests - Run unit tests.
  5. integration-tests - Run integration tests.
  6. help - Show this help.

Now you don’t need to read all the Makefile in order to find how exaclty you must type that command you’re looking for!