-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
48 lines (35 loc) · 1.41 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
ORG_ID := 770408c
ORG_VER := v0.8.1
BUILD_TIME := $(shell date --iso-8601=seconds)
GOFLAGS_RELEASE := -ldflags "-s -w -X 'main.Time=$(BUILD_TIME)' -X 'main.ID=$(ORG_ID)' -X 'main.Ver=$(ORG_VER)'"
GOFLAGS_DEBUG := -gcflags="all=-N -l" -ldflags "-X 'main.Time=$(BUILD_TIME)' -X 'main.ID=$(ORG_ID)' -X 'main.Ver=$(ORG_VER)'"
all: debug
release:
mkdir -p out
go build $(GOFLAGS_RELEASE) -o ./out/ github.com/mkrainbow/rtio/cmd/...
@ mkdir -p out/examples
@ if [ ! -d ./out/examples/certificates ]; then cp -v -r ./examples/certificates ./out/examples/; fi
go build $(GOFLAGS_RELEASE) -o ./out/examples/ github.com/mkrainbow/rtio/examples/...
@ # for internal test
@ mkdir -p out/devicehub
@ go build $(GOFLAGS_RELEASE) -o ./out/devicehub github.com/mkrainbow/rtio/internal/devicehub/...
debug:
mkdir -p out
go build $(GOFLAGS_DEBUG) -o ./out/ github.com/mkrainbow/rtio/cmd/...
@ mkdir -p out/examples
@ if [ ! -d ./out/examples/certificates ]; then cp -v -r ./examples/certificates ./out/examples/; fi
go build $(GOFLAGS_DEBUG) -o ./out/examples/ github.com/mkrainbow/rtio/examples/...
@ # for internal test
@ mkdir -p out/devicehub
@ go build $(GOFLAGS_DEBUG) -o ./out/devicehub github.com/mkrainbow/rtio/internal/devicehub/...
test:
go test -count=1 -timeout 7m github.com/mkrainbow/rtio/...
clean:
go clean -i github.com/mkrainbow/rtio/...
rm -rf ./out
.PHONY: \
all \
release \
debug \
test \
clean