-
Notifications
You must be signed in to change notification settings - Fork 29
/
Makefile
64 lines (53 loc) · 1.54 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
63
64
UNAME_S := $(shell uname -s 2>/dev/null)
ifeq ($(UNAME_S),Linux)
OS = Linux
endif
CPU_OSARCH = "linux/arm64 linux/arm linux/amd64 linux/ppc64le linux/mips64 linux/390x linux/386 darwin/arm64 darwin/amd64"
CPUD_OSARCH = "linux/arm64 linux/arm linux/amd64 linux/ppc64le linux/mips64 linux/390x linux/386"
.PHONY: all go gox docker rust
all: go gox docker rust
go:
ifeq (, $(shell which go))
$(info No go in PATH, install go if you want to build with it)
else
mkdir -p bin
-CGO_ENABLED=0 go build -o bin/cpu ./cmds/cpu/.
-CGO_ENABLED=0 go build -o bin/decpu ./cmds/decpu/.
ifeq ($(OS),Linux)
-CGO_ENABLED=0 go build -o bin/cpud ./cmds/cpud/.
-CGO_ENABLED=0 go build -tags mDNS -o bin/decpud ./cmds/cpud/.
endif
endif
gox:
ifeq (, $(shell which gox))
$(info No gox in PATH, install go if you want to build with it)
else
mkdir -p bin
-(cd bin && CGO_ENABLED=0 gox -osarch=$(CPU_OSARCH) ../cmds/cpu/.)
-(cd bin && CGO_ENABLED=0 gox -osarch=$(CPUD_OSARCH) ../cmds/cpud/.)
-(cd bin && CGO_ENABLED=0 gox -osarch=$(CPU_OSARCH) ../cmds/decpu/.)
endif
test:
go test ./...
docker:
ifeq (, $(shell which docker))
$(info No docker in PATH, install docker if you want to create images")
else
-docker build . -t cpud:latest
-IMAGE=cpud:latest ./TESTDOCKERCPU
endif
rust:
ifeq (, $(shell which cargo))
$(info No cargo in PATH, install rust if you want to build with it)
else
-cargo build --release
endif
rust-format:
ifeq (, $(shell which cargo))
$(info No cargo in PATH, install rust if you want to build with it)
else
-cargo fmt
endif
clean:
rm -rf bin
rm -rf target