forked from yunionio/notify-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
51 lines (38 loc) · 1.43 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
ROOT_DIR := $(CURDIR)
BUILD_DIR := $(ROOT_DIR)/_output
BIN_DIR := $(BUILD_DIR)/bin
BUILD_SCRIPT := $(ROOT_DIR)/build/build.sh
ARCH ?= amd64
REGISTRY ?= "registry.cn-beijing.aliyuncs.com/yunionio"
VERSION ?= $(shell git describe --exact-match 2> /dev/null || \
git describe --match=$(git rev-parse --short=8 HEAD) --always --dirty --abbrev=8)
ifneq ($(DLV),)
GO_BUILD_FLAGS += -gcflags "all=-N -l"
endif
GO_BUILD_FLAGS+=-mod vendor -buildvcs=false
export GO111MODULE=on
cmdTargets:=$(filter-out ,$(wildcard cmd/*))
rpmTargets:=$(foreach b,$(patsubst cmd/%,%,$(cmdTargets)),$(if $(shell [ -f "$(CURDIR)/build/$(b)/vars" ] && echo 1),rpm/$(b)))
all:
$(MAKE) $(cmdTargets)
#.PHONY: cmd/*
fmt:
cmd/%: fmt
go build $(GO_BUILD_FLAGS) -o $(BIN_DIR)/$(shell basename $@) yunion.io/x/notify-plugins/$@
image:
REGISTRY=${REGISTRY} TAG=${VERSION} ARCH=${ARCH} ${ROOT_DIR}/scripts/docker_push.sh
image-push:
PUSH=true REGISTRY=${REGISTRY} TAG=${VERSION} ARCH=${ARCH} ${ROOT_DIR}/scripts/docker_push.sh
rpm/%: cmd/%
$(BUILD_SCRIPT) $*
rpm:
$(MAKE) $(rpmTargets)
rpmclean:
rm -fr $(BUILD_DIR)/rpms
ONECLOUD_RELEASE_BRANCH:=master
GOPROXY ?= direct
mod:
GOPROXY=$(GOPROXY) GOSUMDB=off go get yunion.io/x/onecloud@$(ONECLOUD_RELEASE_BRANCH)
GOPROXY=$(GOPROXY) GOSUMDB=off go get -d $(patsubst %,%@master,$(shell GO111MODULE=on go mod edit -print | sed -n -e 's|.*\(yunion.io/x/[a-z].*\) v.*|\1|p' | grep -v '/onecloud$$'))
go mod tidy -v
go mod vendor -v