Skip to content

Commit ebaf8c7

Browse files
committed
Adds help to Makefile
As well as a release target
1 parent fe60491 commit ebaf8c7

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

Makefile

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ export BINARY_PATH = `stack path --local-install-root`/bin/${PROJECT_NAME}-exe
1111

1212
BINARY_NAME = ${PROJECT_NAME}-exe
1313

14+
## Build binary
1415
build:
1516
@stack build
1617
@echo "\nBinary available at:\n"
1718
@echo ${BINARY_PATH}
1819

19-
20+
## Helper for local testing
2021
run:
2122
@${BINARY_PATH} \
2223
--statements-dir `pwd`/statements \
@@ -25,6 +26,7 @@ run:
2526
--currency HRK \
2627
--debug
2728

29+
## Build static binary
2830
static-build: clean
2931
@mkdir -p release/build
3032
@stack ghc -- \
@@ -42,10 +44,24 @@ static-build: clean
4244
-hidir release/build \
4345
-o release/${BINARY_NAME}-${VERSION}-linux-${ARCH}
4446

47+
## Clean
4548
clean:
4649
@rm -rf release
4750

48-
release: static-build
49-
@echo "\n\nRelease available at:\n"
50-
@echo "STATIC BINARY: `pwd`/release/{BINARY_NAME}-${VERSION}-linux-${ARCH}\n"
51+
## Cut new release
52+
release:
53+
@git tag ${VERSION} && git push --tags
54+
55+
## Show help screen.
56+
help:
57+
@echo "Please use \`make <target>' where <target> is one of\n\n"
58+
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
59+
helpMessage = match(lastLine, /^## (.*)/); \
60+
if (helpMessage) { \
61+
helpCommand = substr($$1, 0, index($$1, ":")-1); \
62+
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
63+
printf "%-30s %s\n", helpCommand, helpMessage; \
64+
} \
65+
} \
66+
{ lastLine = $$0 }' $(MAKEFILE_LIST)
5167

0 commit comments

Comments
 (0)