before merging master
[inav.git] / lib / main / MAVLink / generate.sh
blobf753448aa52da31ff353a34398cde508a0bb285f
1 #!/usr/bin/env bash
3 echo "Removing old library..."
4 rm -r common/
5 rm -r minimal/
6 rm -r standard/
7 rm -r checksum.h
8 rm -r mavlink_*
9 rm -r protocol.h
11 echo "Downloading or updating MAVLink sources..."
13 if [ -d "mavlink-src/.git" ]; then
14 cd mavlink-src || return 1
15 git fetch
16 git checkout origin/master
17 cd ../
18 else
19 git clone https://github.com/mavlink/mavlink.git --recursive mavlink-src
22 PYTHONPATH="$(pwd)/mavlink-src"
24 echo "Running MAVLink generator..."
25 python -m pymavlink.tools.mavgen --lang=C --wire-protocol=2.0 --output=. mavlink-src/message_definitions/v1.0/common.xml --no-validate
27 echo "Removing inlines..."
28 sed -i 's/ inline//' protocol.h