mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-19 19:14:28 +00:00
Allow deeper platform port directory structure
Update the top level makefile to allow platform ports to exist in subdirectories at any level instead of one level under `plat/`. The makefile recursively searches for all files called `platform.mk` in all subdirectories of `plat/`. The directory containing `platform.mk` is the platform name. Platform names must be unique across the codebase. Replace usage of HELP_PLATFORMS in the Makefile with PLATFORMS since these are both used to report the same information back to the user. Update the TSP and cert_create tool makefiles in a similar way to support a deeper platform port directory structure. Also add PLAT_<plat_name> as a define passed through the top level makefile to the source files, to allow build time variation in common platform code. Change-Id: I213420164808c5ddb99a26144e8e3f141a7417b7
This commit is contained in:
parent
d3b638cb4a
commit
c04d2606f6
3 changed files with 25 additions and 10 deletions
23
Makefile
23
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
|
# Redistribution and use in source and binary forms, with or without
|
||||||
# modification, are permitted provided that the following conditions are met:
|
# 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_BASE := ./build
|
||||||
BUILD_PLAT := ${BUILD_BASE}/${PLAT}/${BUILD_TYPE}
|
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)
|
SPDS := $(shell ls -I none services/spd)
|
||||||
HELP_PLATFORMS := $(shell echo ${PLATFORMS} | sed 's/ /|/g')
|
|
||||||
|
|
||||||
# Convenience function for adding build definitions
|
# Convenience function for adding build definitions
|
||||||
# $(eval $(call add_define,FOO)) will have:
|
# $(eval $(call add_define,FOO)) will have:
|
||||||
|
@ -144,9 +149,10 @@ $(and $(patsubst 0,,$(value $(1))),$(patsubst 1,,$(value $(1))),$(error $(1) mus
|
||||||
endef
|
endef
|
||||||
|
|
||||||
ifeq (${PLAT},)
|
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
|
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}")
|
$(error "Error: Invalid platform. The following platforms are available: ${PLATFORMS}")
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -155,7 +161,7 @@ all: msg_start
|
||||||
msg_start:
|
msg_start:
|
||||||
@echo "Building ${PLAT}"
|
@echo "Building ${PLAT}"
|
||||||
|
|
||||||
include plat/${PLAT}/platform.mk
|
include ${PLAT_MAKEFILE_FULL}
|
||||||
|
|
||||||
# Include the CPU specific operations makefile. By default all CPU errata
|
# Include the CPU specific operations makefile. By default all CPU errata
|
||||||
# workarounds and CPU specifc optimisations are disabled. This can be
|
# workarounds and CPU specifc optimisations are disabled. This can be
|
||||||
|
@ -225,6 +231,9 @@ CFLAGS += -g
|
||||||
ASFLAGS += -g -Wa,--gdwarf-2
|
ASFLAGS += -g -Wa,--gdwarf-2
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Process PLAT flag
|
||||||
|
$(eval $(call add_define,PLAT_${PLAT}))
|
||||||
|
|
||||||
# Process NS_TIMER_SWITCH flag
|
# Process NS_TIMER_SWITCH flag
|
||||||
$(eval $(call assert_boolean,NS_TIMER_SWITCH))
|
$(eval $(call assert_boolean,NS_TIMER_SWITCH))
|
||||||
$(eval $(call add_define,NS_TIMER_SWITCH))
|
$(eval $(call add_define,NS_TIMER_SWITCH))
|
||||||
|
@ -633,7 +642,7 @@ cscope:
|
||||||
${Q}cscope -b -q -k
|
${Q}cscope -b -q -k
|
||||||
|
|
||||||
help:
|
help:
|
||||||
@echo "usage: ${MAKE} PLAT=<${HELP_PLATFORMS}> [OPTIONS] [TARGET]"
|
@echo "usage: ${MAKE} PLAT=<${PLATFORMS}> [OPTIONS] [TARGET]"
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "PLAT is used to specify which platform you wish to build."
|
@echo "PLAT is used to specify which platform you wish to build."
|
||||||
@echo "If no platform is specified, PLAT defaults to: ${DEFAULT_PLAT}"
|
@echo "If no platform is specified, PLAT defaults to: ${DEFAULT_PLAT}"
|
||||||
|
|
|
@ -52,7 +52,7 @@ $(eval $(call add_define,TSP_INIT_ASYNC))
|
||||||
# Include the platform-specific TSP Makefile
|
# Include the platform-specific TSP Makefile
|
||||||
# If no platform-specific TSP Makefile exists, it means TSP is not supported
|
# If no platform-specific TSP Makefile exists, it means TSP is not supported
|
||||||
# on this platform.
|
# 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}))
|
ifeq (,$(wildcard ${TSP_PLAT_MAKEFILE}))
|
||||||
$(error TSP is not supported on platform ${PLAT})
|
$(error TSP is not supported on platform ${PLAT})
|
||||||
else
|
else
|
||||||
|
|
|
@ -47,7 +47,13 @@ CFLAGS := -Wall -std=c99
|
||||||
|
|
||||||
# Check the platform
|
# Check the platform
|
||||||
ifeq (${PLAT},none)
|
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
|
endif
|
||||||
|
|
||||||
ifeq (${DEBUG},1)
|
ifeq (${DEBUG},1)
|
||||||
|
@ -63,7 +69,7 @@ endif
|
||||||
|
|
||||||
# Make soft links and include from local directory otherwise wrong headers
|
# Make soft links and include from local directory otherwise wrong headers
|
||||||
# could get pulled in from firmware tree.
|
# 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_DIR :=
|
||||||
LIB := -lssl -lcrypto
|
LIB := -lssl -lcrypto
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue