-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
45 lines (35 loc) · 2.1 KB
/
Makefile
File metadata and controls
45 lines (35 loc) · 2.1 KB
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
GOFMT=gofmt
GC=go build --tags "json1"
LAST_VERSION := $(shell git describe --match "v*" --always --tags)
VERSION_PARTS := $(subst ., ,$(LAST_VERSION))
MAJOR := $(word 1,$(VERSION_PARTS))
MINOR := $(word 2,$(VERSION_PARTS))
MICRO := $(word 3,$(VERSION_PARTS))
NEXT_MICRO := $(shell echo $$(($(MICRO)+1)))
VERSION := $(MAJOR).$(MINOR).$(NEXT_MICRO)
EDGE_GITCOMMIT=$(shell git log -1 --pretty=format:"%H")
PYLONS_GITCOMMIT=$(shell cd .. && cd pylons && git log -1 --pretty=format:"%H")
CARRIER_GITCOMMIT=$(shell cd .. && cd carrier && git log -1 --pretty=format:"%H")
MAX_GITCOMMIT=$(shell cd .. && cd max && git log -1 --pretty=format:"%H")
DSP_GITCOMMIT=$(shell cd .. && cd dsp-go-sdk && git log -1 --pretty=format:"%H")
SCAN_GITCOMMIT=$(shell cd .. && cd scan && git log -1 --pretty=format:"%H")
ARM64_CC=/home/dasein/toolchain-aarch64_cortex-a53_gcc-8.2.0_glibc/bin/aarch64-openwrt-linux-gnu-gcc
BUILD_EDGE_PAR =-v -ldflags "-s -w -X github.com/saveio/edge/dsp.Version=$(VERSION) -X github.com/saveio/pylons.Version=${PYLONS_GITCOMMIT} -X github.com/saveio/carrier/network.Version=${CARRIER_GITCOMMIT} -X github.com/saveio/max/max.Version=${MAX_GITCOMMIT} -X github.com/saveio/dsp-go-sdk/dsp.Version=${DSP_GITCOMMIT} -X github.com/saveio/scan/common/config.VERSION=$(SCAN_GITCOMMIT)"
all: client
client:
$(GC) $(BUILD_EDGE_PAR) -o ./edge ./bin/edge/main.go
do-cross: w-dsp l-dsp d-dsp
w-dsp:
CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ GOOS=windows GOARCH=amd64 $(GC) $(BUILD_EDGE_PAR) -o edge-windows-amd64.exe ./bin/edge/main.go
l-dsp:
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 $(GC) $(BUILD_EDGE_PAR) -o edge-linux-amd64 ./bin/edge/main.go
d-dsp:
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 $(GC) $(BUILD_EDGE_PAR) -o edge-darwin-amd64 ./bin/edge/main.go
d-dsp-arm64:
CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 $(GC) $(BUILD_EDGE_PAR) -o edge-darwin-arm64 ./bin/edge/main.go
arm64-dsp:
CGO_ENABLED=1 GOOS=linux GOARCH=arm64 CC=${ARM64_CC} $(GC) $(BUILD_EDGE_PAR) -o edge-linux-arm64 ./bin/edge/main.go
format:
$(GOFMT) -w main.go
clean:
rm -rf *.8 *.o *.out *.6 *exe