Moving files around
[apps/agl-service-can-low-level.git] / examples / using_double_on_avr / Makefile
1 CFLAGS = -Wall -Werror -g -O0
2
3 # Path to the nanopb root directory
4 NANOPB_DIR = ../..
5 DEPS = double_conversion.c $(NANOPB_DIR)/pb.h \
6         $(NANOPB_DIR)/pb_decode.c $(NANOPB_DIR)/pb_decode.h \
7         $(NANOPB_DIR)/pb_encode.c $(NANOPB_DIR)/pb_encode.h
8 CFLAGS += -I$(NANOPB_DIR)
9
10 all: run_tests
11
12 clean:
13         rm -f test_conversions encode_double decode_double doubleproto.pb.c doubleproto.pb.h
14
15 test_conversions: test_conversions.c double_conversion.c
16         $(CC) $(CFLAGS) -o $@ $^
17
18 %: %.c $(DEPS) doubleproto.pb.h doubleproto.pb.c
19         $(CC) $(CFLAGS) -o $@ $< double_conversion.c \
20                 $(NANOPB_DIR)/pb_decode.c $(NANOPB_DIR)/pb_encode.c doubleproto.pb.c
21
22 doubleproto.pb.c doubleproto.pb.h: doubleproto.proto $(NANOPB_DIR)/generator/nanopb_generator.py
23         protoc -odoubleproto.pb $<
24         python $(NANOPB_DIR)/generator/nanopb_generator.py doubleproto.pb
25
26 run_tests: test_conversions encode_double decode_double
27         ./test_conversions
28         ./encode_double | ./decode_double
29