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
|
|
|
|
FLG :=
|
|
|
|
LDF :=
|
|
|
|
PKG := ./...
|
|
|
|
|
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-03-17 00:07:53 +00:00
|
|
|
default: clean build install
|
|
|
|
|
|
|
|
# The `make all` command cleans the
|
|
|
|
# go build and test files, runs all
|
|
|
|
# tests, and runs a build and install.
|
|
|
|
# This is used for circleci tests.
|
|
|
|
|
|
|
|
.PHONY: all
|
|
|
|
all: clean test build install
|
|
|
|
|
|
|
|
# The `make doc` command runs the godoc
|
|
|
|
# web gui, for all golang projects in
|
|
|
|
# the GO src directory
|
2016-02-26 17:24:22 +00:00
|
|
|
|
2016-03-14 16:37:18 +00:00
|
|
|
.PHONY: doc
|
|
|
|
doc:
|
|
|
|
godoc -http=:9000
|
|
|
|
|
2016-03-17 00:07:53 +00:00
|
|
|
# The `make dev` command downloads or
|
|
|
|
# updates 'gin', and runs an auto-updating
|
|
|
|
# development server.
|
|
|
|
|
2016-02-26 17:24:22 +00:00
|
|
|
.PHONY: dev
|
|
|
|
dev:
|
2016-03-17 00:07:53 +00:00
|
|
|
$(GO) get -u github.com/codegangsta/gin
|
2016-02-26 17:24:22 +00:00
|
|
|
gin -p 3000 -a 33693
|
|
|
|
|
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:
|
|
|
|
$(GO) get -u github.com/smartystreets/goconvey
|
|
|
|
goconvey -packages 25 -port 5000
|
|
|
|
|
|
|
|
# The `make get` command ensures that
|
|
|
|
# all imported code is up-to-date,
|
|
|
|
# and also gets and embeds c-rocksdb.
|
|
|
|
|
|
|
|
.PHONY: get
|
|
|
|
get:
|
|
|
|
$(GO) get -d ./...
|
|
|
|
$(GO) get -tags=embed github.com/tecbot/gorocksdb
|
|
|
|
|
|
|
|
# The `make test` command runs all
|
|
|
|
# tests, found within all sub-folders
|
|
|
|
# in the project folder.
|
|
|
|
|
|
|
|
.PHONY: test
|
|
|
|
test:
|
|
|
|
$(GO) test -v $(FLG) ./...
|
|
|
|
|
|
|
|
# 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:
|
|
|
|
$(GO) clean $(FLG) -i github.com/abcum/...
|
|
|
|
find . -name '*.test' -type f -exec rm -f {} \;
|
|
|
|
|
2016-03-17 00:07:53 +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)
|
2016-03-17 00:07:53 +00:00
|
|
|
build: get
|
2016-02-26 17:24:22 +00:00
|
|
|
build:
|
|
|
|
$(GO) build -v -o surreal $(FLG) -ldflags '$(LDF)'
|
|
|
|
|
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)
|
2016-03-17 00:07:53 +00:00
|
|
|
install: get
|
2016-02-26 17:24:22 +00:00
|
|
|
install:
|
|
|
|
$(GO) install -v $(FLG) -ldflags '$(LDF)'
|
2016-03-17 00:07:53 +00:00
|
|
|
|
|
|
|
# The `make cockroach` command ensures
|
|
|
|
# that cockroachdb is downloads and
|
|
|
|
# installed, ready for testing.
|
|
|
|
|
|
|
|
.PHONY: cockroach
|
|
|
|
cockroach:
|
|
|
|
$(GO) get -d github.com/cockroachdb/cockroach
|
|
|
|
$(GO) get -d ../../cockroachdb/cockroach/...
|
|
|
|
make -C ../../cockroachdb/cockroach clean
|
|
|
|
make -C ../../cockroachdb/cockroach build
|
|
|
|
make -C ../../cockroachdb/cockroach install
|