forked from reef-pi/reef-pi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
110 lines (89 loc) · 2.03 KB
/
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
SOURCEDIR=.
SOURCES = $(shell find $(SOURCEDIR) -name '*.go')
VERSION=$(shell git describe --always --tags)
BINARY=bin/reef-pi
ifeq ($(OS), Windows_NT)
BINARY=./bin/reef-pi.exe
endif
.PHONY:bin
bin:
make go
make build-ui
.PHONY:build-ui
build-ui:
npm run build
.PHONY:go
go:
go build -o $(BINARY) -ldflags "-s -w -X main.Version=$(VERSION)" ./commands
.PHONY:pi
pi:
env GOOS=linux GOARCH=arm go build -o $(BINARY) -ldflags "-s -w -X main.Version=$(VERSION)" ./commands
.PHONY: pi-zero
pi-zero:
env GOARM=6 GOOS=linux GOARCH=arm go build -o $(BINARY) -ldflags "-s -w -X main.Version=$(VERSION)" ./commands
.PHONY: test
test:
go test -count=1 -cover -race ./...
.PHONY: js-lint
js-lint:
npm run js-lint
.PHONY: sass-lint
sass-lint:
npm run sass-lint
.PHONY: install
install:
make go-get
npm install
.PHONY: go-get
go-get:
go get -u github.com/golang/dep/cmd/dep
go get -u golang.org/x/tools/cmd/goimports
dep ensure
ifeq ($(OS), Windows_NT)
go get -u github.com/StackExchange/wmi
endif
.PHONY: vet
vet:
go vet ./...
.PHONY: imports
imports:
goimports -w -local github.com/reef-pi/reef-pi -d ./controller
.PHONY: build
build: clean go-get test bin
.PHONY: ui
ui:
npm run ui
.PHONY: ui-dev
ui-dev:
npm run ui-dev
.PHONY: deb
deb: ui
mkdir -p dist/var/lib/reef-pi/ui dist/usr/bin dist/etc/reef-pi
cp bin/reef-pi dist/usr/bin/reef-pi
cp -r ui/* dist/var/lib/reef-pi/ui
cp build/reef-pi.yml dist/etc/reef-pi/config.yml
mkdir dist/var/lib/reef-pi/images
bundle exec fpm -t deb -s dir -a armhf -n reef-pi -v $(VERSION) -m [email protected] --deb-systemd build/reef-pi.service -C dist -p reef-pi-$(VERSION).deb .
.PHONY: clean
clean:
-rm -rf *.deb
-rm -rf dist
-rm -rf ui
-find jsx -iname __snapshots__ -print | xargs rm -rf
-find . -name '*.db' -exec rm {} \;
-find . -name '*.crt' -exec rm {} \;
-find . -name '*.key' -exec rm {} \;
.PHONY: standard
standard:
npm run standard
.PHONY: jest
jest:
npm run jest
.PHONY: start-dev
start-dev:
ifeq ($(OS), Windows_NT)
set DEV_MODE=1
$(BINARY)
else
DEV_MODE=1 $(BINARY)
endif