Skip to content

Commit a2bc8de

Browse files
committed
Merge tag 'kbuild-v4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kbuild updates from Masahiro Yamada: - Use Make-builtin $(abspath ...) helper to get absolute path - Add W=2 extra warning option to detect unused macros - Use more KCONFIG_CONFIG instead hard-coded .config - Fix bugs of tar*-pkg targets * tag 'kbuild-v4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: kbuild: buildtar: do not print successful message if tar returns error kbuild: buildtar: fix tar error when CONFIG_MODULES is disabled kbuild: Use KCONFIG_CONFIG in buildtar Kbuild: enable -Wunused-macros warning for "make W=2" kbuild: use $(abspath ...) instead of $(shell cd ... && /bin/pwd)
2 parents dff4d1f + 77780f7 commit a2bc8de

6 files changed

Lines changed: 29 additions & 30 deletions

File tree

‎Makefile‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ endif
130130
ifneq ($(KBUILD_OUTPUT),)
131131
# check that the output directory actually exists
132132
saved-output := $(KBUILD_OUTPUT)
133-
KBUILD_OUTPUT := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) \
134-
&& /bin/pwd)
133+
$(shell [ -d $(KBUILD_OUTPUT) ] || mkdir -p $(KBUILD_OUTPUT))
134+
KBUILD_OUTPUT := $(realpath $(KBUILD_OUTPUT))
135135
$(if $(KBUILD_OUTPUT),, \
136136
$(error failed to create output directory "$(saved-output)"))
137137

@@ -978,7 +978,7 @@ ifdef CONFIG_HEADERS_CHECK
978978
$(Q)$(MAKE) -f $(srctree)/Makefile headers_check
979979
endif
980980
ifdef CONFIG_GDB_SCRIPTS
981-
$(Q)ln -fsn `cd $(srctree) && /bin/pwd`/scripts/gdb/vmlinux-gdb.py
981+
$(Q)ln -fsn $(abspath $(srctree)/scripts/gdb/vmlinux-gdb.py)
982982
endif
983983
ifdef CONFIG_TRIM_UNUSED_KSYMS
984984
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh \
@@ -1238,7 +1238,7 @@ _modinst_:
12381238
@rm -rf $(MODLIB)/kernel
12391239
@rm -f $(MODLIB)/source
12401240
@mkdir -p $(MODLIB)/kernel
1241-
@ln -s `cd $(srctree) && /bin/pwd` $(MODLIB)/source
1241+
@ln -s $(abspath $(srctree)) $(MODLIB)/source
12421242
@if [ ! $(objtree) -ef $(MODLIB)/build ]; then \
12431243
rm -f $(MODLIB)/build ; \
12441244
ln -s $(CURDIR) $(MODLIB)/build ; \
@@ -1630,11 +1630,11 @@ image_name:
16301630
# Clear a bunch of variables before executing the submake
16311631
tools/: FORCE
16321632
$(Q)mkdir -p $(objtree)/tools
1633-
$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(shell cd $(objtree) && /bin/pwd) subdir=tools -C $(src)/tools/
1633+
$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(src)/tools/
16341634

16351635
tools/%: FORCE
16361636
$(Q)mkdir -p $(objtree)/tools
1637-
$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(shell cd $(objtree) && /bin/pwd) subdir=tools -C $(src)/tools/ $*
1637+
$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(src)/tools/ $*
16381638

16391639
# Single targets
16401640
# ---------------------------------------------------------------------------

‎scripts/Makefile.extrawarn‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ warning-2 += $(call cc-option, -Wlogical-op)
3737
warning-2 += $(call cc-option, -Wmissing-field-initializers)
3838
warning-2 += $(call cc-option, -Wsign-compare)
3939
warning-2 += $(call cc-option, -Wmaybe-uninitialized)
40+
warning-2 += $(call cc-option, -Wunused-macros)
4041

4142
warning-3 := -Wbad-function-cast
4243
warning-3 += -Wcast-qual

‎scripts/gdb/linux/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
always := gdb-scripts
22

3-
SRCTREE := $(shell cd $(srctree) && /bin/pwd)
3+
SRCTREE := $(abspath $(srctree))
44

