forked from knadh/listmonk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
39 lines (31 loc) · 808 Bytes
/
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
34
35
36
37
38
39
BIN := listmonk
STATIC := config.toml.sample schema.sql queries.sql public email-templates frontend/build:/frontend
HASH := $(shell git rev-parse --short HEAD)
COMMIT_DATE := $(shell git show -s --format=%ci ${HASH})
BUILD_DATE := $(shell date '+%Y-%m-%d %H:%M:%S')
VERSION := ${HASH} (${COMMIT_DATE})
# Dependencies.
.PHONY: deps
deps:
go get -u github.com/knadh/stuffbin/...
cd frontend && yarn install
# Build steps.
.PHONY: build
build:
go build -o ${BIN} -ldflags="-s -w -X 'main.buildVersion=${VERSION}' -X 'main.buildDate=${BUILD_DATE}'"
.PHONY: build-frontend
build-frontend:
cd frontend && yarn build
.PHONY: dist
build-dist:
stuffbin -a stuff -in ${BIN} -out ${BIN} ${STATIC}
.PHONY: run
run: build
./${BIN}
.PHONY: test
test:
go test
.PHONY: clean
clean:
go clean
- rm -f ${BIN}