aboutsummaryrefslogtreecommitdiffstats
path: root/tests/Makefile
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2013-02-06 20:54:25 +0200
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2013-02-06 20:54:25 +0200
commit4ba6a3027d7a5d8c17abeb031622389f8be234fe (patch)
tree3c2fdba47e9b9c11a0e3b0996c9f733abb4c07c1 /tests/Makefile
parent39b8a5e2bbd5da85f23b48280e81a5ce6672b09d (diff)
Add compile-time option PB_BUFFER_ONLY.
This allows slight optimizations if only memory buffer support (as opposed to stream callbacks) is wanted. On ARM difference is -12% execution time, -4% code size when enabled.
Diffstat (limited to 'tests/Makefile')
-rw-r--r--tests/Makefile20
1 files changed, 18 insertions, 2 deletions
diff --git a/tests/Makefile b/tests/Makefile
index 63830999..38f10eae 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -3,8 +3,8 @@ DEPS=../pb_decode.h ../pb_encode.h ../pb.h person.pb.h \
callbacks2.pb.h callbacks.pb.h unittests.h unittestproto.pb.h \
alltypes.pb.h missing_fields.pb.h
TESTS= decode_unittests encode_unittests \
- test_decode1 test_decode2 test_decode3 \
- test_encode1 test_encode2 test_encode3 \
+ test_decode1 test_decode2 test_decode3 test_decode3_buf \
+ test_encode1 test_encode2 test_encode3 test_encode3_buf \
test_decode_callbacks test_encode_callbacks \
test_missing_fields test_no_messages \
test_multiple_files test_cxxcompile test_options \
@@ -39,11 +39,26 @@ pb_encode.o: ../pb_encode.c $(DEPS)
pb_decode.o: ../pb_decode.c $(DEPS)
$(CC) $(CFLAGS) $(CFLAGS_CORE) -c -o $@ $<
+# Test for compilability with c++ compiler
+
pb_encode.cxx.o: ../pb_encode.c $(DEPS)
$(CXX) $(CFLAGS) $(CFLAGS_CORE) -c -o $@ $<
pb_decode.cxx.o: ../pb_decode.c $(DEPS)
$(CXX) $(CFLAGS) $(CFLAGS_CORE) -c -o $@ $<
+# Test for PB_BUF_ONLY compilation option
+
+pb_encode.buf.o: ../pb_encode.c $(DEPS)
+ $(CC) -DPB_BUFFER_ONLY $(CFLAGS) $(CFLAGS_CORE) -c -o $@ $<
+pb_decode.buf.o: ../pb_decode.c $(DEPS)
+ $(CC) -DPB_BUFFER_ONLY $(CFLAGS) $(CFLAGS_CORE) -c -o $@ $<
+%.buf.o: %.c $(DEPS)
+ $(CC) -DPB_BUFFER_ONLY $(CFLAGS) -c -o $@ $<
+test_encode3_buf: test_encode3.buf.o pb_encode.buf.o alltypes.pb.o
+ $(CC) $(LDFLAGS) $^ -o $@
+test_decode3_buf: test_decode3.buf.o pb_decode.buf.o alltypes.pb.o
+ $(CC) $(LDFLAGS) $^ -o $@
+
test_cxxcompile: pb_encode.cxx.o pb_decode.cxx.o
test_decode1: test_decode1.o pb_decode.o person.pb.o
test_decode2: test_decode2.o pb_decode.o person.pb.o
@@ -98,6 +113,7 @@ run_unittests: $(TESTS)
./test_encode3 | ./test_decode3
./test_encode3 1 | ./test_decode3 1
./test_encode3 1 | protoc --decode=AllTypes -I. -I../generator -I/usr/include alltypes.proto >/dev/null
+ ./test_encode3_buf 1 | ./test_decode3_buf 1
./bc_encode | ./bc_decode
./test_missing_fields