aboutsummaryrefslogtreecommitdiffstats
path: root/example_unions/Makefile
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2012-06-16 14:08:40 +0300
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2012-06-16 14:08:40 +0300
commit0f1d5cca59a2fddcf6bc627bb35e207bf3889547 (patch)
treefc3172c5fd6e2a542e0686e36f5fc0420af23774 /example_unions/Makefile
parente18352d50678005c9dbb3ac76913555f5317c81c (diff)
Added example on how to handle unions.
Diffstat (limited to 'example_unions/Makefile')
-rw-r--r--example_unions/Makefile17
1 files changed, 17 insertions, 0 deletions
diff --git a/example_unions/Makefile b/example_unions/Makefile
new file mode 100644
index 00000000..29514ca9
--- /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