diff options
-rw-r--r-- | Makefile | 19 | ||||
-rw-r--r-- | makefiles/firmware.mk | 6 | ||||
-rw-r--r-- | makefiles/px4fmu_default.mk | 1 | ||||
-rw-r--r-- | makefiles/px4io_default.mk | 1 |
4 files changed, 13 insertions, 14 deletions
@@ -30,6 +30,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 # EXPLICIT_CONFIGS := $(filter $(CONFIGS),$(MAKECMDGOALS)) @@ -40,16 +45,6 @@ $(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 # STAGED_FIRMWARES = $(foreach config,$(CONFIGS),$(IMAGE_DIR)/$(config).px4) @@ -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) # diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk index c85c5c919..cde646036 100644 --- a/makefiles/firmware.mk +++ b/makefiles/firmware.mk @@ -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 diff --git a/makefiles/px4fmu_default.mk b/makefiles/px4fmu_default.mk index 9bb5e09a4..6f7eaa41d 100644 --- a/makefiles/px4fmu_default.mk +++ b/makefiles/px4fmu_default.mk @@ -2,6 +2,7 @@ # Makefile for the px4fmu_default configuration # +CONFIG = px4fmu_default PLATFORM = px4fmu SRCS = $(PX4_BASE)/platforms/empty.c diff --git a/makefiles/px4io_default.mk b/makefiles/px4io_default.mk index e961e46f7..d4f43d701 100644 --- a/makefiles/px4io_default.mk +++ b/makefiles/px4io_default.mk @@ -2,6 +2,7 @@ # Makefile for the px4io_default configuration # +CONFIG = px4io_default PLATFORM = px4io SRCS = $(PX4_BASE)/platforms/empty.c |