2018-10-25 15:51:47 +02:00
|
|
|
BIN := listmonk
|
2019-05-27 13:47:26 +02:00
|
|
|
STATIC := config.toml.sample schema.sql queries.sql public email-templates frontend/build:/frontend
|
2018-10-25 15:51:47 +02:00
|
|
|
|
|
|
|
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})
|
|
|
|
|
2019-06-26 08:29:03 +02:00
|
|
|
# Dependencies.
|
|
|
|
.PHONY: deps
|
|
|
|
deps:
|
|
|
|
go get -u github.com/knadh/stuffbin/...
|
|
|
|
cd frontend && yarn install
|
2019-01-09 12:13:13 +01:00
|
|
|
|
2019-06-26 08:29:03 +02:00
|
|
|
# Build steps.
|
2019-01-09 12:13:13 +01:00
|
|
|
.PHONY: build
|
2018-10-25 15:51:47 +02:00
|
|
|
build:
|
2019-01-03 12:18:47 +01:00
|
|
|
go build -o ${BIN} -ldflags="-s -w -X 'main.buildVersion=${VERSION}' -X 'main.buildDate=${BUILD_DATE}'"
|
2019-06-26 08:29:03 +02:00
|
|
|
|
|
|
|
.PHONY: build-frontend
|
|
|
|
build-frontend:
|
|
|
|
cd frontend && yarn build
|
|
|
|
|
2019-06-26 14:20:53 +02:00
|
|
|
.PHONY: dist
|
2019-06-26 08:29:03 +02:00
|
|
|
build-dist:
|
2019-01-03 12:18:47 +01:00
|
|
|
stuffbin -a stuff -in ${BIN} -out ${BIN} ${STATIC}
|
|
|
|
|
2019-03-27 09:05:51 +01:00
|
|
|
.PHONY: run
|
|
|
|
run: build
|
|
|
|
./${BIN}
|
|
|
|
|
2019-01-09 12:13:13 +01:00
|
|
|
.PHONY: test
|
2018-10-25 15:51:47 +02:00
|
|
|
test:
|
|
|
|
go test
|
|
|
|
|
2019-01-09 12:13:13 +01:00
|
|
|
.PHONY: clean
|
2018-10-25 15:51:47 +02:00
|
|
|
clean:
|
|
|
|
go clean
|
|
|
|
- rm -f ${BIN}
|