aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: e7348c278767ef7a3837599f6021f64759053574 (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
48
49
50
51
52
53
54
55
SH=/bin/sh

GO=go
NPM=npm
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 ui vanilla-ui build docs

clean:
	rm -f ${BINARY}
	rm -f readme.html

ui:
	cd frontend && ${NPM} install && ${NPM} run build
	rm -rf web/dist/v2
	mkdir -p web/dist/v2
	cp -r frontend/dist/* web/dist/v2/

vanilla-ui:
	rm -rf web/dist/vanilla
	mkdir -p web/dist/vanilla
	cp vanilla/index.html vanilla/app.js vanilla/style.css web/dist/vanilla/

build:
	${GO} build ${LDFLAGS} -o ${BINARY} ./cmd/neko

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

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

run: build
	./${BINARY}

dev: build
	./${BINARY} -d

docs: readme.html

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