[coreboot-gerrit] Patch set updated for coreboot: 97bdd5d make: support absolute and relative obj= specifications

Vadim Bendebury (vbendeb@chromium.org) gerrit at coreboot.org
Fri May 8 08:45:23 CEST 2015


Vadim Bendebury (vbendeb at chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10127

-gerrit

commit 97bdd5d6af1d525b6d0c5356b650b94066427e72
Author: Vadim Bendebury <vbendeb at chromium.org>
Date:   Wed May 6 21:00:10 2015 -0700

    make: support absolute and relative obj= specifications
    
    There has been a problem with out of tree build directories specified
    using relative paths, as in
    
    $ make obj=../build/peppy
    
    while specifying full path to obj works fine. This patch fixes the
    problem, making sure that make's path manipulation string substitute
    command is applied to both source and build roots.
    
    To test this ran the following script
    
    echo > /tmp/build.log
    for build_root in ./ ../ ''; do
      build_dirs="${build_root}build/peppy"
      if [ -n "${build_root}" ]; then
        build_dirs+=" $(realpath ${build_root})/build/peppy"
      fi
      for build_dir in ${build_dirs}; do
        rm -rf $build_dir .config* build* ../build*
        make obj=${build_dir} menuconfig # configure for google peppy board
        echo "building in ${build_dir}" >> /tmp/build.log
        if ! make obj=${build_dir}; then
          exit
        fi
      done
    done
    
    and then checked the generated file:
    
    $ cat /tmp/build.log
    
    building in ./build/peppy
    building in /home/vbendeb/old_projects/coreboot/source_code/build/peppy
    building in ../build/peppy
    building in /home/vbendeb/old_projects/coreboot/build/peppy
    building in build/peppy
    
    Change-Id: If46b046108e906796fe84716e93bf341b3785f14
    Signed-off-by: Vadim Bendebury <vbendeb at chromium.org>
---
 Makefile | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 2ff4ebe..9d174e0 100644
--- a/Makefile
+++ b/Makefile
@@ -43,9 +43,12 @@ include .xcompile
 export top := $(CURDIR)
 export src := src
 export srck := $(top)/util/kconfig
-export obj ?= build
+obj ?= build
+override obj := $(subst $(top)/,,$(abspath $(obj)))
+export obj
 export objutil ?= $(obj)/util
 export objk := $(objutil)/kconfig
+absobj := $(abspath $(obj))
 
 
 export KCONFIG_AUTOHEADER := $(obj)/config.h
@@ -184,8 +187,9 @@ includemakefiles= \
 	$(foreach class,$(classes-y), $(call add-class,$(class))) \
 	$(foreach class,$(classes), \
 		$(eval $(class)-srcs+= \
+			$$(subst $(absobj)/,$(obj)/, \
 			$$(subst $(top)/,, \
-			$$(abspath $$(subst $(dir $(1))/,/,$$(addprefix $(dir $(1)),$$($(class)-y))))))) \
+			$$(abspath $$(subst $(dir $(1))/,/,$$(addprefix $(dir $(1)),$$($(class)-y)))))))) \
 	$(foreach special,$(special-classes), \
 		$(foreach item,$($(special)-y), $(call $(special)-handler,$(dir $(1)),$(item)))) \
 	$(eval subdirs+=$$(subst $(CURDIR)/,,$$(abspath $$(addprefix $(dir $(1)),$$(subdirs-y)))))



More information about the coreboot-gerrit mailing list