forked from edgexfoundry/device-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
40 lines (30 loc) · 1013 Bytes
/
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
.PHONY: build test clean docker
GO=CGO_ENABLED=0 GO111MODULE=on go
GOCGO=CGO_ENABLED=1 GO111MODULE=on go
MICROSERVICES=example/cmd/device-simple/device-simple
.PHONY: $(MICROSERVICES)
VERSION=$(shell cat ./VERSION 2>/dev/null || echo 0.0.0)
DOCKER_TAG=$(VERSION)-dev
GOFLAGS=-ldflags "-X github.com/edgexfoundry/device-sdk-go.Version=$(VERSION)"
GOTESTFLAGS?=-race
GIT_SHA=$(shell git rev-parse HEAD)
build: $(MICROSERVICES)
$(GO) install -tags=safe
example/cmd/device-simple/device-simple:
$(GO) build $(GOFLAGS) -o $@ ./example/cmd/device-simple
docker:
docker build \
-f example/cmd/device-simple/Dockerfile \
--label "git_sha=$(GIT_SHA)" \
-t edgexfoundry/docker-device-sdk-simple:$(GIT_SHA) \
-t edgexfoundry/docker-device-sdk-simple:$(DOCKER_TAG) \
.
test:
GO111MODULE=on go test $(GOTESTFLAGS) -coverprofile=coverage.out ./...
GO111MODULE=on go vet ./...
gofmt -l .
[ "`gofmt -l .`" = "" ]
./bin/test-attribution-txt.sh
./bin/test-go-mod-tidy.sh
clean:
rm -f $(MICROSERVICES)