diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/network_server/Makefile | 16 | ||||
-rw-r--r-- | examples/simple/Makefile | 9 | ||||
-rw-r--r-- | examples/using_double_on_avr/Makefile | 19 | ||||
-rw-r--r-- | examples/using_union_messages/Makefile | 16 |
4 files changed, 22 insertions, 38 deletions
diff --git a/examples/network_server/Makefile b/examples/network_server/Makefile index 981f2cf9..3c014009 100644 --- a/examples/network_server/Makefile +++ b/examples/network_server/Makefile @@ -1,9 +1,8 @@ -CFLAGS = -ansi -Wall -Werror -g -O0 +# Include the nanopb provided Makefile rules +include ../../extra/nanopb.mk -# Path to the nanopb root folder -NANOPB_DIR = ../.. -DEPS = $(NANOPB_DIR)/pb_decode.c $(NANOPB_DIR)/pb_decode.h \ - $(NANOPB_DIR)/pb_encode.c $(NANOPB_DIR)/pb_encode.h $(NANOPB_DIR)/pb.h +# Compiler flags to enable all warnings & debug info +CFLAGS = -ansi -Wall -Werror -g -O0 CFLAGS += -I$(NANOPB_DIR) all: server client @@ -11,9 +10,6 @@ all: server client clean: rm -f server client fileproto.pb.c fileproto.pb.h -%: %.c $(DEPS) fileproto.pb.h fileproto.pb.c - $(CC) $(CFLAGS) -o $@ $< $(NANOPB_DIR)/pb_decode.c $(NANOPB_DIR)/pb_encode.c fileproto.pb.c common.c +%: %.c common.c fileproto.pb.c + $(CC) $(CFLAGS) -o $@ $^ $(NANOPB_CORE) -fileproto.pb.c fileproto.pb.h: fileproto.proto $(NANOPB_DIR)/generator/nanopb_generator.py - protoc -ofileproto.pb $< - python $(NANOPB_DIR)/generator/nanopb_generator.py fileproto.pb diff --git a/examples/simple/Makefile b/examples/simple/Makefile index 2be3a047..02a4c3ff 100644 --- a/examples/simple/Makefile +++ b/examples/simple/Makefile @@ -1,8 +1,8 @@ +# Include the nanopb provided Makefile rules +include ../../extra/nanopb.mk + # Compiler flags to enable all warnings & debug info CFLAGS = -Wall -Werror -g -O0 - -# Path to the nanopb root folder -NANOPB_DIR = ../.. CFLAGS += -I$(NANOPB_DIR) # C source code files that are required @@ -17,6 +17,5 @@ simple: $(CSRC) # Build rule for the protocol simple.pb.c: simple.proto - protoc -osimple.pb simple.proto - python $(NANOPB_DIR)/generator/nanopb_generator.py simple.pb + $(PROTOC) $(PROTOC_OPTS) --nanopb_out=. simple.proto diff --git a/examples/using_double_on_avr/Makefile b/examples/using_double_on_avr/Makefile index 0b5383fa..6f2203ae 100644 --- a/examples/using_double_on_avr/Makefile +++ b/examples/using_double_on_avr/Makefile @@ -1,10 +1,8 @@ -CFLAGS = -Wall -Werror -g -O0 +# Include the nanopb provided Makefile rules +include ../../extra/nanopb.mk -# 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 +# Compiler flags to enable all warnings & debug info +CFLAGS = -Wall -Werror -g -O0 CFLAGS += -I$(NANOPB_DIR) all: run_tests @@ -15,13 +13,8 @@ clean: 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 +%: %.c double_conversion.c doubleproto.pb.c + $(CC) $(CFLAGS) -o $@ $^ $(NANOPB_CORE) run_tests: test_conversions encode_double decode_double ./test_conversions diff --git a/examples/using_union_messages/Makefile b/examples/using_union_messages/Makefile index 0f7b5206..618bca50 100644 --- a/examples/using_union_messages/Makefile +++ b/examples/using_union_messages/Makefile @@ -1,9 +1,8 @@ -CFLAGS = -ansi -Wall -Werror -g -O0 +# Include the nanopb provided Makefile rules +include ../../extra/nanopb.mk -# Path to the nanopb root folder -NANOPB_DIR = ../.. -DEPS = $(NANOPB_DIR)/pb_decode.c $(NANOPB_DIR)/pb_decode.h \ - $(NANOPB_DIR)/pb_encode.c $(NANOPB_DIR)/pb_encode.h $(NANOPB_DIR)/pb.h +# Compiler flags to enable all warnings & debug info +CFLAGS = -ansi -Wall -Werror -g -O0 CFLAGS += -I$(NANOPB_DIR) all: encode decode @@ -14,9 +13,6 @@ all: encode decode clean: rm -f encode unionproto.pb.h unionproto.pb.c -%: %.c $(DEPS) unionproto.pb.h unionproto.pb.c - $(CC) $(CFLAGS) -o $@ $< $(NANOPB_DIR)/pb_decode.c $(NANOPB_DIR)/pb_encode.c unionproto.pb.c +%: %.c unionproto.pb.c + $(CC) $(CFLAGS) -o $@ $^ $(NANOPB_CORE) -unionproto.pb.h unionproto.pb.c: unionproto.proto $(NANOPB_DIR)/generator/nanopb_generator.py - protoc -ounionproto.pb $< - python $(NANOPB_DIR)/generator/nanopb_generator.py unionproto.pb |