Skip to content

Commit 175209c

Browse files
committed
kbuild: pkg: use -f $(srctree)/Makefile to recurse to top Makefile
'$(MAKE) KBUILD_SRC=' changes the working directory back and forth between objtree and srctree. It is better to recurse to the top-level Makefile directly. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
1 parent ad15006 commit 175209c

4 files changed

Lines changed: 12 additions & 10 deletions

File tree

‎scripts/package/Makefile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ rpm-pkg: FORCE
5959
# binrpm-pkg
6060
# ---------------------------------------------------------------------------
6161
binrpm-pkg: FORCE
62-
$(MAKE) KBUILD_SRC=
62+
$(MAKE) -f $(srctree)/Makefile
6363
$(CONFIG_SHELL) $(MKSPEC) prebuilt > $(objtree)/binkernel.spec
6464
+rpmbuild $(RPMOPTS) --define "_builddir $(objtree)" --target \
6565
$(UTS_MACHINE) -bb $(objtree)/binkernel.spec
@@ -102,7 +102,7 @@ clean-dirs += $(objtree)/snap/
102102
# tarball targets
103103
# ---------------------------------------------------------------------------
104104
tar%pkg: FORCE
105-
$(MAKE) KBUILD_SRC=
105+
$(MAKE) -f $(srctree)/Makefile
106106
$(CONFIG_SHELL) $(srctree)/scripts/package/buildtar $@
107107

108108
clean-dirs += $(objtree)/tar-install/

‎scripts/package/builddeb‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ cp "$($MAKE -s -f $srctree/Makefile image_name)" "$tmpdir/$installed_image_path"
8686
if grep -q "^CONFIG_OF_EARLY_FLATTREE=y" $KCONFIG_CONFIG ; then
8787
# Only some architectures with OF support have this target
8888
if [ -d "${srctree}/arch/$SRCARCH/boot/dts" ]; then
89-
$MAKE KBUILD_SRC= INSTALL_DTBS_PATH="$tmpdir/usr/lib/$packagename" dtbs_install
89+
$MAKE -f $srctree/Makefile INSTALL_DTBS_PATH="$tmpdir/usr/lib/$packagename" dtbs_install
9090
fi
9191
fi
9292

9393
if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then
94-
INSTALL_MOD_PATH="$tmpdir" $MAKE KBUILD_SRC= modules_install
94+
INSTALL_MOD_PATH="$tmpdir" $MAKE -f $srctree/Makefile modules_install
9595
rm -f "$tmpdir/lib/modules/$version/build"
9696
rm -f "$tmpdir/lib/modules/$version/source"
9797
if [ "$ARCH" = "um" ] ; then
@@ -113,14 +113,14 @@ if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then
113113
# resign stripped modules
114114
MODULE_SIG_ALL="$(grep -s '^CONFIG_MODULE_SIG_ALL=y' $KCONFIG_CONFIG || true)"
115115
if [ -n "$MODULE_SIG_ALL" ]; then
116-
INSTALL_MOD_PATH="$tmpdir" $MAKE KBUILD_SRC= modules_sign
116+
INSTALL_MOD_PATH="$tmpdir" $MAKE -f $srctree/Makefile modules_sign
117117
fi
118118
fi
119119
fi
120120

121121
if [ "$ARCH" != "um" ]; then
122-
$MAKE headers_check KBUILD_SRC=
123-
$MAKE headers_install KBUILD_SRC= INSTALL_HDR_PATH="$libc_headers_dir/usr"
122+
$MAKE -f $srctree/Makefile headers_check
123+
$MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr"
124124
fi
125125

126126
# Install the maintainer scripts

‎scripts/package/buildtar‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ dirs=boot
5757
# Try to install modules
5858
#
5959
if grep -q '^CONFIG_MODULES=y' "${KCONFIG_CONFIG}"; then
60-
make ARCH="${ARCH}" O="${objtree}" KBUILD_SRC= INSTALL_MOD_PATH="${tmpdir}" modules_install
60+
make ARCH="${ARCH}" -f ${srctree}/Makefile INSTALL_MOD_PATH="${tmpdir}" modules_install
6161
dirs="$dirs lib"
6262
fi
6363

‎scripts/package/mkdebian‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,15 @@ EOF
205205
cat <<EOF > debian/rules
206206
#!$(command -v $MAKE) -f
207207
208+
srctree ?= .
209+
208210
build:
209211
\$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \
210-
KBUILD_BUILD_VERSION=${revision} KBUILD_SRC=
212+
KBUILD_BUILD_VERSION=${revision} -f \$(srctree)/Makefile
211213
212214
binary-arch:
213215
\$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \
214-
KBUILD_BUILD_VERSION=${revision} KBUILD_SRC= intdeb-pkg
216+
KBUILD_BUILD_VERSION=${revision} -f \$(srctree)/Makefile intdeb-pkg
215217
216218
clean:
217219
rm -rf debian/*tmp debian/files

0 commit comments

Comments
 (0)