Browse Source

Simplify the PLATFORM/CONFIG handling a little.

sbg
px4dev 12 years ago
parent
commit
8440e4f709
  1. 19
      Makefile
  2. 6
      makefiles/firmware.mk
  3. 1
      makefiles/px4fmu_default.mk
  4. 1
      makefiles/px4io_default.mk

19
Makefile

@ -29,6 +29,11 @@ RMDIR = rm -rf @@ -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) @@ -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 @@ -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: @@ -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)
#

6
makefiles/firmware.mk

@ -74,11 +74,15 @@ RMDIR = rm -rf @@ -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

1
makefiles/px4fmu_default.mk

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
# Makefile for the px4fmu_default configuration
#
CONFIG = px4fmu_default
PLATFORM = px4fmu
SRCS = $(PX4_BASE)/platforms/empty.c

1
makefiles/px4io_default.mk

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
# Makefile for the px4io_default configuration
#
CONFIG = px4io_default
PLATFORM = px4io
SRCS = $(PX4_BASE)/platforms/empty.c

Loading…
Cancel
Save