mk: fixed building with mavlink2 headers

This commit is contained in:
Andrew Tridgell 2016-01-15 08:21:42 +11:00
parent 0ead0ab978
commit b0be3e7423
3 changed files with 12 additions and 6 deletions

View File

@ -120,6 +120,15 @@ ifneq ($(findstring CYGWIN, $(SYSTYPE)),)
endif
endif
ifneq ($(findstring mavlink2, $(MAKECMDGOALS)),)
EXTRAFLAGS += -DMAVLINK_PROTOCOL_VERSION=2
MAVLINK_SUBDIR=v2.0
MAVLINK_WIRE_PROTOCOL=2.0
else
MAVLINK_SUBDIR=v1.0
MAVLINK_WIRE_PROTOCOL=1.0
endif
ifneq ($(APPDIR),)
# this is a recusive PX4 build
HAL_BOARD = HAL_BOARD_PX4

View File

@ -2,11 +2,11 @@
# mavlink header generation
MAVLINK_DIR := $(SKETCHBOOK)/modules/mavlink/
MESSAGE_DEFINITIONS := $(SKETCHBOOK)/modules/mavlink/message_definitions/v1.0
MAVLINK_HEADERS := $(BUILDROOT)/libraries/GCS_MAVLink/include/mavlink/v1.0/ardupilotmega/mavlink.h $(wildcard $(BUILDROOT)/libraries/GCS_MAVLink/include/mavlink/v1.0/,*.h) $(wildcard $(BUILDROOT)/libraries/GCS_MAVLink/include/mavlink/v1.0/ardupilotmega,*.h)
MAVLINK_OUTPUT_DIR := $(BUILDROOT)/libraries/GCS_MAVLink/include/mavlink/v1.0
MAVLINK_HEADERS := $(BUILDROOT)/libraries/GCS_MAVLink/include/mavlink/$(MAVLINK_SUBDIR)/ardupilotmega/mavlink.h $(wildcard $(BUILDROOT)/libraries/GCS_MAVLink/include/mavlink/$(MAVLINK_SUBDIR)/,*.h) $(wildcard $(BUILDROOT)/libraries/GCS_MAVLink/include/mavlink/$(MAVLINK_SUBDIR)/ardupilotmega,*.h)
MAVLINK_OUTPUT_DIR := $(BUILDROOT)/libraries/GCS_MAVLink/include/mavlink/$(MAVLINK_SUBDIR)
$(MAVLINK_HEADERS): $(MESSAGE_DEFINITIONS)/ardupilotmega.xml $(MESSAGE_DEFINITIONS)/common.xml
echo "Generating MAVLink headers..."
#goto mavlink module directory and run the most recent generator script
echo "Generating C code using mavgen.py located at" $(SKETCHBOOK)/modules/mavlink/
-PYTHONPATH=$(MAVLINK_DIR) python $(MAVLINK_DIR)/pymavlink/tools/mavgen.py --lang=C --wire-protocol=1.0 --output=$(MAVLINK_OUTPUT_DIR) $(MAVLINK_DIR)/message_definitions/v1.0/ardupilotmega.xml
-PYTHONPATH=$(MAVLINK_DIR) python $(MAVLINK_DIR)/pymavlink/tools/mavgen.py --lang=C --wire-protocol=$(MAVLINK_WIRE_PROTOCOL) --output=$(MAVLINK_OUTPUT_DIR) $(MESSAGE_DEFINITIONS)/ardupilotmega.xml

View File

@ -107,9 +107,6 @@ qurt: all
# support debug build
%-debug: OPTFLAGS = -g -O0
# support mavlink2 builds
%-mavlink2: EXTRAFLAGS += "-DMAVLINK_PROTOCOL_VERSION=2"
# support address sanitiser
%-asan: OPTFLAGS = -g -O0 -fsanitize=address -fno-omit-frame-pointer
%-asan: LDFLAGS += -fsanitize=address