surrealpatch/Makefile

135 lines
3.5 KiB
Makefile
Raw Normal View History

2016-02-26 17:24:22 +00:00
# Copyright © 2016 Abcum Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
GO ?= go
LDF :=
2016-03-17 00:07:53 +00:00
# The `make default` command cleans
# the go build and test files and
# then runs a build and install.
2016-02-26 17:24:22 +00:00
.PHONY: default
2016-04-13 14:17:22 +00:00
default:
@echo "Choose a Makefile target:"
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print " - " $$1}}' | sort
2016-03-17 00:07:53 +00:00
2016-04-13 14:17:22 +00:00
# The `make kill` command ensures that
# any hanging surreal processes are force
# killed. Useful in development.
2016-03-17 00:07:53 +00:00
2016-04-13 14:17:22 +00:00
.PHONY: kill
kill:
pkill -9 -f surreal
2016-02-26 17:24:22 +00:00
2016-03-17 00:07:53 +00:00
# The `make convey` command downloads
# or updates 'goconvey', and runs the
# auto-updating testing server.
.PHONY: convey
convey:
2016-05-20 09:56:31 +00:00
@echo "Run 'go get -u -v github.com/smartystreets/goconvey'"
2016-09-28 17:07:08 +00:00
goconvey -packages 50 -port 5000 -poll 10m -excludedDirs 'build,dev,doc,gui,vendor'
# The `make deps` command ensures all
# 3rd party dependencies are downloaded
# and installed.
.PHONY: deps
deps:
glide cache-clear
glide update
2016-09-28 17:07:08 +00:00
# The `make test` command runs all
# tests, found within all sub-folders
# in the project folder.
.PHONY: tests
tests:
$(GO) test `glide novendor`
2016-03-17 00:07:53 +00:00
2017-01-13 19:11:10 +00:00
# The `make cover` command runs all
# tests, and produces and uploads a
# coverage profile to coveralls.
.PHONY: cover
cover:
echo 'mode: atomic' > main.cover
glide novendor | cut -d '/' -f-2 | xargs -I % sh -c 'touch temp.cover; go test -covermode=count -coverprofile=temp.cover %; tail -n +2 temp.cover >> main.cover; rm temp.cover;'
goveralls -coverprofile=./main.cover -service=circle-ci -repotoken=${COVERALLS}
2016-07-04 11:29:27 +00:00
# The `make glide` command ensures that
# all imported dependencies are synced
# and located within the vendor folder.
.PHONY: glide
glide:
2016-08-10 09:53:03 +00:00
glide install
2016-03-17 00:07:53 +00:00
# The `make clean` command cleans
# all object, build, and test files
# and removes the executable file.
2016-02-26 17:24:22 +00:00
.PHONY: clean
clean:
2016-06-17 11:32:11 +00:00
rm -rf vendor
2016-04-13 14:17:22 +00:00
$(GO) clean -i `glide novendor`
2016-02-26 17:24:22 +00:00
find . -name '*.test' -type f -exec rm -f {} \;
2017-01-13 19:11:10 +00:00
find . -name '*.cover' -type f -exec rm -f {} \;
2016-09-28 17:07:08 +00:00
find . -name '*.gen.go' -type f -exec rm -f {} \;
# The `make setup` command runs the
# go generate command in all of the
# project subdirectories.
.PHONY: setup
setup:
CGO_ENABLED=0 $(GO) generate -v `glide novendor`
2016-02-26 17:24:22 +00:00
2016-05-20 07:56:03 +00:00
# The `make quick` command compiles
2016-03-17 00:07:53 +00:00
# the build flags, gets the project
# dependencies, and runs a build.
2016-02-26 17:24:22 +00:00
2016-04-13 14:17:22 +00:00
.PHONY: quick
2016-08-10 09:53:03 +00:00
quick:
2016-07-18 12:32:23 +00:00
CGO_ENABLED=0 $(GO) build
2016-04-13 14:17:22 +00:00
# The `make build` command compiles
# the build flags, gets the project
# dependencies, and runs a build.
2016-02-26 17:24:22 +00:00
.PHONY: build
build: LDF += $(shell GOPATH=${GOPATH} build/flags.sh)
build:
2016-09-28 17:07:08 +00:00
CGO_ENABLED=0 $(GO) build -v -ldflags '$(LDF)'
2016-02-26 17:24:22 +00:00
2016-03-17 00:07:53 +00:00
# The `make install` command compiles
# the build flags, gets the project
# dependencies, and runs an install.
2016-02-26 17:24:22 +00:00
.PHONY: install
install: LDF += $(shell GOPATH=${GOPATH} build/flags.sh)
install:
2016-09-28 17:07:08 +00:00
CGO_ENABLED=0 $(GO) install -v -ldflags '$(LDF)'
2016-07-04 23:03:48 +00:00
# The `make ember` command compiles
# the ember project, and outputs
# the build files in the app folder.
.PHONY: ember
2016-08-10 09:53:03 +00:00
ember:
2017-01-13 19:11:17 +00:00
cd gui && make setup
cd gui && make install
cd gui && make tests
2016-08-10 09:53:03 +00:00
cd gui && ember build -prod -o ../app/