-
Notifications
You must be signed in to change notification settings - Fork 32
/
Makefile
39 lines (30 loc) · 1.36 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
.PHONY: all install build libcswsscommon clean
GO := /usr/local/go/bin/go
export GOROOT=/usr/local/go
export GOPATH=$(HOME)/go
export GOBIN=$(GOPATH)/bin
export GO111MODULE=on
export GOFLAGS=-modcacherw
RACE_OPTION := -race
ifeq ($(CONFIGURED_ARCH),armhf)
RACE_OPTION :=
endif
all: install build
install: build
/usr/bin/install -D $(GOPATH)/bin/go-server-server debian/sonic-rest-api/usr/sbin/go-server-server
/usr/bin/install -D $(GOPATH)/bin/go-server-server.test debian/sonic-rest-api/usr/sbin/go-server-server.test
build: $(GOPATH)/bin/go-server-server $(GOPATH)/bin/go-server-server.test
$(GOPATH)/bin/go-server-server: libcswsscommon $(GOPATH)/src/go-server-server/main.go
cd $(GOPATH)/src/go-server-server && $(GO) get -v && $(GO) build $(RACE_OPTION) -v -o $(GOPATH)/bin/go-server-server
$(GOPATH)/bin/go-server-server.test: libcswsscommon $(GOPATH)/src/go-server-server/main.go
cd $(GOPATH)/src/go-server-server && $(GO) get -v && $(GO) test $(RACE_OPTION) -c -covermode=atomic -coverpkg "go-server-server/go" -v -o $(GOPATH)/bin/go-server-server.test
$(GOPATH)/src/go-server-server/main.go:
mkdir -p $(GOPATH)/src
cp -r go-server-server $(GOPATH)/src/go-server-server
cp -r swsscommon $(GOPATH)/src/swsscommon
libcswsscommon:
make -C libcswsscommon
sudo make -C libcswsscommon install
clean:
rm -rf $(GOPATH)
make -C libcswsscommon clean