forked from genuinetools/bpfd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
37 lines (29 loc) · 992 Bytes
/
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
# Setup name variables for the package/tool
NAME := bpfd
PKG := github.com/genuinetools/$(NAME)
CGO_ENABLED := 1
# Set any default go build tags.
BUILDTAGS :=
include basic.mk
.PHONY: prebuild
prebuild:
DOCKER_FLAGS+=--rm -i \
--disable-content-trust=true
DOCKER_FLAGS+=-v $(CURDIR):/go/src/$(PKG)
DOCKER_FLAGS+=--workdir /go/src/$(PKG)
.PHONY: test-container
test-container: image-dev ## Run a command in a test container with all the needed dependencies (ex. CMD=make test).
@:$(call check_defined, CMD, command to run in the container)
docker run $(DOCKER_FLAGS) \
$(REGISTRY)/$(NAME):dev \
"$(CMD)"
GRPC_API_DIR=api/grpc
.PHONY:protoc
protoc: $(CURDIR)/$(GRPC_API_DIR)/api.pb.go ## Generate the protobuf files.
$(CURDIR)/$(GRPC_API_DIR)/api.pb.go: image-dev $(CURDIR)/$(GRPC_API_DIR)/api.proto
docker run $(DOCKER_FLAGS) \
--entrypoint protoc \
$(REGISTRY)/$(NAME):dev \
-I./$(GRPC_API_DIR) \
./$(GRPC_API_DIR)/api.proto \
--go_out=plugins=grpc:$(GRPC_API_DIR)