55
$(obj)/gdb-scripts:
66
ifneq ($(KBUILD_SRC),)

‎scripts/package/buildtar‎

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,19 @@ tarball="${objtree}/linux-${KERNELRELEASE}-${ARCH}.tar"
2424
#
2525
case "${1}" in
2626
tar-pkg)
27-
compress="cat"
28-
file_ext=""
27+
opts=
2928
;;
3029
targz-pkg)
31-
compress="gzip"
32-
file_ext=".gz"
30+
opts=--gzip
31+
tarball=${tarball}.gz
3332
;;
3433
tarbz2-pkg)
35-
compress="bzip2"
36-
file_ext=".bz2"
34+
opts=--bzip2
35+
tarball=${tarball}.bz2
3736
;;
3837
tarxz-pkg)
39-
compress="xz"
40-
file_ext=".xz"
38+
opts=--xz
39+
tarball=${tarball}.xz
4140
;;
4241
*)
4342
echo "Unknown tarball target \"${1}\" requested, please add it to ${0}." >&2
@@ -51,21 +50,22 @@ esac
5150
#
5251
rm -rf -- "${tmpdir}"
5352
mkdir -p -- "${tmpdir}/boot"
54-
53+
dirs=boot
5554

5655
#
5756
# Try to install modules
5857
#
59-
if grep -q '^CONFIG_MODULES=y' "${objtree}/.config"; then
58+
if grep -q '^CONFIG_MODULES=y' "${KCONFIG_CONFIG}"; then
6059
make ARCH="${ARCH}" O="${objtree}" KBUILD_SRC= INSTALL_MOD_PATH="${tmpdir}" modules_install
60+
dirs="$dirs lib"
6161
fi
6262

6363

6464
#
6565
# Install basic kernel files
6666
#
6767
cp -v -- "${objtree}/System.map" "${tmpdir}/boot/System.map-${KERNELRELEASE}"
68-
cp -v -- "${objtree}/.config" "${tmpdir}/boot/config-${KERNELRELEASE}"
68+
cp -v -- "${KCONFIG_CONFIG}" "${tmpdir}/boot/config-${KERNELRELEASE}"
6969
cp -v -- "${objtree}/vmlinux" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
7070

7171

@@ -124,14 +124,12 @@ esac
124124
#
125125
# Create the tarball
126126
#
127-
(
128-
opts=
129-
if tar --owner=root --group=root --help >/dev/null 2>&1; then
130-
opts="--owner=root --group=root"
131-
fi
132-
tar cf - -C "$tmpdir" boot/ lib/ $opts | ${compress} > "${tarball}${file_ext}"
133-
)
127+
if tar --owner=root --group=root --help >/dev/null 2>&1; then
128+
opts="$opts --owner=root --group=root"
129+
fi
130+
131+
tar cf $tarball -C $tmpdir $opts $dirs
134132

135-
echo "Tarball successfully created in ${tarball}${file_ext}"
133+
echo "Tarball successfully created in $tarball"
136134

137135
exit 0

‎tools/power/cpupower/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ endif
2626

2727
ifneq ($(OUTPUT),)
2828
# check that the output directory actually exists
29-
OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd)
29+
OUTDIR := $(realpath $(OUTPUT))
3030
$(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist))
3131
endif
3232

‎tools/scripts/Makefile.include‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ifneq ($(O),)
22
ifeq ($(origin O), command line)
3-
dummy := $(if $(shell test -d $(O) || echo $(O)),$(error O=$(O) does not exist),)
4-
ABSOLUTE_O := $(shell cd $(O) ; pwd)
3+
ABSOLUTE_O := $(realpath $(O))
4+
dummy := $(if $(ABSOLUTE_O),,$(error O=$(O) does not exist))
55
OUTPUT := $(ABSOLUTE_O)/$(if $(subdir),$(subdir)/)
66
COMMAND_O := O=$(ABSOLUTE_O)
77
ifeq ($(objtree),)
@@ -12,7 +12,7 @@ endif
1212

1313
# check that the output directory actually exists
1414
ifneq ($(OUTPUT),)
15-
OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd)
15+
OUTDIR := $(realpath $(OUTPUT))
1616
$(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist))
1717
endif
1818

0 commit comments

Comments
 (0)