Makefile 722 B

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