Skip to content

Instantly share code, notes, and snippets.

@lofaldli
Last active March 1, 2016 13:26
Show Gist options
  • Select an option

  • Save lofaldli/9da615c27e6ae1024c6c to your computer and use it in GitHub Desktop.

Select an option

Save lofaldli/9da615c27e6ae1024c6c to your computer and use it in GitHub Desktop.
a self-documenting makefile
build: ## build all object files
@echo "building..."
@g++ -o test.o test.cc
clean: ## remove all object files
@echo "removing object files"
@rm *.o
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.DEFAULT_GOAL := build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment