1 CFLAGS=-ansi -Wall -Werror -I .. -g -O0 --coverage
3 DEPS=../pb_decode.h ../pb_encode.h ../pb.h person.pb.h unittests.h unittestproto.pb.h
4 TESTS=test_decode1 test_encode1 decode_unittests encode_unittests
6 all: $(TESTS) run_unittests breakpoints
9 rm -f $(TESTS) person.pb* *.o *.gcda *.gcno
12 $(CC) $(CFLAGS) -c -o $@ $<
14 pb_encode.o: ../pb_encode.c $(DEPS)
15 $(CC) $(CFLAGS) -c -o $@ $<
16 pb_decode.o: ../pb_decode.c $(DEPS)
17 $(CC) $(CFLAGS) -c -o $@ $<
19 test_decode1: test_decode1.o pb_decode.o person.pb.o
20 test_encode1: test_encode1.o pb_encode.o person.pb.o
21 decode_unittests: decode_unittests.o pb_decode.o unittestproto.pb.o
22 encode_unittests: encode_unittests.o pb_encode.o unittestproto.pb.o
25 protoc -I. -I../generator -I/usr/include -o$@ $<
28 python ../generator/nanopb_generator.py $<
30 breakpoints: ../*.c *.c
31 grep -n 'return false;' $^ | cut -d: -f-2 | xargs -n 1 echo b > $@
33 coverage: run_unittests
37 run_unittests: decode_unittests encode_unittests test_encode1 test_decode1
40 ./decode_unittests > /dev/null
41 ./encode_unittests > /dev/null
43 [ "`./test_encode1 | ./test_decode1`" = \
44 "`./test_encode1 | protoc --decode=Person -I. -I../generator -I/usr/include person.proto`" ]
46 run_fuzztest: test_decode1
47 bash -c 'I=1; while cat /dev/urandom | ./test_decode1 > /dev/null; do I=$$(($$I+1)); echo -en "\r$$I"; done'