forked from nccgroup/tracy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
56 lines (45 loc) · 1.68 KB
/
Makefile
File metadata and controls
56 lines (45 loc) · 1.68 KB
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
BINARY = tracy
GOARCH = amd64
VERSION=0
COMMIT=$(shell git rev-parse HEAD)
BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
# Symlink into GOPATH
PROJECT_NAME=github.com/nccgroup/tracy
BUILD_DIR=${GOPATH}/src/${PROJECT_NAME}
CURRENT_DIR=$(shell pwd)
BUILD_DIR_LINK=$(shell readlink ${BUILD_DIR})
# Setup the -ldflags option for go build here, interpolate the variable values
LDFLAGS = "-X main.VERSION=${VERSION} -X main.COMMIT=${COMMIT} -X main.BRANCH=${BRANCH}"
# Build the project for all platforms. Really only for CI or builders.
all: test view bins
# Build the cross-compiled binaries with xgo. Really only for CI or builders.
bins:
dep ensure -v;
xgo -dest ${GOPATH}/src/${PROJECT_NAME}/bin --ldflags=${LDFLAGS} --targets=windows/amd64,linux/amd64,darwin/amd64 ${GOPATH}/src/${PROJECT_NAME}
# Build the view and static assets into a Go file
view:
npm --prefix ${GOPATH}/src/${PROJECT_NAME}/api/view install; \
npm --prefix ${GOPATH}/src/${PROJECT_NAME}/api/view run build; \
cd ${GOPATH}/src/${PROJECT_NAME}/api/view/; \
go-bindata-assetfs -pkg rest ./build/...; \
mv ./bindata_assetfs.go ${GOPATH}/src/${PROJECT_NAME}/api/rest/
# Format all the Go code
fmt:
cd ${BUILD_DIR}; \
go fmt $$(go list ./... | grep -v /vendor/) ; \
cd - >/dev/null
test:
rm -rf ./vendor
go test ./...
lint:
cd ${BUILD_DIR} ; \
golint $$(go list ./... | grep -v /vendor/) ; \
cd - >/dev/null
# Install the dependencies for the builder.
build-deps:
go get github.com/golang/dep/cmd/dep; \
go get github.com/golang/lint/golint; \
go get github.com/karalabe/xgo; \
go get github.com/jteeuwen/go-bindata/...; \
go get github.com/elazarl/go-bindata-assetfs/...
.PHONY: all bins view test fmt build-deps dev-deps