summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile23
-rw-r--r--bl32/tsp/tsp.mk2
-rw-r--r--tools/cert_create/Makefile10
3 files changed, 25 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 02bb3172..d38a2832 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved.
+# Copyright (c) 2013-2015, ARM Limited and Contributors. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -126,9 +126,14 @@ BL_COMMON_SOURCES := common/bl_common.c \
BUILD_BASE := ./build
BUILD_PLAT := ${BUILD_BASE}/${PLAT}/${BUILD_TYPE}
-PLATFORMS := $(shell ls -I common plat/)
+PLAT_MAKEFILE := platform.mk
+# Generate the platforms list by recursively searching for all directories
+# under /plat containing a PLAT_MAKEFILE. Append each platform with a `|`
+# char and strip out the final '|'.
+PLATFORMS := $(shell find plat/ -name '${PLAT_MAKEFILE}' -print0 | \
+ sed -r 's%[^\x00]*\/([^/]*)\/${PLAT_MAKEFILE}\x00%\1|%g' | \
+ sed -r 's/\|$$//')
SPDS := $(shell ls -I none services/spd)
-HELP_PLATFORMS := $(shell echo ${PLATFORMS} | sed 's/ /|/g')
# Convenience function for adding build definitions
# $(eval $(call add_define,FOO)) will have:
@@ -144,9 +149,10 @@ $(and $(patsubst 0,,$(value $(1))),$(patsubst 1,,$(value $(1))),$(error $(1) mus
endef
ifeq (${PLAT},)
- $(error "Error: Unknown platform. Please use PLAT=<platform name> to specify the platform.")
+ $(error "Error: Unknown platform. Please use PLAT=<platform name> to specify the platform")
endif
-ifeq ($(findstring ${PLAT},${PLATFORMS}),)
+PLAT_MAKEFILE_FULL := $(shell find plat/ -wholename '*/${PLAT}/${PLAT_MAKEFILE}')
+ifeq ($(PLAT_MAKEFILE_FULL),)
$(error "Error: Invalid platform. The following platforms are available: ${PLATFORMS}")
endif
@@ -155,7 +161,7 @@ all: msg_start
msg_start:
@echo "Building ${PLAT}"
-include plat/${PLAT}/platform.mk
+include ${PLAT_MAKEFILE_FULL}
# Include the CPU specific operations makefile. By default all CPU errata
# workarounds and CPU specifc optimisations are disabled. This can be
@@ -225,6 +231,9 @@ CFLAGS += -g
ASFLAGS += -g -Wa,--gdwarf-2
endif
+# Process PLAT flag
+$(eval $(call add_define,PLAT_${PLAT}))
+
# Process NS_TIMER_SWITCH flag
$(eval $(call assert_boolean,NS_TIMER_SWITCH))
$(eval $(call add_define,NS_TIMER_SWITCH))
@@ -633,7 +642,7 @@ cscope:
${Q}cscope -b -q -k
help:
- @echo "usage: ${MAKE} PLAT=<${HELP_PLATFORMS}> [OPTIONS] [TARGET]"
+ @echo "usage: ${MAKE} PLAT=<${PLATFORMS}> [OPTIONS] [TARGET]"
@echo ""
@echo "PLAT is used to specify which platform you wish to build."
@echo "If no platform is specified, PLAT defaults to: ${DEFAULT_PLAT}"
diff --git a/bl32/tsp/tsp.mk b/bl32/tsp/tsp.mk
index f17ef1e1..aeda31ab 100644
--- a/bl32/tsp/tsp.mk
+++ b/bl32/tsp/tsp.mk
@@ -52,7 +52,7 @@ $(eval $(call add_define,TSP_INIT_ASYNC))
# Include the platform-specific TSP Makefile
# If no platform-specific TSP Makefile exists, it means TSP is not supported
# on this platform.
-TSP_PLAT_MAKEFILE := plat/${PLAT}/tsp/tsp-${PLAT}.mk
+TSP_PLAT_MAKEFILE := $(shell find plat/ -wholename '*/${PLAT}/tsp/tsp-${PLAT}.mk')
ifeq (,$(wildcard ${TSP_PLAT_MAKEFILE}))
$(error TSP is not supported on platform ${PLAT})
else
diff --git a/tools/cert_create/Makefile b/tools/cert_create/Makefile
index f1aa7974..eac8cec8 100644
--- a/tools/cert_create/Makefile
+++ b/tools/cert_create/Makefile
@@ -47,7 +47,13 @@ CFLAGS := -Wall -std=c99
# Check the platform
ifeq (${PLAT},none)
- $(error Error: No platform defined. Use PLAT=<platform>.)
+ $(error "Error: Unknown platform. Please use PLAT=<platform name> to specify the platform")
+endif
+PLAT_MAKEFILE := platform.mk
+PLAT_INCLUDE := $(shell find ../../plat/ -wholename '*/${PLAT}/${PLAT_MAKEFILE}' | \
+ sed 's/${PLAT_MAKEFILE}/include/')
+ifeq ($(PLAT_INCLUDE),)
+ $(error "Error: Invalid platform '${PLAT}'")
endif
ifeq (${DEBUG},1)
@@ -63,7 +69,7 @@ endif
# Make soft links and include from local directory otherwise wrong headers
# could get pulled in from firmware tree.
-INC_DIR := -I ./include -I ../../plat/${PLAT}/include
+INC_DIR := -I ./include -I ${PLAT_INCLUDE}
LIB_DIR :=
LIB := -lssl -lcrypto