summaryrefslogtreecommitdiffstats
path: root/examples/network_server/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'examples/network_server/Makefile')
-rw-r--r--examples/network_server/Makefile19
1 files changed, 19 insertions, 0 deletions
diff --git a/examples/network_server/Makefile b/examples/network_server/Makefile
new file mode 100644
index 00000000..981f2cf9
--- /dev/null
+++ b/examples/network_server/Makefile
@@ -0,0 +1,19 @@
+CFLAGS = -ansi -Wall -Werror -g -O0
+
+# 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
+CFLAGS += -I$(NANOPB_DIR)
+
+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
+
+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