-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathMakefile
64 lines (50 loc) · 1.64 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
.PHONY: build-linux
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) unpack
BINARY_NAME=main
BINARY_LINUX=$(BINARY_NAME)-linux
GORELEASER_BIN = $(shell pwd)/bin/goreleaser
SHELL = /usr/bin/env bash -o pipefail
.SHELLFLAGS = -ec
# go-get-tool will 'go get' any package $2 and install it to $1.
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
define go-get-tool
@[ -f $(1) ] || { \
set -e ;\
TMP_DIR=$$(mktemp -d) ;\
cd $$TMP_DIR ;\
go mod init tmp ;\
echo "Downloading $(2)" ;\
GOBIN=$(PROJECT_DIR)/bin go install $(2) ;\
rm -rf $$TMP_DIR ;\
}
endef
install-goreleaser: ## check license if not exist install go-lint tools
#goimports -l -w cmd
#goimports -l -w pkg
$(call go-get-tool,$(GORELEASER_BIN),github.com/goreleaser/goreleaser@v1.6.3)
build:
mkdir -p bin
$(GOBUILD) -v -o ./bin/AIservice -gcflags "-N -l -c 10" ./main/main.go
cp -r ./cgo/library/* ./bin/
mkdir -p bin/include
cp -r ./cgo/header/widget/* ./bin/include
clean:
rm -rf bin dist
pack:
tar -acvf aiservice.tar.gz ./bin
mkdir -p dist
mv aiservice.tar.gz dist
dist: build pack
build-pack: SHELL:=/bin/bash
build-pack: install-goreleaser ## build binaries by default
@echo "build aiges bin"
$(GORELEASER_BIN) build --snapshot --rm-dist --timeout=1h
build-release: SHELL:=/bin/bash
build-release: install-goreleaser ## build binaries by default
@echo "build sealos bin"
$(GORELEASER_BIN) release --timeout=1h --release-notes=hack/release/Note.md --debug --rm-dist
proto:
protoc --go_out=./grpc/ --go-grpc_out=require_unimplemented_servers=false:./grpc/ ./grpc/proto/aiges_inner.proto ./grpc/proto/ai.proto && echo success generated.!!