mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-18 06:10:36 +08:00
Simplify the PLATFORM/CONFIG handling a little.
This commit is contained in:
@@ -29,6 +29,11 @@ RMDIR = rm -rf
|
||||
#
|
||||
CONFIGS ?= px4fmu_default px4io_default
|
||||
|
||||
#
|
||||
# Platforms (boards) that we build NuttX export kits for.
|
||||
#
|
||||
PLATFORMS = px4fmu px4io
|
||||
|
||||
#
|
||||
# If the user has listed a config as a target, strip it out and override CONFIGS
|
||||
#
|
||||
@@ -39,16 +44,6 @@ CONFIGS := $(EXPLICIT_CONFIGS)
|
||||
$(EXPLICIT_CONFIGS): all
|
||||
endif
|
||||
|
||||
#
|
||||
# Platforms (boards) that we build prelink kits for.
|
||||
#
|
||||
PLATFORMS = px4fmu px4io
|
||||
|
||||
#
|
||||
# Some handy macros
|
||||
#
|
||||
PLATFORM_FROM_CONFIG = $(word 1,$(subst _, ,$1))
|
||||
|
||||
#
|
||||
# Built products
|
||||
#
|
||||
@@ -72,7 +67,7 @@ $(STAGED_FIRMWARES): $(IMAGE_DIR)/%.px4: $(BUILD_DIR)/%.build/firmware.px4
|
||||
$(Q) $(COPY) $< $@
|
||||
|
||||
#
|
||||
# Generate FIRMWARES
|
||||
# Generate FIRMWARES.
|
||||
#
|
||||
$(BUILD_DIR)/%.build/firmware.px4: config = $(patsubst $(BUILD_DIR)/%.build/firmware.px4,%,$@)
|
||||
$(BUILD_DIR)/%.build/firmware.px4: work_dir = $(BUILD_DIR)/$(config).build
|
||||
@@ -81,8 +76,6 @@ $(FIRMWARES): $(BUILD_DIR)/%.build/firmware.px4:
|
||||
$(Q) mkdir -p $(work_dir)
|
||||
$(Q) make -C $(work_dir) \
|
||||
-f $(PX4_BASE)/makefiles/$(config).mk \
|
||||
CONFIG=$(config) \
|
||||
PLATFORM=$(call PLATFORM_FROM_CONFIG,$(config)) \
|
||||
WORK_DIR=$(work_dir)
|
||||
|
||||
#
|
||||
|
||||
@@ -74,11 +74,15 @@ RMDIR = rm -rf
|
||||
|
||||
#
|
||||
# Sanity-check the PLATFORM variable and then get the platform config.
|
||||
# If PLATFORM is not set, but CONFIG is, use that.
|
||||
#
|
||||
# The platform config in turn will fetch the toolchain configuration.
|
||||
#
|
||||
ifeq ($(PLATFORM),)
|
||||
$(error The PLATFORM variable must be set before including firmware.mk)
|
||||
ifeq ($(CONFIG),)
|
||||
$(error At least one of the PLATFORM or CONFIG variables must be set before including firmware.mk)
|
||||
endif
|
||||
PLATFORM := $(firstword $(subst _, ,$(CONFIG)))
|
||||
endif
|
||||
include $(PX4_MK_INCLUDE)/$(PLATFORM).mk
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
# Makefile for the px4fmu_default configuration
|
||||
#
|
||||
|
||||
CONFIG = px4fmu_default
|
||||
PLATFORM = px4fmu
|
||||
SRCS = $(PX4_BASE)/platforms/empty.c
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
# Makefile for the px4io_default configuration
|
||||
#
|
||||
|
||||
CONFIG = px4io_default
|
||||
PLATFORM = px4io
|
||||
SRCS = $(PX4_BASE)/platforms/empty.c
|
||||
|
||||
|
||||
Reference in New Issue
Block a user