From 0f1d5cca59a2fddcf6bc627bb35e207bf3889547 Mon Sep 17 00:00:00 2001 From: Petteri Aimonen Date: Sat, 16 Jun 2012 14:08:40 +0300 Subject: Added example on how to handle unions. --- example_unions/Makefile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 example_unions/Makefile (limited to 'example_unions/Makefile') diff --git a/example_unions/Makefile b/example_unions/Makefile new file mode 100644 index 0000000..29514ca --- /dev/null +++ b/example_unions/Makefile @@ -0,0 +1,17 @@ +CFLAGS=-ansi -Wall -Werror -I .. -g -O0 +DEPS=../pb_decode.c ../pb_decode.h ../pb_encode.c ../pb_encode.h ../pb.h + +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 $@ $< ../pb_decode.c ../pb_encode.c unionproto.pb.c + +unionproto.pb.h unionproto.pb.c: unionproto.proto ../generator/nanopb_generator.py + protoc -I. -I../generator -I/usr/include -ounionproto.pb $< + python ../generator/nanopb_generator.py unionproto.pb -- cgit 1.2.3-korg