forked from localhots/cmdui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
53 lines (46 loc) · 1.51 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
install:
@echo "* Installing Go dependencies"
@cd backend && dep ensure
@echo "* Pre-building Go code"
@cd backend && go install ./...
@echo "* Installing JavaScript dependencies"
@cd frontend && npm install &> /dev/null
build: assets
@echo "* Building binary"
@go build -tags=binassets -o backend/build/cmdui backend/main.go
@echo "* Build complete!"
@echo "* Binary is located at backend/build/cmdui"
build_linux: assets build_docker
build_docker:
@echo "* Preparing Docker image"
@cd backend && docker build . -t cmdui:build &>/dev/null
@echo "* Building Linux binary"
@cd backend && docker run -i -v ${PWD}/backend/build:/build cmdui:build \
go build -tags=binassets -o /build/cmdui_linux main.go \
&>/dev/null
@echo "* Creating GZIP archive"
@gzip -kf backend/build/cmdui_linux
@echo "* Build complete!"
@echo "* Binary: backend/build/cmdui_linux"
@echo "* GZIP: backend/build/cmdui_linux.gz"
assets:
@echo "* Compiling asset files"
@cd frontend && npm run build &>/dev/null
@echo "* Building embedded assets file"
@go-bindata-assetfs \
-o=backend/api/assets/bindata_assetfs.go \
-pkg=assets \
-prefix=frontend/build \
frontend/build/... \
&>/dev/null
clean:
@echo "* Removing build artefacts"
@rm -rf frontend/build
@rm -rf backend/build
@rm -f backend/api/assets/bindata_assetfs.go
create_db:
@echo "* Creating a blank database"
@sqlite3 backend/data/cmdui.db < backend/schema_sqlite.sql
@echo "* Here it is: backend/data/cmdui.db"
cloc:
@cloc --exclude-dir=vendor,build,node_modules .