aboutsummaryrefslogtreecommitdiffstats
path: root/examples/network_server
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2013-11-17 20:04:29 +0200
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2013-12-29 20:26:57 +0200
commit45c1a32e5046fe9323d4fd0213b474a554b2bbed (patch)
treec9280023b03aa52168e1a10757f96e3323a03116 /examples/network_server
parentef31774cd902a6f069b8f2b80b870167328f5acb (diff)
Rework the Makefiles to be compatible with binary packages.
Diffstat (limited to 'examples/network_server')
-rw-r--r--examples/network_server/Makefile16
1 files changed, 6 insertions, 10 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