on master help sign in
Updates Makefile
commit0b60d800c839610d71788b0f92f5132a81a90f0c authorDeni Bertovic <deni@denibertovic.com> dateWed 4 Oct 2017, 01:19 (9 years ago) parent7df0934
1 file changed+20−1
Makefile+20−1
Makefile+20−1
@@ -1,4 +1,6 @@
1−.PHONY: build repl test release
1+.PHONY: build repl test release help
2+
3+.DEFAULT_GOAL = help
24
35PROJECT_NAME ?= $(shell grep "^name" docker.cabal | cut -d " " -f17)
46VERSION ?= $(shell grep "^version:" docker.cabal | cut -d " " -f14)
@@ -6,18 +8,35 @@ RESOLVER ?= $(shell grep "^resolver:" stack.yaml | cut -d " " -f2)
68GHC_VERSION ?= $(shell stack ghc -- --version | cut -d " " -f8)
79ARCH=$(shell uname -m)
810
11+## Run build
912build:
1013 @stack build
1114
15+## Run repl
1216repl:
1317 @stack repl
1418
19+## Run tests
1520test:
1621 @stack test
1722
23+## Cut new release
1824release:
1925 @stack build --haddock
2026 @stack sdist
2127 @echo "\n\nDone. Now run: \n\nstack upload <path_to_tarball>\n"
2228 @echo "\nAnd: \n\ngit tag ${VERSION} && git push --tags\n"
2329
30+## Show help screen.
31+help:
32+ @echo "Please use \`make <target>' where <target> is one of\n\n"
33+ @awk '/^[a-zA-Z\-\_0-9]+:/ { \
34+ helpMessage = match(lastLine, /^## (.*)/); \
35+ if (helpMessage) { \
36+ helpCommand = substr($$1, 0, index($$1, ":")-1); \
37+ helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
38+ printf "%-30s %s\n", helpCommand, helpMessage; \
39+ } \
40+ } \
41+ { lastLine = $$0 }' $(MAKEFILE_LIST)
42+