From 8440e4f70907e87661e295f1585208620d68b84e Mon Sep 17 00:00:00 2001 From: px4dev Date: Wed, 16 Jan 2013 22:38:47 -0800 Subject: Simplify the PLATFORM/CONFIG handling a little. --- Makefile | 19 ++++++------------- makefiles/firmware.mk | 6 +++++- makefiles/px4fmu_default.mk | 1 + makefiles/px4io_default.mk | 1 + 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index bcbe6b790..20a23b3f1 100644 --- a/Makefile +++ b/Makefile @@ -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) # 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 -- cgit v1.2.3