-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
33 lines (26 loc) · 1.05 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
BIN := varnamd
HASH := $(shell git rev-parse HEAD | cut -c 1-8)
COMMIT_DATE := $(shell git show -s --format=%ci ${HASH})
BUILD_DATE := $(shell date '+%Y-%m-%d %H:%M:%S')
VERSION := ${HASH} (${COMMIT_DATE})
STATIC := ui:/
deps:
go get -u github.com/knadh/stuffbin/...
ui/embed.js:
git clone [email protected]:varnamproject/webpage-embed-plugin.git --depth 1 || true
cd webpage-embed-plugin && yarn && yarn build && cp dist/embed.cjs ../ui/embed.js && cp dist/style.css ../ui/embed.css
build: ## Build the binary (default)
go build -o ${BIN} -ldflags="-X 'main.buildVersion=${VERSION}' -X 'main.buildDate=${BUILD_DATE}' -s -w"
stuffbin -a stuff -in ${BIN} -out ${BIN} ${STATIC}
.PHONY: run
run:
./${BIN}
.PHONY: clean
clean: ## Remove temporary files and the binary
go clean
rm -rf webpage-embed-plugin
# Absolutely awesome: http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.DEFAULT_GOAL := build