From f47410ea4b8ae43e19facd378be4cf1073e1813b Mon Sep 17 00:00:00 2001 From: Petteri Aimonen Date: Fri, 13 Sep 2013 12:59:31 +0300 Subject: Move examples into subfolders, add READMEs --- examples/using_union_messages/Makefile | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 examples/using_union_messages/Makefile (limited to 'examples/using_union_messages/Makefile') diff --git a/examples/using_union_messages/Makefile b/examples/using_union_messages/Makefile new file mode 100644 index 00000000..0f7b5206 --- /dev/null +++ b/examples/using_union_messages/Makefile @@ -0,0 +1,22 @@ +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 -- cgit 1.2.3-korg