include scripts/Kbuild.include
# The filename Kbuild has precedence over Makefile
+# bbox: we also try to include Kbuild file in obj tree first
kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
-include $(if $(wildcard $(kbuild-dir)/Kbuild), $(kbuild-dir)/Kbuild, $(kbuild-dir)/Makefile)
+include $(if $(wildcard $(src)/Kbuild), $(src)/Kbuild, \
+ $(if $(wildcard $(kbuild-dir)/Kbuild), $(kbuild-dir)/Kbuild, \
+ $(kbuild-dir)/Makefile \
+ ) \
+ )
include scripts/Makefile.lib
# cd to objtree
cd -- "$2" || { echo "Syntax: $0 SRCTREE OBJTREE"; exit 1; }
+# In separate objtree build, include/ might not exist yet
+mkdir include 2>/dev/null
srctree="$1"
fi
# (Re)generate */Kbuild and */Config.in
-find -type d | while read -r d; do
+{ cd -- "$srctree" && find -type d; } | while read -r d; do
d="${d#./}"
+
src="$srctree/$d/Kbuild.src"
dst="$d/Kbuild"
+ mkdir -p -- "$d" 2>/dev/null
if test -f "$src"; then
#echo " CHK $dst"
src="$srctree/$d/Config.src"
dst="$d/Config.in"
+ mkdir -p -- "$d" 2>/dev/null
if test -f "$src"; then
#echo " CHK $dst"
--- /dev/null
+#!/bin/sh
+
+b=`basename $PWD`
+test "${b#busybox}" != "$b" || { echo "Must be run in busybox tree"; exit 1; }
+
+rm -rf ../testdir_make_O.$$
+mkdir ../testdir_make_O.$$
+odir=`cd ../testdir_make_O.$$ && pwd`
+test -d "$odir" || exit 1
+
+make O="$odir" $MAKEOPTS "$@" defconfig busybox 2>&1 | tee test_make_O.log