-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
48 lines (33 loc) · 1.04 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
GOFILES := $(shell find . -name '*.go')
GOFLAG :=
GOBUILD := CGO_ENABLED=0 go build -v
GOARCHS := linux-amd64 linux-arm64 darwin-amd64 darwin-arm64
buildarchdirs := $(foreach a,$(GOARCHS),build/arch/nodemux-$a)
build: bin/nodemux bin/nodemux-dail
all: test build
bin/nodemux: ${GOFILES}
${GOBUILD} ${GOFLAG} -o $@ cmds/nodemux/main.go
bin/nodemux-dail: ${GOFILES}
${GOBUILD} ${GOFLAG} -o $@ cmds/dail/main.go
test:
go test -v ./...
clean:
rm -rf build dist bin/nodemux bin/nodemux-dail
golint:
go fmt ./...
go vet ./...
run-example: bin/nodemux
bin/nodemux -f examples/nodemux.example.yml -server examples/server.example.yml
# cross build distributions of multiple targets
archs:
@for arch in $(GOARCHS); do \
$(MAKE) dist/nodemux-$$arch.tar.gz; \
done
dist/nodemux-%.tar.gz: build/arch/nodemux-%
mkdir -p dist
tar czvf $@ $<
build/arch/nodemux-%: ${GOFILES}
GOOS=$(shell echo $@|cut -d- -f 2) \
GOARCH=$(shell echo $@|cut -d- -f 3) \
${GOBUILD} ${GOFLAG} -o $@/nodemux nodemux.go
.PHONY: build all test govet gofmt archs run-example