-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
62 lines (48 loc) 路 1.8 KB
/
Copy pathMakefile
File metadata and controls
62 lines (48 loc) 路 1.8 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
57
58
59
60
61
62
PACKAGES=$(shell go list ./... | grep -v /vendor/)
RACE := $(shell test $$(go env GOARCH) != "amd64" || (echo "-race"))
BINARY=xdbg
# target
VERSION ?= `git rev-parse --short HEAD`
# Use linker flags to provide version/build settings to the target
LDFLAGS=-ldflags "-X=github.com/jami/xdebug-cli/cfg.version=$(VERSION)"
all: build/local
help:
@echo 'Available commands:'
@echo
@echo 'Usage:'
@echo ' make deps Install go deps.'
@echo ' make build Compile the project.'
@echo ' make build/docker Restore all dependencies.'
@echo ' make restore Restore all dependencies.'
@echo ' make clean Clean the directory tree.'
@echo
test: ## run tests, except integration tests
@go test -v ${RACE} ${PACKAGES}
deps:
go get -u github.com/tcnksm/ghr
go get -u github.com/mitchellh/gox
go get -u github.com/golang/dep/cmd/dep
go get -u github.com/mitchellh/go-homedir
go get -u github.com/spf13/cobra
go get -u github.com/spf13/viper
build:
@echo "Compiling all arch targets ..."
@mkdir -p ./bin
@gox $(LDFLAGS) -output "bin/${BINARY}_{{.OS}}_{{.Arch}}" -os="linux" -os="darwin" -arch="386" -arch="amd64" ./
@echo "All done! The binaries is in ./bin let's have fun!"
build/local:
@echo "Compiling local arch ..."
@mkdir -p ./bin
@go build $(LDFLAGS) -i -o "./bin/${BINARY}"
build/release:
@echo "Compiling..."
@mkdir -p ./bin
@gox $(LDFLAGS) -ldflags '-w -extldflags "-static"' -output "bin/${BINARY}_{{.OS}}_{{.Arch}}" -os="linux" -os="darwin" -arch="386" -arch="amd64" ./
@echo "All done! The binaries is in ./bin let's have fun!"
build/docker: build/release
@docker build -t xdbg-example:latest .
vet: ## run go vet
@test -z "$$(go vet ${PACKAGES} 2>&1 | grep -v '*composite literal uses unkeyed fields|exit status 0)' | tee /dev/stderr)"
ci: vet test
restore:
@dep ensure