-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
37 lines (28 loc) · 1.12 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
MESOS_SRC_DIR = mesos/src
MESOS_INCLUDE_DIR = mesos/include
MESOS_INCLUDE_DIRS += -I$(MESOS_SRC_DIR)
MESOS_INCLUDE_DIRS += -I$(MESOS_INCLUDE_DIR)
MESSAGES_SRC = $(MESOS_SRC_DIR)/messages
MESOS_SRC += $(MESOS_INCLUDE_DIR)/mesos
RESOURCE_SRC += $(MESOS_INCLUDE_DIR)/mesos/resource_provider
OUTPUT_DIR = protobufs
PROTO_SRC = $(addprefix messages/,$(notdir $(wildcard $(addsuffix /*.proto,$(MESSAGES_SRC)))))
PROTO_SRC += $(addprefix mesos/,$(notdir $(wildcard $(addsuffix /*.proto,$(MESOS_SRC)))))
PROTO_SRC += $(addprefix mesos/resource_provider/,$(notdir $(wildcard $(addsuffix /*.proto,$(RESOURCE_SRC)))))
PROTO_SRC_DIR = $(wildcard $(addsuffix /*.proto,$(PROTO_DIRS)))
all: protobuf
$(OUTPUT_DIR):
mkdir -p $(OUTPUT_DIR)
protobuf: $(PROTO_SRC_DIR) $(OUTPUT_DIR)
protoc $(MESOS_INCLUDE_DIRS) --python_out=$(OUTPUT_DIR) $(PROTO_SRC)
.PHONY: clean decode
clean:
rm -rf $(OUTPUT_DIR)
.SILENT: decode
decode:
echo "What is the message type?"; \
read messageType;\
echo "What is the message binary?"; \
read binary; \
echo "\n\n";\
echo "$$binary" | xxd -r -p - | protoc $(MESOS_INCLUDE_DIRS) --decode=$$messageType $(PROTO_SRC)