aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: d99e55049304384f4d89a6aa0276e5e925d4131a (plain) (blame)
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
40
41
42
43
44
45
46
47
SH=/bin/sh

GO=go
NPM=npm
RICE=rice
PANDOC=pandoc

BINARY=neko
VERSION=0.3
BUILD=`git rev-parse HEAD`
LDFLAGS=-ldflags "-X main.Version=${VERSION} -X main.Build=${BUILD}"

.PHONY: default all clean ui build install test run dev

default: build

all: clean build docs

clean:
	rm -f ${BINARY}
	rm -f web/rice-box.go
	rm -f readme.html

ui:
	cd frontend && ${NPM} install && ${NPM} run build

build: ui
	${RICE} -i ./web embed-go
	${GO} build ${LDFLAGS} -o ${BINARY}

install: build
	cp ${BINARY} ${GOBIN}

test:
	${GO} test ./...
	cd frontend && ${NPM} test -- --run

run: build
	./${BINARY}

dev: build
	./${BINARY} -d

docs: readme.html

readme.html: README.md
	${PANDOC} README.md -o readme.html