-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
48 lines (39 loc) · 920 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
40
41
42
43
44
45
46
47
GO ?= go
HAS_GO = $(shell hash $(GO) > /dev/null 2>&1 && echo "GO" || echo "NOGO")
SQLITE3 ?= sqlite3
HAS_SQLITE3 = $(shell hash $(SQLITE3) > /dev/null 2>&1 && echo "SQLITE3" || echo "NOSQLITE3")
ifeq ($(OS), Windows_NT)
GOFLAGS := -v -buildmode=exe
EXECUTABLE ?= nasu.exe
else ifeq ($(OS), Windows)
GOFLAGS := -v -buildmode=exe
EXECUTABLE ?= nasu.exe
else
GOFLAGS := -v
EXECUTABLE ?= nasu
endif
.PHONY: all
all: check-env run
check-env:
@echo "checking go..."
ifeq ($(HAS_GO), NOGO)
@echo "GO is not installed"
exit -1
else
@echo "GO is installed"
endif
@echo "checking sqlite3..."
ifeq ($(HAS_SQLITE3), NOSQLITE3)
@echo "sqlite3 is not installed"
exit -1
else
@echo "sqlite3 is installed"
endif
build: check-env build-web
go build -o $(EXECUTABLE) github.com/littlebutt/nasu/src
test:
go test -cover ./...
run: check-env
go run github.com/littlebutt/nasu/src
build-web:
cd web && make build