aboutsummaryrefslogtreecommitdiffstats
path: root/examples/using_union_messages/Makefile
blob: 0f7b5206d392c9758ed14185b98a562fc806cbd0 (plain)
1
2
3
4
5
6
7
8
9
10
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weigh
CFLAGS = -ansi -Wall -Werror -g -O0

# Path to the nanopb root folder
NANOPB_DIR = ../..
DEPS = $(NANOPB_DIR)/pb_decode.c $(NANOPB_DIR)/pb_decode.h \
       $(NANOPB_DIR)/pb_encode.c $(NANOPB_DIR)/pb_encode.h $(NANOPB_DIR)/pb.h
CFLAGS += -I$(NANOPB_DIR)

all: encode decode
	./encode 1 | ./decode
	./encode 2 | ./decode
	./encode 3 | ./decode

clean:
	rm -f encode unionproto.pb.h unionproto.pb.c

%: %.c $(DEPS) unionproto.pb.h unionproto.pb.c
	$(CC) $(CFLAGS) -o $@ $< $(NANOPB_DIR)/pb_decode.c $(NANOPB_DIR)/pb_encode.c unionproto.pb.c

unionproto.pb.h unionproto.pb.c: unionproto.proto $(NANOPB_DIR)/generator/nanopb_generator.py
	protoc -ounionproto.pb $<
	python $(NANOPB_DIR)/generator/nanopb_generator.py unionproto.pb