Skip to content

Instantly share code, notes, and snippets.

@depressiveRobot
Forked from rcmachado/Makefile
Last active October 17, 2017 16:07

Revisions

  1. depressiveRobot revised this gist May 12, 2015. No changes.
  2. depressiveRobot revised this gist Feb 24, 2015. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions Makefile
    Original file line number Diff line number Diff line change
    @@ -1,16 +1,16 @@
    .SILENT:
    .PHONY: # add tasks here to avoid timestamp checks
    default: help

    # Based on https://gist.github.com/prwhite/8168133#comment-1313022

    ## Another dummy task
    another-dummy-task:
    dummy-task:
    echo dummy

    ## This help screen
    help:
    printf "Available targets\n\n"
    awk '/^[a-zA-Z\-\_0-9]+:/ { \
    @printf "Available targets\n\n"
    @awk '/^[a-zA-Z\-\_0-9]+:/ { \
    helpMessage = match(lastLine, /^## (.*)/); \
    if (helpMessage) { \
    helpCommand = substr($$1, 0, index($$1, ":")-1); \
  3. depressiveRobot revised this gist Feb 18, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Makefile
    Original file line number Diff line number Diff line change
    @@ -15,7 +15,7 @@ help:
    if (helpMessage) { \
    helpCommand = substr($$1, 0, index($$1, ":")-1); \
    helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
    printf "%-15s %s\n", helpCommand, helpMessage; \
    printf "%-30s %s\n", helpCommand, helpMessage; \
    } \
    } \
    { lastLine = $$0 }' $(MAKEFILE_LIST)
  4. depressiveRobot revised this gist Feb 13, 2015. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions Makefile
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,12 @@
    .SILENT:
    .PHONY: help
    default: help

    # Based on https://gist.github.com/prwhite/8168133#comment-1313022

    ## Another dummy task
    another-dummy-task:
    echo dummy

    ## This help screen
    help:
    printf "Available targets\n\n"
    @@ -14,8 +18,4 @@ help:
    printf "%-15s %s\n", helpCommand, helpMessage; \
    } \
    } \
    { lastLine = $$0 }' $(MAKEFILE_LIST)

    ## Another dummy task
    another-dummy-task:
    echo dummy
    { lastLine = $$0 }' $(MAKEFILE_LIST)
  5. depressiveRobot revised this gist Feb 13, 2015. No changes.
  6. @rcmachado rcmachado revised this gist Oct 23, 2014. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion Makefile
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@

    # Based on https://gist.github.com/prwhite/8168133#comment-1313022

    # This help screen
    ## This help screen
    help:
    printf "Available targets\n\n"
    awk '/^[a-zA-Z\-\_0-9]+:/ { \
    @@ -16,3 +16,6 @@ help:
    } \
    { lastLine = $$0 }' $(MAKEFILE_LIST)

    ## Another dummy task
    another-dummy-task:
    echo dummy
  7. @rcmachado rcmachado revised this gist Oct 23, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Makefile
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@

    # This help screen
    help:
    printf "Targets disponíveis\n\n"
    printf "Available targets\n\n"
    awk '/^[a-zA-Z\-\_0-9]+:/ { \
    helpMessage = match(lastLine, /^## (.*)/); \
    if (helpMessage) { \
  8. @rcmachado rcmachado revised this gist Oct 23, 2014. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions Makefile
    Original file line number Diff line number Diff line change
    @@ -6,12 +6,13 @@
    # This help screen
    help:
    printf "Targets disponíveis\n\n"
    awk '/^([a-zA-Z\-\_0-9])+: / { \
    awk '/^[a-zA-Z\-\_0-9]+:/ { \
    helpMessage = match(lastLine, /^## (.*)/); \
    if (helpMessage) { \
    helpCommand = substr($$1, 0, index($$1, ":")-1); \
    helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
    printf "%-15s %s\n", helpCommand, helpMessage; \
    } \
    } \
    { lastLine = $$0 }' $(MAKEFILE_LIST)
    { lastLine = $$0 }' $(MAKEFILE_LIST)

  9. @rcmachado rcmachado revised this gist Oct 23, 2014. 1 changed file with 11 additions and 12 deletions.
    23 changes: 11 additions & 12 deletions Makefile
    Original file line number Diff line number Diff line change
    @@ -3,16 +3,15 @@

    # Based on https://gist.github.com/prwhite/8168133#comment-1313022

    help: ## This help screen
    # This help screen
    help:
    printf "Targets disponíveis\n\n"
    IFS=$$'\n' ; \
    help_lines=(`fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//'`); \
    for help_line in $${help_lines[@]}; do \
    IFS=$$'#' ; \
    help_split=($$help_line) ; \
    help_command=`echo $${help_split[0]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \
    help_info=`echo $${help_split[2]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \
    if [ "x$$help_command" != "x" ]; then \
    printf "%-15s %s\n" $$help_command $$help_info ; \
    fi \
    done
    awk '/^([a-zA-Z\-\_0-9])+: / { \
    helpMessage = match(lastLine, /^## (.*)/); \
    if (helpMessage) { \
    helpCommand = substr($$1, 0, index($$1, ":")-1); \
    helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
    printf "%-15s %s\n", helpCommand, helpMessage; \
    } \
    } \
    { lastLine = $$0 }' $(MAKEFILE_LIST)
  10. @rcmachado rcmachado created this gist Oct 23, 2014.
    18 changes: 18 additions & 0 deletions Makefile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    .SILENT:
    .PHONY: help

    # Based on https://gist.github.com/prwhite/8168133#comment-1313022

    help: ## This help screen
    printf "Targets disponíveis\n\n"
    IFS=$$'\n' ; \
    help_lines=(`fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//'`); \
    for help_line in $${help_lines[@]}; do \
    IFS=$$'#' ; \
    help_split=($$help_line) ; \
    help_command=`echo $${help_split[0]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \
    help_info=`echo $${help_split[2]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \
    if [ "x$$help_command" != "x" ]; then \
    printf "%-15s %s\n" $$help_command $$help_info ; \
    fi \
    done