2015-05-15 20:20:40 +00:00
|
|
|
.DEFAULT_GOAL=test
|
2015-08-03 14:34:39 +00:00
|
|
|
UNAME=$(shell uname)
|
2015-03-01 03:07:08 +00:00
|
|
|
PREFIX=github.com/derekparker/delve
|
2015-08-03 14:34:39 +00:00
|
|
|
GOVERSION=$(shell go version)
|
2017-02-10 14:11:40 +00:00
|
|
|
LLDB_SERVER=$(shell which lldb-server)
|
2015-12-13 21:51:11 +00:00
|
|
|
|
|
|
|
ifeq "$(UNAME)" "Darwin"
|
2017-04-28 17:14:33 +00:00
|
|
|
BUILD_FLAGS=-ldflags="-s"
|
2015-12-13 21:51:11 +00:00
|
|
|
endif
|
2015-07-31 18:43:35 +00:00
|
|
|
|
2015-10-01 00:50:51 +00:00
|
|
|
# Workaround for GO15VENDOREXPERIMENT bug (https://github.com/golang/go/issues/11659)
|
2016-04-29 18:58:19 +00:00
|
|
|
ALL_PACKAGES=$(shell go list ./... | grep -v /vendor/ | grep -v /scripts)
|
2015-10-01 00:50:51 +00:00
|
|
|
|
2015-07-31 18:43:35 +00:00
|
|
|
# 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.
|
2015-09-26 00:19:09 +00:00
|
|
|
ifeq "$(UNAME)" "Darwin"
|
2015-10-10 04:39:17 +00:00
|
|
|
TEST_FLAGS=-exec=$(shell pwd)/scripts/testsign
|
2017-02-10 14:11:40 +00:00
|
|
|
export PROCTEST=lldb
|
2015-10-01 00:50:51 +00:00
|
|
|
DARWIN="true"
|
2015-07-31 18:43:35 +00:00
|
|
|
endif
|
2015-03-01 03:07:08 +00:00
|
|
|
|
2015-08-03 14:34:39 +00:00
|
|
|
# If we're on OSX make sure the proper CERT env var is set.
|
2015-08-08 19:30:43 +00:00
|
|
|
check-cert:
|
|
|
|
ifneq "$(TRAVIS)" "true"
|
2015-10-01 00:50:51 +00:00
|
|
|
ifdef DARWIN
|
2015-05-19 19:44:09 +00:00
|
|
|
ifeq "$(CERT)" ""
|
2017-03-13 17:59:10 +00:00
|
|
|
scripts/gencert.sh || (echo "An error occurred when generating and installing a new certicate"; exit 1)
|
|
|
|
CERT = dlv-cert
|
2015-08-03 14:34:39 +00:00
|
|
|
endif
|
2015-05-19 19:44:09 +00:00
|
|
|
endif
|
2015-08-08 19:30:43 +00:00
|
|
|
endif
|
2015-08-03 14:34:39 +00:00
|
|
|
|
2015-10-01 00:31:01 +00:00
|
|
|
build: check-cert
|
2015-10-10 04:39:17 +00:00
|
|
|
go build $(BUILD_FLAGS) github.com/derekparker/delve/cmd/dlv
|
2015-10-01 00:50:51 +00:00
|
|
|
ifdef DARWIN
|
2016-11-18 07:21:50 +00:00
|
|
|
ifdef CERT
|
|
|
|
codesign -s "$(CERT)" ./dlv
|
2016-04-24 17:26:12 +00:00
|
|
|
endif
|
2015-03-01 03:07:08 +00:00
|
|
|
endif
|
|
|
|
|
2015-10-01 00:31:01 +00:00
|
|
|
install: check-cert
|
2015-10-10 04:39:17 +00:00
|
|
|
go install $(BUILD_FLAGS) github.com/derekparker/delve/cmd/dlv
|
2015-10-01 00:50:51 +00:00
|
|
|
ifdef DARWIN
|
2016-04-24 17:26:12 +00:00
|
|
|
ifneq "$(GOBIN)" ""
|
|
|
|
codesign -s "$(CERT)" $(GOBIN)/dlv
|
|
|
|
else
|
|
|
|
codesign -s "$(CERT)" $(GOPATH)/bin/dlv
|
|
|
|
endif
|
2015-03-01 03:07:08 +00:00
|
|
|
endif
|
|
|
|
|
2015-10-01 00:31:01 +00:00
|
|
|
test: check-cert
|
2015-08-03 14:34:39 +00:00
|
|
|
ifeq "$(TRAVIS)" "true"
|
2015-10-10 01:03:24 +00:00
|
|
|
ifdef DARWIN
|
2015-10-01 00:50:51 +00:00
|
|
|
sudo -E go test -v $(ALL_PACKAGES)
|
2015-08-03 14:34:39 +00:00
|
|
|
else
|
2015-10-10 04:39:17 +00:00
|
|
|
go test $(TEST_FLAGS) $(BUILD_FLAGS) $(ALL_PACKAGES)
|
2015-03-01 03:07:08 +00:00
|
|
|
endif
|
2015-10-10 01:03:24 +00:00
|
|
|
else
|
2015-10-10 04:39:17 +00:00
|
|
|
go test $(TEST_FLAGS) $(BUILD_FLAGS) $(ALL_PACKAGES)
|
2015-10-10 01:03:24 +00:00
|
|
|
endif
|
2017-02-10 14:11:40 +00:00
|
|
|
ifneq "$(shell which lldb-server)" ""
|
|
|
|
@echo
|
|
|
|
@echo 'Testing LLDB backend (proc)'
|
|
|
|
go test $(TEST_FLAGS) $(BUILD_FLAGS) $(PREFIX)/pkg/proc -backend=lldb
|
|
|
|
@echo
|
|
|
|
@echo 'Testing LLDB backend (integration)'
|
|
|
|
go test $(TEST_FLAGS) $(BUILD_FLAGS) $(PREFIX)/service/test -backend=lldb
|
|
|
|
@echo
|
|
|
|
@echo 'Testing LLDB backend (terminal)'
|
|
|
|
go test $(TEST_FLAGS) $(BUILD_FLAGS) $(PREFIX)/pkg/terminal -backend=lldb
|
|
|
|
endif
|
2015-05-15 20:30:34 +00:00
|
|
|
|
2015-06-12 19:49:23 +00:00
|
|
|
test-proc-run:
|
2017-02-10 14:11:40 +00:00
|
|
|
go test $(TEST_FLAGS) $(BUILD_FLAGS) -test.v -test.run="$(RUN)" -backend=$(BACKEND) $(PREFIX)/pkg/proc
|
2015-05-15 20:30:34 +00:00
|
|
|
|
|
|
|
test-integration-run:
|
2017-02-10 14:11:40 +00:00
|
|
|
go test $(TEST_FLAGS) $(BUILD_FLAGS) -test.run="$(RUN)" -backend=$(BACKEND) $(PREFIX)/service/test
|