This repository has been archived by the owner on May 29, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathMakefile
62 lines (52 loc) · 1.8 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
SGX_OS_NAME := $(shell uname -o 2>/dev/null || uname -s)
ifeq "$(SGX_OS_NAME)" "Cygwin"
CMD := cmd /C
else
ifeq "$(SGX_OS_NAME)" "Msys"
CMD := cmd //C
else
ifneq (,$(findstring MINGW, $(SGX_OS_NAME)))
CMD := cmd //C
endif
endif
endif
ifeq ($(OS),Windows_NT)
SRCLIB_GO_EXE := .bin/srclib-go.exe
CURDIR := $(shell $(CMD) "echo %cd%")
UNIXDIR := $(subst \,/,$(CURDIR))
WINDIR := $(subst \,\\,$(CURDIR))
TESTGOPATH := $(WINDIR)\\testdata\\case\;$(WINDIR)\\.test
TESTFETCHGOPATH := $(UNIXDIR)/.test
else
SRCLIB_GO_EXE := .bin/srclib-go
TESTGOPATH := $(PWD)/testdata/case:$(PWD)/.test
TESTFETCHGOPATH := $(PWD)/.test
endif
.PHONY: install test gotest srctest
default: govendor install
install: ${SRCLIB_GO_EXE}
govendor:
go get github.com/kardianos/govendor
govendor sync
${SRCLIB_GO_EXE}: $(shell /usr/bin/find . -type f -and -name '*.go' -not -path './vendor/*')
go build -o ${SRCLIB_GO_EXE}
test: gotest srctest
gotest:
go test $(shell go list ./... | grep -v /vendor/)
GEN ?=
srctest:
# go1.5 excludes repos whose ImportPath would include testdata. Since all the
# test repos are under testdata dir, we change the GOPATH to not root the
# testdata dir
git submodule update --init
GOPATH=${TESTFETCHGOPATH} go get -d golang.org/x/net/ipv6
# prepare minimal-go-stdlib test to be used as GOROOT for the Go command:
# the compiler binary needs to be available in the pkg/tool directory
rm -rf testdata/case/src/github.com/sgtest/minimal-go-stdlib/pkg testdata/case/src/github.com/sgtest/minimal-go-stdlib/src/runtime/internal
mkdir testdata/case/src/github.com/sgtest/minimal-go-stdlib/pkg
ln -s $(shell go env GOROOT)/pkg/tool testdata/case/src/github.com/sgtest/minimal-go-stdlib/pkg/tool
@if [ -z "$$GEN" ]; then \
GOPATH=${TESTGOPATH} srclib test; \
else \
GOPATH=${TESTGOPATH} srclib test --gen; \
fi;