diff options
author | danh-arm <dan.handley@arm.com> | 2016-04-07 17:11:45 +0100 |
---|---|---|
committer | danh-arm <dan.handley@arm.com> | 2016-04-07 17:11:45 +0100 |
commit | 91e8ae66310142e9a62cb5fb45ade83d434acf95 (patch) | |
tree | 8774ff8fe05a8b82e33fe051aa5e804bfe1899dd /Makefile | |
parent | 105b59e7bb47b41daf8b707921203d13151b3227 (diff) | |
parent | 414ab8530dbd669e632dc09abb84eed88e8ebdb7 (diff) |
Merge pull request #578 from EvanLloyd/ejll/woa_make2
Make improvements for host environment portability
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 60 |
1 files changed, 25 insertions, 35 deletions
@@ -37,7 +37,9 @@ VERSION_MINOR := 2 # Default goal is build all images .DEFAULT_GOAL := all -include make_helpers/build_macros.mk +MAKE_HELPERS_DIRECTORY := make_helpers/ +include ${MAKE_HELPERS_DIRECTORY}build_macros.mk +include ${MAKE_HELPERS_DIRECTORY}build_env.mk ################################################################################ # Default values for build configurations @@ -111,9 +113,10 @@ CHECK_IGNORE := --ignore COMPLEX_MACRO \ CHECKPATCH_ARGS := --no-tree --no-signoff ${CHECK_IGNORE} CHECKCODE_ARGS := --no-patch --no-tree --no-signoff ${CHECK_IGNORE} # Do not check the coding style on C library files -CHECK_PATHS := $(shell ls -I include -I lib) \ - $(addprefix include/,$(shell ls -I stdlib include)) \ - $(addprefix lib/,$(shell ls -I stdlib lib)) +INCLUDE_DIRS_TO_CHECK := $(sort $(filter-out include/stdlib, $(wildcard include/*))) +LIB_DIRS_TO_CHECK := $(sort $(filter-out lib/stdlib, $(wildcard lib/*))) +ROOT_DIRS_TO_CHECK := $(sort $(filter-out lib include, $(wildcard *)))) +CHECK_PATHS := ${ROOT_DIRS_TO_CHECK} ${INCLUDE_DIRS_TO_CHECK} ${LIB_DIRS_TO_CHECK} ################################################################################ @@ -122,10 +125,10 @@ CHECK_PATHS := $(shell ls -I include -I lib) \ # Verbose flag ifeq (${V},0) - Q=@ + Q:=@ CHECKCODE_ARGS += --no-summary --terse else - Q= + Q:= endif export Q @@ -234,17 +237,12 @@ INCLUDES += -Iinclude/bl1 \ # Generic definitions ################################################################################ +include ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk + BUILD_BASE := ./build BUILD_PLAT := ${BUILD_BASE}/${PLAT}/${BUILD_TYPE} -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 := $(sort $(filter-out none, $(patsubst services/spd/%,%,$(wildcard services/spd/*)))) # Platforms providing their own TBB makefile may override this value INCLUDE_TBBR_MK := 1 @@ -260,7 +258,7 @@ ifdef EL3_PAYLOAD_BASE $(warning "The SPD and its BL32 companion will be present but ignored.") endif # We expect to locate an spd.mk under the specified SPD directory - SPD_MAKE := $(shell m="services/spd/${SPD}/${SPD}.mk"; [ -f "$$m" ] && echo "$$m") + SPD_MAKE := $(wildcard services/spd/${SPD}/${SPD}.mk) ifeq (${SPD_MAKE},) $(error Error: No services/spd/${SPD}/${SPD}.mk located) @@ -285,14 +283,6 @@ endif # makefile may use all previous definitions in this file) ################################################################################ -ifeq (${PLAT},) - $(error "Error: Unknown platform. Please use PLAT=<platform name> to specify the platform") -endif -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 - include ${PLAT_MAKEFILE_FULL} # If the platform has not defined ENABLE_PLAT_COMPAT, then enable it by default @@ -386,11 +376,11 @@ endif # Variables for use with Certificate Generation Tool CRTTOOLPATH ?= tools/cert_create -CRTTOOL ?= ${CRTTOOLPATH}/cert_create +CRTTOOL ?= ${CRTTOOLPATH}/cert_create${BIN_EXT} # Variables for use with Firmware Image Package FIPTOOLPATH ?= tools/fip_create -FIPTOOL ?= ${FIPTOOLPATH}/fip_create +FIPTOOL ?= ${FIPTOOLPATH}/fip_create${BIN_EXT} ################################################################################ @@ -545,14 +535,14 @@ endif clean: @echo " CLEAN" - ${Q}rm -rf ${BUILD_PLAT} + $(call SHELL_REMOVE_DIR,${BUILD_PLAT}) ${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean realclean distclean: @echo " REALCLEAN" - ${Q}rm -rf ${BUILD_BASE} - ${Q}rm -f ${CURDIR}/cscope.* + $(call SHELL_REMOVE_DIR,${BUILD_BASE}) + $(call SHELL_DELETE_ALL, ${CURDIR}/cscope.*) ${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean @@ -573,24 +563,24 @@ certtool: ${CRTTOOL} .PHONY: ${CRTTOOL} ${CRTTOOL}: ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} - @echo + @${ECHO_BLANK_LINE} @echo "Built $@ successfully" - @echo + @${ECHO_BLANK_LINE} ifneq (${GENERATE_COT},0) certificates: ${CRT_DEPS} ${CRTTOOL} ${Q}${CRTTOOL} ${CRT_ARGS} - @echo + @${ECHO_BLANK_LINE} @echo "Built $@ successfully" @echo "Certificates can be found in ${BUILD_PLAT}" - @echo + @${ECHO_BLANK_LINE} endif ${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS} ${FIPTOOL} ${Q}${FIPTOOL} --dump ${FIP_ARGS} $@ - @echo + @${ECHO_BLANK_LINE} @echo "Built $@ successfully" - @echo + @${ECHO_BLANK_LINE} ifneq (${GENERATE_COT},0) fwu_certificates: ${FWU_CRT_DEPS} ${CRTTOOL} @@ -621,7 +611,7 @@ cscope: ${Q}cscope -b -q -k help: - @echo "usage: ${MAKE} PLAT=<${PLATFORMS}> [OPTIONS] [TARGET]" + @echo "usage: ${MAKE} PLAT=<${PLATFORM_LIST}> [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}" |