aboutsummaryrefslogtreecommitdiffstats
path: root/example_unions/Makefile
blob: 29514ca9bbdf76effad550a5bc8ae9201e9d8109 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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