summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Lloyd <evan.lloyd@arm.com>2017-04-07 16:58:57 +0100
committerEvan Lloyd <evan.lloyd@arm.com>2017-05-02 18:27:05 +0100
commit6ba7d274e25276143c3855dfa1a087f292141a63 (patch)
treecf907c249c53c3b64dada4b96ff54dd1c14b99f9
parent7fa3214e18ad640208eaf6c8d6111ec53f3894aa (diff)
Build: Fix parallel build
2 problems were found, but are in one change to avoid submitting a patch that might fail to build. The problems were: 1. The macro MAKE_PREREQ_DIR has a minor bug, in that it is capable of generating recursive dependencies. 2. The inclusion of BUILD_DIR in TEMP_OBJ_DIRS left no explicit dependency, BUILD_DIR might not exist when subdirectories are created by a thread on another CPU. This fix corrects these with the following changes: 1. MAKE_PREREQ_DIR does nothing for a direct self dependency. 2. BUILD_DIR is built using MAKE_PREREQ_DIR. 3. BUILD_DIR is an explicit prerequisite of all OBJ_DIRS. Change-Id: I938cddea4a006df225c02a47b9cf759212f27fb7 Signed-off-by: Evan Lloyd <evan.lloyd@arm.com>
-rw-r--r--make_helpers/build_macros.mk6
-rw-r--r--make_helpers/unix.mk5
-rw-r--r--make_helpers/windows.mk5
3 files changed, 12 insertions, 4 deletions
diff --git a/make_helpers/build_macros.mk b/make_helpers/build_macros.mk
index 93db2d66..cc513937 100644
--- a/make_helpers/build_macros.mk
+++ b/make_helpers/build_macros.mk
@@ -308,14 +308,16 @@ define MAKE_BL
$(eval BL_LINKERFILE := $(BL$(call uppercase,$(1))_LINKERFILE))
# We use sort only to get a list of unique object directory names.
# ordering is not relevant but sort removes duplicates.
- $(eval TEMP_OBJ_DIRS := $(sort $(BUILD_DIR)/ $(dir ${OBJS} ${LINKERFILE})))
+ $(eval TEMP_OBJ_DIRS := $(sort $(dir ${OBJS} ${LINKERFILE})))
# The $(dir ) function leaves a trailing / on the directory names
# Rip off the / to match directory names with make rule targets.
$(eval OBJ_DIRS := $(patsubst %/,%,$(TEMP_OBJ_DIRS)))
# Create generators for object directory structure
-$(eval $(foreach objd,${OBJ_DIRS},$(call MAKE_PREREQ_DIR,${objd},)))
+$(eval $(call MAKE_PREREQ_DIR,${BUILD_DIR},))
+
+$(eval $(foreach objd,${OBJ_DIRS},$(call MAKE_PREREQ_DIR,${objd},${BUILD_DIR})))
.PHONY : bl${1}_dirs
diff --git a/make_helpers/unix.mk b/make_helpers/unix.mk
index ab604357..6f702008 100644
--- a/make_helpers/unix.mk
+++ b/make_helpers/unix.mk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
+# Copyright (c) 2016-2017, 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:
@@ -67,11 +67,14 @@ ifndef UNIX_MK
# ${1} is the directory to be generated.
# ${2} is optional, and allows a prerequisite to be specified.
+ # Do nothing if $1 == $2, to ignore self dependencies.
define MAKE_PREREQ_DIR
+ ifneq (${1},${2})
${1} : ${2}
${Q}mkdir -p "${1}"
+ endif
endef
define SHELL_REMOVE_DIR
diff --git a/make_helpers/windows.mk b/make_helpers/windows.mk
index c4317d53..5138d1b9 100644
--- a/make_helpers/windows.mk
+++ b/make_helpers/windows.mk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
+# Copyright (c) 2016-2017, 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:
@@ -75,12 +75,15 @@ ifndef WINDOWS_MK
# ${1} is the directory to be generated.
# ${2} is optional, and allows prerequisites to be specified.
+ # Do nothing if $1 == $2, to ignore self dependencies.
define MAKE_PREREQ_DIR
+ ifneq (${1},${2})
${1} : ${2}
$(eval tmp_dir:=$(subst /,\,${1}))
-@if not exist "$(tmp_dir)" mkdir "${tmp_dir}"
+ endif
endef
# ${1} is the directory to be removed.