Add protobuf (https://github.com/google/protobuf) and nanopb (https://github.com/metormote/nanopb) to build example beerduino project (https://github.com/ilyevsky/beerduino) using platformio (http://docs.platformio.org/en/latest/).
This commit is contained in:
24
Makefile
Normal file
24
Makefile
Normal file
@@ -0,0 +1,24 @@
|
||||
PROTO_DIR = proto
|
||||
GOOGLE_PROTOBUF_INCLUDES = protobuf/src
|
||||
NANOPB_DIR = nanopb/generator
|
||||
PROTO_INCLUDES = -I$(PROTO_DIR) -I$(GOOGLE_PROTOBUF_INCLUDES) -I$(NANOPB_DIR)/proto
|
||||
|
||||
all: nanopb beerduino.pb
|
||||
|
||||
nanopb: nanopb_nanopb nanopb_plugin
|
||||
cp nanopb/pb.h src
|
||||
cp nanopb/pb_common.c src
|
||||
cp nanopb/pb_common.h src
|
||||
cp nanopb/pb_decode.c src
|
||||
cp nanopb/pb_decode.h src
|
||||
cp nanopb/pb_encode.h src
|
||||
cp nanopb/pb_encode.c src
|
||||
|
||||
nanopb_%: $(NANOPB_DIR)/proto/%.proto
|
||||
protoc --python_out=$(NANOPB_DIR)/proto $(PROTO_INCLUDES) $<
|
||||
|
||||
%.pb: $(PROTO_DIR)/%.proto
|
||||
protoc -o$@ $< $(PROTO_INCLUDES)
|
||||
python $(NANOPB_DIR)/nanopb_generator.py $@ -L '#include "%s"'
|
||||
mv -f $@.h src
|
||||
mv -f $@.c src
|
||||
Reference in New Issue
Block a user