aboutsummaryrefslogtreecommitdiffstats
path: root/examples/using_double_on_avr/Makefile
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2013-09-13 12:59:31 +0300
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2013-09-13 12:59:31 +0300
commitf47410ea4b8ae43e19facd378be4cf1073e1813b (patch)
tree53fdc4bac6615f07e830d7d538c90abbea1ead4b /examples/using_double_on_avr/Makefile
parentfd9a79a06db00c6199a5dcaee22ed2cd8e3c3e9b (diff)
Move examples into subfolders, add READMEs
Diffstat (limited to 'examples/using_double_on_avr/Makefile')
-rw-r--r--examples/using_double_on_avr/Makefile29
1 files changed, 29 insertions, 0 deletions
diff --git a/examples/using_double_on_avr/Makefile b/examples/using_double_on_avr/Makefile
new file mode 100644
index 00000000..0b5383fa
--- /dev/null
+++ b/examples/using_double_on_avr/Makefile
@@ -0,0 +1,29 @@
+CFLAGS = -Wall -Werror -g -O0
+
+# Path to the nanopb root directory
+NANOPB_DIR = ../..
+DEPS = double_conversion.c $(NANOPB_DIR)/pb.h \
+ $(NANOPB_DIR)/pb_decode.c $(NANOPB_DIR)/pb_decode.h \
+ $(NANOPB_DIR)/pb_encode.c $(NANOPB_DIR)/pb_encode.h
+CFLAGS += -I$(NANOPB_DIR)
+
+all: run_tests
+
+clean:
+ rm -f test_conversions encode_double decode_double doubleproto.pb.c doubleproto.pb.h
+
+test_conversions: test_conversions.c double_conversion.c
+ $(CC) $(CFLAGS) -o $@ $^
+
+%: %.c $(DEPS) doubleproto.pb.h doubleproto.pb.c
+ $(CC) $(CFLAGS) -o $@ $< double_conversion.c \
+ $(NANOPB_DIR)/pb_decode.c $(NANOPB_DIR)/pb_encode.c doubleproto.pb.c
+
+doubleproto.pb.c doubleproto.pb.h: doubleproto.proto $(NANOPB_DIR)/generator/nanopb_generator.py
+ protoc -odoubleproto.pb $<
+ python $(NANOPB_DIR)/generator/nanopb_generator.py doubleproto.pb
+
+run_tests: test_conversions encode_double decode_double
+ ./test_conversions
+ ./encode_double | ./decode_double
+