Skip to content

Instantly share code, notes, and snippets.

@grampelberg
Created February 5, 2021 18:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grampelberg/0881cc2f6a744c39b61ea1a00b5339ec to your computer and use it in GitHub Desktop.
Save grampelberg/0881cc2f6a744c39b61ea1a00b5339ec to your computer and use it in GitHub Desktop.
SHELL := bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c -x
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
CURRENT_DIR := $(notdir $(patsubst %/,%,$(dir $(MKFILE_PATH))))
.PHONY: bootstrap
bootstrap:
@# Bootstrap the local dependencies
.PHONY: help
help:
@# Output all targets available.
@ echo "usage: make [target] ..."
@ echo ""
@eval "echo \"$$(grep -h -B1 $$'^\t@#' $(MAKEFILE_LIST) \
| sed 's/@#//' \
| awk \
-v NO_COLOR="$(NO_COLOR)" \
-v OK_COLOR="$(OK_COLOR)" \
-v RS="--\n" \
-v FS="\n" \
-v OFS="@@" \
'{ split($$1,target,":"); $$1=""; print OK_COLOR target[1] NO_COLOR $$0 }' \
| sort \
| awk \
-v FS="@@" \
-v OFS="\n" \
'{ CMD=$$1; $$1=""; print CMD $$0 }')\""
.DEFAULT_GOAL := help
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment