1# Include the nanopb provided Makefile rules
2include ../../extra/nanopb.mk
3
4# Compiler flags to enable all warnings & debug info
5CFLAGS = -Wall -Werror -g -O0
6CFLAGS += "-I$(NANOPB_DIR)"
7
8# C source code files that are required
9CSRC  = simple.c                   # The main program
10CSRC += simple.pb.c                # The compiled protocol definition
11CSRC += $(NANOPB_DIR)/pb_encode.c  # The nanopb encoder
12CSRC += $(NANOPB_DIR)/pb_decode.c  # The nanopb decoder
13CSRC += $(NANOPB_DIR)/pb_common.c  # The nanopb common parts
14
15# Build rule for the main program
16simple: $(CSRC)
17	$(CC) $(CFLAGS) -osimple $(CSRC)
18
19# Build rule for the protocol
20simple.pb.c: simple.proto
21	$(PROTOC) $(PROTOC_OPTS) --nanopb_out=. simple.proto
22
23