1
0
Fork 0

Quite makefile

This commit is contained in:
Gregory Eremin 2017-11-08 00:36:59 +01:00
parent 8c52b417a9
commit 2fb6ac74bd
1 changed files with 35 additions and 21 deletions

View File

@ -1,39 +1,53 @@
install: install:
cd backend && dep ensure @echo "* Installing Go dependencies"
cd backend && go install ./... @cd backend && dep ensure
cd frontend && npm install @echo "* Pre-building Go code"
@cd backend && go install ./...
@echo "* Installing JavaScript dependencies"
@cd frontend && npm install &> /dev/null
build: assets build: assets
go build -tags=binassets -o backend/build/cmdui backend/main.go @echo "* Building binary"
@echo Build complete! @go build -tags=binassets -o backend/build/cmdui backend/main.go
@echo Binary is located at backend/build/cmdui @echo "* Build complete!"
@echo "* Binary is located at backend/build/cmdui"
build_linux: assets build_docker build_linux: assets build_docker
build_docker: build_docker:
cd backend && docker build . -t cmdui:build @echo "* Preparing Docker image"
cd backend && docker run -i -v ${PWD}/backend/build:/build cmdui:build \ @cd backend && docker build . -t cmdui:build &>/dev/null
go build -tags=binassets -o /build/cmdui_linux main.go @echo "* Building Linux binary"
gzip -kf backend/build/cmdui_linux @cd backend && docker run -i -v ${PWD}/backend/build:/build cmdui:build \
@echo Build complete! go build -tags=binassets -o /build/cmdui_linux main.go \
@echo Binary: backend/build/cmdui_linux &>/dev/null
@echo GZIP: backend/build/cmdui_linux.gz @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: assets:
cd frontend && npm run build @echo "* Compiling asset files"
go-bindata-assetfs \ @cd frontend && npm run build &>/dev/null
@echo "* Building embedded assets file"
@go-bindata-assetfs \
-o=backend/api/assets/bindata_assetfs.go \ -o=backend/api/assets/bindata_assetfs.go \
-pkg=assets \ -pkg=assets \
-prefix=frontend/build \ -prefix=frontend/build \
frontend/build/... frontend/build/... \
&>/dev/null
clean: clean:
rm -rf frontend/build @echo "* Removing build artefacts"
rm -rf backend/build @rm -rf frontend/build
rm -f backend/api/assets/bindata_assetfs.go @rm -rf backend/build
@rm -f backend/api/assets/bindata_assetfs.go
create_db: create_db:
sqlite3 backend/data/cmdui.db < backend/schema_sqlite.sql @echo "* Creating a blank database"
@sqlite3 backend/data/cmdui.db < backend/schema_sqlite.sql
@echo "* Here it is: backend/data/cmdui.db"
cloc: cloc:
cloc --exclude-dir=vendor,build,node_modules . @cloc --exclude-dir=vendor,build,node_modules .