makefile 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # Title
  2. # Auto-Documenting Section. Displays a target list with `##` descriptions.
  3. #
  4. # http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
  5. # This will run as the default target i.e. `make` with no arguments.
  6. # Unlike the blog post from which this is taken, there is no output colorisation
  7. # (e.g. `\033[36m`) for better compatibility in different setups.
  8. help:
  9. @grep -E '^[a-zA-Z_-]+:.*## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "* %-15s %s\n", $$1, $$2}'
  10. .PHONY: help
  11. example: dependency ## Run the example task
  12. dependency: ## Run example's dependency
  13. # Ultra-Small Makefile Tutorial. (Fuller tutorial: http://makefiletutorial.com)
  14. # This is a valid makefile:
  15. #
  16. # # Comments start with a `#`
  17. # # Put plain shell commands (/bin/sh) on each line.
  18. # target1:
  19. # touch target1
  20. # @echo "silenced lines are not printed, but command output is shown."
  21. # # Argh, this comment line is printed!
  22. # @# Note: First target = Default i.e. `make` = `make target1`
  23. #
  24. # target2:
  25. # @# Each line is its own shell instance. The `cd` below has no effect.
  26. # cd ~/dotfiles
  27. # touch target2
  28. # @echo "** Multiple commands can be"; echo "** separated by semicolons"
  29. #
  30. # target3: target4
  31. # @# Oh, this target has a dependency!
  32. # touch target3
  33. #
  34. # target4:
  35. # @# This will be called by target3, and will be run before target3 does.
  36. # touch target4
  37. #
  38. # # declare a variable string
  39. # all = target1 target2 target3 target4
  40. #
  41. # # use a variable string (as list of dependencies)
  42. # everything: $(all)
  43. #
  44. # clean:
  45. # @# `clean` is not a special word. You have to build `make clean` yourself.
  46. # rm $(all)
  47. #
  48. # # Target names are actually expected files, so if a file with the target name
  49. # # exists, a target will not run:
  50. # #
  51. # # $ touch clean
  52. # # $ make clean
  53. # # make: `clean` is up to date.
  54. # #
  55. # # Use `.PHONY` to not do a file check. Now `clean` will always run.
  56. # .PHONY: clean
  57. #