mirror of https://github.com/ArduPilot/ardupilot
mk: generate mavlink headers using mavlink module files
This commit is contained in:
parent
9a534da18c
commit
dd65495668
|
@ -64,7 +64,7 @@ LIBSKETCH_SKEL_SO = $(BUILDROOT)/libqflight_skel.so
|
|||
.SUFFIXES: .o .c .cpp .so .do
|
||||
|
||||
# build DSP object from C file
|
||||
$(BUILDROOT)/libraries/%.do: $(SKETCHBOOK)/libraries/%.c
|
||||
$(BUILDROOT)/libraries/%.do: $(SKETCHBOOK)/libraries/%.c MAV_GEN
|
||||
$(RULEHDR)
|
||||
$(v)$(QURT_CC) $(DSP_FLAGS) -c -o $@ $<
|
||||
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
# Build sketch objects
|
||||
#
|
||||
|
||||
$(BUILDROOT)/%.o: $(BUILDROOT)/%.cpp $(GENERATE_TARGETS)
|
||||
$(BUILDROOT)/%.o: $(BUILDROOT)/%.cpp $(GENERATE_TARGETS) MAV_GEN
|
||||
$(RULEHDR)
|
||||
$(v)$(CXX) $(CXXFLAGS) -c -o $@ $< $(SKETCH_INCLUDES)
|
||||
|
||||
$(BUILDROOT)/%.o: $(BUILDROOT)/make.flags $(SRCROOT)/%.cpp $(GENERATE_TARGETS)
|
||||
$(BUILDROOT)/%.o: $(BUILDROOT)/make.flags $(SRCROOT)/%.cpp $(GENERATE_TARGETS) MAV_GEN
|
||||
$(RULEHDR)
|
||||
$(v)$(CXX) $(CXXFLAGS) -c -o $@ $*.cpp $(SKETCH_INCLUDES)
|
||||
|
||||
|
@ -23,7 +23,7 @@ $(BUILDROOT)/%.o: $(SRCROOT)/%.S
|
|||
# Build library objects from sources in the sketchbook
|
||||
#
|
||||
|
||||
$(BUILDROOT)/libraries/%.o: $(SKETCHBOOK)/libraries/%.cpp $(GENERATE_TARGETS)
|
||||
$(BUILDROOT)/libraries/%.o: $(SKETCHBOOK)/libraries/%.cpp $(GENERATE_TARGETS) MAV_GEN
|
||||
$(RULEHDR)
|
||||
$(v)$(CXX) $(CXXFLAGS) -c -o $@ $< $(SLIB_INCLUDES)
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
echo "Checking modules"
|
||||
|
||||
MODULE_LIST="PX4Firmware PX4NuttX uavcan"
|
||||
MODULE_LIST="PX4Firmware PX4NuttX uavcan mavlink"
|
||||
|
||||
NEED_INIT=0
|
||||
|
||||
|
@ -10,12 +10,12 @@ cd $(dirname "$0")/.. || exit 1
|
|||
|
||||
for m in $MODULE_LIST; do
|
||||
[ -d modules/$m ] || {
|
||||
echo "module/$m missing - need module init"
|
||||
echo "modules/$m missing - need module init"
|
||||
NEED_INIT=1
|
||||
break
|
||||
}
|
||||
[ -f modules/$m/.git ] || {
|
||||
echo "module/$m/.git missing - need module init"
|
||||
echo "modules/$m/.git missing - need module init"
|
||||
NEED_INIT=1
|
||||
break
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
|
||||
# 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/
|
||||
|
||||
.PHONY: MAV_GEN
|
||||
|
||||
MAV_GEN: $(MAVLINK_HEADERS) CHECK_MODULES
|
||||
|
||||
$(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_DIR)/message_definitions/v1.0/ardupilotmega.xml
|
|
@ -2,9 +2,7 @@
|
|||
# git submodule support
|
||||
|
||||
.PHONY: CHECK_MODULES
|
||||
|
||||
# PX4 build needs submodules
|
||||
px4-%: CHECK_MODULES
|
||||
all: CHECK_MODULES
|
||||
|
||||
CHECK_MODULES:
|
||||
$(v)$(MK_DIR)/check_modules.sh
|
||||
|
|
|
@ -81,7 +81,7 @@ module_mk:
|
|||
$(v) cmp $(SKETCHBOOK)/module.mk $(SKETCHBOOK)/module.mk.new 2>/dev/null || mv $(SKETCHBOOK)/module.mk.new $(SKETCHBOOK)/module.mk
|
||||
$(v) rm -f $(SKETCHBOOK)/module.mk.new
|
||||
|
||||
px4-v1: $(BUILDROOT)/make.flags CHECK_MODULES $(PX4_ROOT)/Archives/px4fmu-v1.export $(SKETCHCPP) module_mk px4-io-v1
|
||||
px4-v1: $(BUILDROOT)/make.flags CHECK_MODULES MAV_GEN $(PX4_ROOT)/Archives/px4fmu-v1.export $(SKETCHCPP) module_mk px4-io-v1
|
||||
$(RULEHDR)
|
||||
$(v) rm -f $(PX4_ROOT)/makefiles/$(PX4_V1_CONFIG_FILE)
|
||||
$(v) cp $(PX4_V1_CONFIG_FILE) $(PX4_ROOT)/makefiles/nuttx/
|
||||
|
@ -92,7 +92,7 @@ px4-v1: $(BUILDROOT)/make.flags CHECK_MODULES $(PX4_ROOT)/Archives/px4fmu-v1.exp
|
|||
$(v) $(SKETCHBOOK)/Tools/scripts/add_git_hashes.py $(HASHADDER_FLAGS) "$(SKETCH)-v1.px4" "$(SKETCH)-v1.px4"
|
||||
$(v) echo "PX4 $(SKETCH) Firmware is in $(SKETCH)-v1.px4"
|
||||
|
||||
px4-v2: $(BUILDROOT)/make.flags CHECK_MODULES $(PX4_ROOT)/Archives/px4fmu-v2.export $(SKETCHCPP) module_mk px4-io-v2
|
||||
px4-v2: $(BUILDROOT)/make.flags CHECK_MODULES MAV_GEN $(PX4_ROOT)/Archives/px4fmu-v2.export $(SKETCHCPP) module_mk px4-io-v2
|
||||
$(RULEHDR)
|
||||
$(v) rm -f $(PX4_ROOT)/makefiles/$(PX4_V2_CONFIG_FILE)
|
||||
$(v) cp $(PX4_V2_CONFIG_FILE) $(PX4_ROOT)/makefiles/nuttx/
|
||||
|
@ -103,7 +103,7 @@ px4-v2: $(BUILDROOT)/make.flags CHECK_MODULES $(PX4_ROOT)/Archives/px4fmu-v2.exp
|
|||
$(v) $(SKETCHBOOK)/Tools/scripts/add_git_hashes.py $(HASHADDER_FLAGS) "$(SKETCH)-v2.px4" "$(SKETCH)-v2.px4"
|
||||
$(v) echo "PX4 $(SKETCH) Firmware is in $(SKETCH)-v2.px4"
|
||||
|
||||
px4-v4: $(BUILDROOT)/make.flags CHECK_MODULES $(PX4_ROOT)/Archives/px4fmu-v4.export $(SKETCHCPP) module_mk
|
||||
px4-v4: $(BUILDROOT)/make.flags CHECK_MODULES MAV_GEN $(PX4_ROOT)/Archives/px4fmu-v4.export $(SKETCHCPP) module_mk
|
||||
$(RULEHDR)
|
||||
$(v) rm -f $(PX4_ROOT)/makefiles/$(PX4_V4_CONFIG_FILE)
|
||||
$(v) cp $(PX4_V4_CONFIG_FILE) $(PX4_ROOT)/makefiles/nuttx/
|
||||
|
|
|
@ -78,7 +78,7 @@ SKETCHLIBNAMES := $(notdir $(SKETCHLIBS))
|
|||
SKETCHLIBSRCDIRS := $(SKETCHLIBS) $(addsuffix /utility,$(SKETCHLIBS))
|
||||
SKETCHLIBSRCS := $(wildcard $(foreach suffix,$(SRCSUFFIXES),$(addsuffix /$(suffix),$(SKETCHLIBSRCDIRS))))
|
||||
SKETCHLIBOBJS := $(addsuffix .o,$(basename $(subst $(SKETCHBOOK),$(BUILDROOT),$(SKETCHLIBSRCS))))
|
||||
SKETCHLIBINCLUDES := -I$(SKETCHBOOK)/libraries/
|
||||
SKETCHLIBINCLUDES := -I$(SKETCHBOOK)/libraries/ -I$(BUILDROOT)/libraries/ -I$(BUILDROOT)/libraries/GCS_MAVLink/
|
||||
SKETCHLIBSRCSRELATIVE := $(subst $(SKETCHBOOK)/,,$(SKETCHLIBSRCS))
|
||||
|
||||
ifeq ($(VERBOSE),)
|
||||
|
|
|
@ -140,3 +140,4 @@ clean:
|
|||
@rm -fr $(BUILDROOT)
|
||||
|
||||
include $(MK_DIR)/modules.mk
|
||||
include $(MK_DIR)/mavgen.mk
|
||||
|
|
Loading…
Reference in New Issue