forked from go-delve/delve
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
70 lines (61 loc) · 1.79 KB
/
Makefile
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
63
64
65
66
67
68
69
70
.DEFAULT_GOAL=test
UNAME=$(shell uname)
PREFIX=github.com/derekparker/delve
GOVERSION=$(shell go version)
BUILD_SHA=$(shell git rev-parse HEAD)
ifeq "$(UNAME)" "Darwin"
BUILD_FLAGS=-ldflags="-s -X main.Build=$(BUILD_SHA)"
else
BUILD_FLAGS=-ldflags="-X main.Build=$(BUILD_SHA)"
endif
# Workaround for GO15VENDOREXPERIMENT bug (https://github.com/golang/go/issues/11659)
ALL_PACKAGES=$(shell go list ./... | grep -v /vendor/ | grep -v /scripts)
# We must compile with -ldflags="-s" to omit
# DWARF info on OSX when compiling with the
# 1.5 toolchain. Otherwise the resulting binary
# will be malformed once we codesign it and
# unable to execute.
# See https://github.com/golang/go/issues/11887#issuecomment-126117692.
ifeq "$(UNAME)" "Darwin"
TEST_FLAGS=-exec=$(shell pwd)/scripts/testsign
DARWIN="true"
endif
# If we're on OSX make sure the proper CERT env var is set.
check-cert:
ifneq "$(TRAVIS)" "true"
ifdef DARWIN
ifeq "$(CERT)" ""
$(error You must provide a CERT environment variable in order to codesign the binary.)
endif
endif
endif
build: check-cert
go build $(BUILD_FLAGS) github.com/derekparker/delve/cmd/dlv
ifdef DARWIN
ifdef CERT
codesign -s "$(CERT)" ./dlv
endif
endif
install: check-cert
go install $(BUILD_FLAGS) github.com/derekparker/delve/cmd/dlv
ifdef DARWIN
ifneq "$(GOBIN)" ""
codesign -s "$(CERT)" $(GOBIN)/dlv
else
codesign -s "$(CERT)" $(GOPATH)/bin/dlv
endif
endif
test: check-cert
ifeq "$(TRAVIS)" "true"
ifdef DARWIN
sudo -E go test -v $(ALL_PACKAGES)
else
go test $(TEST_FLAGS) $(BUILD_FLAGS) $(ALL_PACKAGES)
endif
else
go test $(TEST_FLAGS) $(BUILD_FLAGS) $(ALL_PACKAGES)
endif
test-proc-run:
go test $(TEST_FLAGS) $(BUILD_FLAGS) -test.v -test.run="$(RUN)" $(PREFIX)/proc
test-integration-run:
go test $(TEST_FLAGS) $(BUILD_FLAGS) -test.run="$(RUN)" $(PREFIX)/service/test