forked from skydive-project/skydive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
181 lines (146 loc) · 3.68 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
define VERSION_CMD =
eval ' \
define=""; \
version=`git describe --abbrev=0 --tags | tr -d "[a-z]"` ; \
[ -z "$$version" ] && version="unknown"; \
commit=`git rev-parse --verify HEAD`; \
tagname=`git show-ref --tags | grep $$commit`; \
if [ -n "$$tagname" ]; then \
define=`echo $$tagname | awk -F "/" "{print \\$$NF}" | tr -d "[a-z]"`; \
else \
define=`printf "$$version-%.12s" $$commit`; \
fi; \
tainted=`git ls-files -m | wc -l` ; \
if [ "$$tainted" -gt 0 ]; then \
define="$${define}-tainted"; \
fi; \
echo "$$define" \
'
endef
VERSION?=$(shell $(VERSION_CMD))
GO?=go
BUILD_ID:=$(shell echo 0x$$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n'))
SKYDIVE_GITHUB:=github.com/skydive-project/skydive
SKYDIVE_PKG:=skydive-${VERSION}
SKYDIVE_PATH:=$(SKYDIVE_PKG)/src/$(SKYDIVE_GITHUB)/
SKYDIVE_GITHUB_VERSION:=$(SKYDIVE_GITHUB)/version.Version=${VERSION}
VERBOSE_FLAGS?=
VERBOSE?=true
ifeq ($(VERBOSE), true)
VERBOSE_FLAGS+=-v
endif
BUILD_TAGS?=$(TAGS)
WITH_LXD?=true
WITH_OPENCONTRAIL?=true
WITH_LIBVIRT_GO?=true
WITH_EBPF_DOCKER_BUILDER?=true
WITH_VPP?=false
WITH_PACKETINJECT?=true
EXTRA_BUILD_TARGET=
ifeq ($(WITH_DPDK), true)
BUILD_TAGS+=dpdk
endif
ifeq ($(WITH_EBPF), true)
BUILD_TAGS+=ebpf
EXTRA_BUILD_TARGET+=.ebpf
endif
ifeq ($(WITH_PROF), true)
BUILD_TAGS+=prof
endif
ifeq ($(WITH_SCALE), true)
BUILD_TAGS+=scale
endif
ifeq ($(WITH_NEUTRON), true)
BUILD_TAGS+=neutron
endif
ifeq ($(WITH_CDD), true)
BUILD_TAGS+=cdd
endif
ifeq ($(WITH_MUTEX_DEBUG), true)
BUILD_TAGS+=insanelock
endif
ifeq ($(WITH_K8S), true)
BUILD_TAGS+=k8s
endif
ifeq ($(WITH_ISTIO), true)
BUILD_TAGS+=k8s istio
endif
ifeq ($(WITH_LXD), true)
BUILD_TAGS+=lxd
endif
ifeq ($(WITH_LIBVIRT_GO), true)
BUILD_TAGS+=libvirt
endif
ifeq ($(WITH_VPP), true)
BUILD_TAGS+=vpp
endif
ifeq ($(WITH_OPENCONTRAIL), true)
BUILD_TAGS+=opencontrail
endif
ifeq ($(WITH_PACKETINJECT), true)
BUILD_TAGS+=packetinject
endif
ifeq ($(WITH_OVN), true)
BUILD_TAGS+=ovn
endif
ifeq ($(WITH_OVNK8S), true)
BUILD_TAGS+=k8s ovn ovnk8s
endif
include .mk/ebpf.mk
include .mk/api.mk
include .mk/bench.mk
include .mk/ui.mk
include .mk/bindata.mk
include .mk/check.mk
include .mk/contrib.mk
include .mk/debug.mk
include .mk/dist.mk
include .mk/easyjson.mk
include .mk/gendecoder.mk
include .mk/proto.mk
include .mk/static.mk
include .mk/tests.mk
include .mk/vppapi.mk
include .mk/swagger.mk
include .mk/stringer.mk
include .mk/ovn.mk
.DEFAULT_GOAL := all
.PHONY: all install
all install: skydive
.PHONY: version
version:
@echo -n ${VERSION}
define GOCOMPILE
CGO_CFLAGS_ALLOW='.*' CGO_LDFLAGS_ALLOW='.*' $(GO) $1 \
-ldflags="${LDFLAGS} -B $(BUILD_ID) -X $(SKYDIVE_GITHUB_VERSION)" \
${GOFLAGS} -tags="${BUILD_TAGS}" ${VERBOSE_FLAGS} \
${SKYDIVE_GITHUB}
endef
.PHONY: .build
.build:
$(call GOCOMPILE,build)
.PHONY: build
build: gopath moddownload genlocalfiles .build
.PHONY: .install
.install:
$(call GOCOMPILE,install)
.PHONY: skydive
skydive: gopath moddownload genlocalfiles .install
.PHONY: skydive.clean
skydive.clean:
go clean -i $(SKYDIVE_GITHUB)
.PHONY: moddownload
moddownload:
ifneq ($(OFFLINE), true)
go mod download
endif
.PHONY: genlocalfiles
genlocalfiles: $(EXTRA_BUILD_TARGET) .proto .typescript .bindata .ovnmodel .gendecoder .easyjson .vppbinapi
.PHONY: touchlocalfiles
touchlocalfiles: .proto.touch .typescript.touch .bindata.touch .gendecoder.touch .easyjson.touch
.PHONY: clean
clean: skydive.clean test.functionals.clean contribs.clean .ebpf.clean .easyjson.clean .proto.clean .gendecoder.clean .ovnmodel.clean .typescript.clean .vppbinapi.clean swagger.clean
go clean -i >/dev/null 2>&1 || true
.PHONY: docker
docker:
docker build . -t $(DOCKER_IMAGE):$(DOCKER_TAG)