aboutsummaryrefslogtreecommitdiffstats
path: root/example
diff options
context:
space:
mode:
Diffstat (limited to 'example')
-rw-r--r--example/Makefile9
-rw-r--r--example/client.c2
-rw-r--r--example/server.c2
3 files changed, 8 insertions, 5 deletions
diff --git a/example/Makefile b/example/Makefile
index efc4a8de..14dd9fa4 100644
--- a/example/Makefile
+++ b/example/Makefile
@@ -3,9 +3,12 @@ DEPS=../pb_decode.c ../pb_decode.h ../pb_encode.c ../pb_encode.h ../pb.h
all: server client
-%: %.c $(DEPS) fileproto.h
- $(CC) $(CFLAGS) -o $@ $< ../pb_decode.c ../pb_encode.c fileproto.c common.c
+clean:
+ rm -f server client fileproto.pb.c fileproto.pb.h
-fileproto.h: fileproto.proto ../generator/nanopb_generator.py
+%: %.c $(DEPS) fileproto.pb.h fileproto.pb.c
+ $(CC) $(CFLAGS) -o $@ $< ../pb_decode.c ../pb_encode.c fileproto.pb.c common.c
+
+fileproto.pb.c fileproto.pb.h: fileproto.proto ../generator/nanopb_generator.py
protoc -I. -I../generator -I/usr/include -ofileproto.pb $<
python ../generator/nanopb_generator.py fileproto.pb
diff --git a/example/client.c b/example/client.c
index f0520574..95112e4c 100644
--- a/example/client.c
+++ b/example/client.c
@@ -20,7 +20,7 @@
#include <pb_encode.h>
#include <pb_decode.h>
-#include "fileproto.h"
+#include "fileproto.pb.h"
#include "common.h"
bool printfile_callback(pb_istream_t *stream, const pb_field_t *field, void *arg)
diff --git a/example/server.c b/example/server.c
index 04f88f0f..aba0667b 100644
--- a/example/server.c
+++ b/example/server.c
@@ -20,7 +20,7 @@
#include <pb_encode.h>
#include <pb_decode.h>
-#include "fileproto.h"
+#include "fileproto.pb.h"
#include "common.h"
bool listdir_callback(pb_ostream_t *stream, const pb_field_t *field, const void *arg)