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)
|
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-08-03 14:34:39 +00:00
|
|
|
FLAGS=-ldflags="-s"
|
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-03-01 03:07:08 +00:00
|
|
|
ifeq "$(UNAME)" "Darwin"
|
2015-05-19 19:44:09 +00:00
|
|
|
ifeq "$(CERT)" ""
|
2015-08-03 14:34:39 +00:00
|
|
|
$(error You must provide a CERT environment variable in order to codesign the binary.)
|
|
|
|
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-08-08 19:30:43 +00:00
|
|
|
deps: check-cert
|
2015-08-28 12:59:22 +00:00
|
|
|
ifeq "$(SKIP_DEPS)" ""
|
2015-08-03 14:34:39 +00:00
|
|
|
go get -u github.com/peterh/liner
|
|
|
|
go get -u github.com/spf13/cobra
|
|
|
|
go get -u golang.org/x/sys/unix
|
|
|
|
go get -u github.com/davecheney/profile
|
2015-08-17 03:41:25 +00:00
|
|
|
go get -u gopkg.in/yaml.v2
|
2015-08-28 12:59:22 +00:00
|
|
|
endif
|
2015-08-03 14:34:39 +00:00
|
|
|
|
|
|
|
build: deps
|
|
|
|
go build $(FLAGS) github.com/derekparker/delve/cmd/dlv
|
|
|
|
ifeq "$(UNAME)" "Darwin"
|
2015-03-01 03:08:43 +00:00
|
|
|
codesign -s $(CERT) ./dlv
|
2015-03-01 03:07:08 +00:00
|
|
|
endif
|
|
|
|
|
2015-08-03 14:34:39 +00:00
|
|
|
install: deps
|
2015-07-28 19:25:16 +00:00
|
|
|
go install $(FLAGS) github.com/derekparker/delve/cmd/dlv
|
2015-03-01 03:07:08 +00:00
|
|
|
ifeq "$(UNAME)" "Darwin"
|
2015-03-01 21:37:19 +00:00
|
|
|
codesign -s $(CERT) $(GOPATH)/bin/dlv
|
2015-03-01 03:07:08 +00:00
|
|
|
endif
|
|
|
|
|
2015-08-03 14:34:39 +00:00
|
|
|
test: deps
|
2015-03-01 03:07:08 +00:00
|
|
|
ifeq "$(UNAME)" "Darwin"
|
2015-08-03 14:34:39 +00:00
|
|
|
ifeq "$(TRAVIS)" "true"
|
|
|
|
sudo -E go test -v ./...
|
|
|
|
else
|
2015-03-20 21:11:11 +00:00
|
|
|
go test $(PREFIX)/terminal $(PREFIX)/dwarf/frame $(PREFIX)/dwarf/op $(PREFIX)/dwarf/util $(PREFIX)/source $(PREFIX)/dwarf/line
|
2015-08-12 00:10:34 +00:00
|
|
|
go test -c $(FLAGS) $(PREFIX)/proc && codesign -s $(CERT) ./proc.test && ./proc.test $(TESTFLAGS) -test.v && rm ./proc.test
|
|
|
|
go test -c $(FLAGS) $(PREFIX)/service/test && codesign -s $(CERT) ./test.test && ./test.test $(TESTFLAGS) -test.v && rm ./test.test
|
2015-08-03 14:34:39 +00:00
|
|
|
endif
|
2015-03-01 03:07:08 +00:00
|
|
|
else
|
2015-04-19 22:11:33 +00:00
|
|
|
go test -v ./...
|
2015-03-01 03:07:08 +00:00
|
|
|
endif
|
2015-05-15 20:30:34 +00:00
|
|
|
|
2015-06-12 19:49:23 +00:00
|
|
|
test-proc-run:
|
2015-05-15 20:32:47 +00:00
|
|
|
ifeq "$(UNAME)" "Darwin"
|
2015-07-28 19:25:16 +00:00
|
|
|
go test -c $(FLAGS) $(PREFIX)/proc && codesign -s $(CERT) ./proc.test && ./proc.test -test.run $(RUN) && rm ./proc.test
|
2015-05-15 20:32:47 +00:00
|
|
|
else
|
2015-06-12 21:21:32 +00:00
|
|
|
go test $(PREFIX) -run $(RUN)
|
2015-05-15 20:32:47 +00:00
|
|
|
endif
|
2015-05-15 20:30:34 +00:00
|
|
|
|
|
|
|
test-integration-run:
|
2015-05-15 20:32:47 +00:00
|
|
|
ifeq "$(UNAME)" "Darwin"
|
2015-07-28 19:25:16 +00:00
|
|
|
go test -c $(FLAGS) $(PREFIX)/service/test && codesign -s $(CERT) ./test.test && ./test.test -test.run $(RUN) && rm ./test.test
|
2015-05-15 20:32:47 +00:00
|
|
|
else
|
2015-06-12 21:21:32 +00:00
|
|
|
go test $(PREFIX)/service/rest -run $(RUN)
|
2015-05-15 20:32:47 +00:00
|
|
|
endif
|