1 CFLAGS = -ansi -Wall -Werror -g -O0
3 # Path to the nanopb root folder
5 DEPS = $(NANOPB_DIR)/pb_decode.c $(NANOPB_DIR)/pb_decode.h \
6 $(NANOPB_DIR)/pb_encode.c $(NANOPB_DIR)/pb_encode.h $(NANOPB_DIR)/pb.h
7 CFLAGS += -I$(NANOPB_DIR)
15 rm -f encode unionproto.pb.h unionproto.pb.c
17 %: %.c $(DEPS) unionproto.pb.h unionproto.pb.c
18 $(CC) $(CFLAGS) -o $@ $< $(NANOPB_DIR)/pb_decode.c $(NANOPB_DIR)/pb_encode.c unionproto.pb.c
20 unionproto.pb.h unionproto.pb.c: unionproto.proto $(NANOPB_DIR)/generator/nanopb_generator.py
21 protoc -ounionproto.pb $<
22 python $(NANOPB_DIR)/generator/nanopb_generator.py unionproto.pb