History

Merge tag 'kbuild-v5.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull more Kbuild updates from Masahiro Yamada: - Convert sh and sparc to use generic shell scripts to generate the syscall headers - refactor .gitignore files - Update kernel/config_data.gz only when the content of the .config is really changed, which avoids the unneeded re-link of vmlinux - move "remove stale files" workarounds to scripts/remove-stale-files - suppress unused-but-set-variable warnings by default for Clang as well - fix locale setting LANG=C to LC_ALL=C - improve 'make distclean' - always keep intermediate objects from scripts/link-vmlinux.sh - move IF_ENABLED out of <linux/kconfig.h> to make it self-contained - misc cleanups * tag 'kbuild-v5.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (25 commits) linux/kconfig.h: replace IF_ENABLED() with PTR_IF() in <linux/kernel.h> kbuild: Don't remove link-vmlinux temporary files on exit/signal kbuild: remove the unneeded comments for external module builds kbuild: make distclean remove tag files in sub-directories kbuild: make distclean work against $(objtree) instead of $(srctree) kbuild: refactor modname-multi by using suffix-search kbuild: refactor fdtoverlay rule kbuild: parameterize the .o part of suffix-search arch: use cross_compiling to check whether it is a cross build or not kbuild: remove ARCH=sh64 support from top Makefile .gitignore: prefix local generated files with a slash kbuild: replace LANG=C with LC_ALL=C Makefile: Move -Wno-unused-but-set-variable out of GCC only block kbuild: add a script to remove stale generated files kbuild: update config_data.gz only when the content of .config is changed .gitignore: ignore only top-level modules.builtin .gitignore: move tags and TAGS close to other tag files kernel/.gitgnore: remove stale timeconst.h and hz.bc usr/include: refactor .gitignore genksyms: fix stale comment ...

Linus Torvalds committed 5 years ago

Commit 0f979d82 parents ab159ac 0ab143861 files · +183 −342Browse files

Showing the changes to scripts (15 of 61 files). Show all

Unified · Split

15 files
  1. scripts/.gitignore +9 −9
  2. scripts/Makefile.build +1 −1
  3. scripts/Makefile.lib +30 −27
  4. scripts/basic/.gitignore +1 −1
  5. scripts/dtc/.gitignore +2 −2
  6. scripts/gcc-plugins/.gitignore +1 −1
  7. scripts/genksyms/.gitignore +1 −1
  8. scripts/genksyms/Makefile +1 −1
  9. scripts/link-vmlinux.sh +0 −14
  10. scripts/mod/.gitignore +4 −4
  11. scripts/nsdeps +1 −1
  12. scripts/recordmcount.pl +1 −1
  13. scripts/remove-stale-files +31 −0
  14. scripts/setlocalversion +1 −1
  15. scripts/tags.sh +1 −1
scripts/.gitignore+9−9
@@ -1,11 +1,11 @@
1# SPDX-License-Identifier: GPL-2.0-only1# SPDX-License-Identifier: GPL-2.0-only
2bin2c2/asn1_compiler
3kallsyms3/bin2c
4unifdef4/extract-cert
5recordmcount5/insert-sys-cert
6sorttable6/kallsyms
7asn1_compiler
8extract-cert
9sign-file
10insert-sys-cert
11/module.lds7/module.lds
8/recordmcount
9/sign-file
10/sorttable
11/unifdef
scripts/Makefile.build+1−1
@@ -354,7 +354,7 @@ $(obj)/%.o: $(src)/%.S $(objtool_dep) FORCE · 353 unmodified lines
354 354
355targets += $(filter-out $(subdir-builtin), $(real-obj-y))355targets += $(filter-out $(subdir-builtin), $(real-obj-y))
356targets += $(filter-out $(subdir-modorder), $(real-obj-m))356targets += $(filter-out $(subdir-modorder), $(real-obj-m))
357targets += $(lib-y) $(always-y) $(MAKECMDGOALS)357targets += $(real-dtb-y) $(lib-y) $(always-y) $(MAKECMDGOALS)
358 358
359# Linker scripts preprocessor (.lds.S -> .lds)359# Linker scripts preprocessor (.lds.S -> .lds)
360# ---------------------------------------------------------------------------360# ---------------------------------------------------------------------------
scripts/Makefile.lib+30−27
@@ -44,19 +44,22 @@ else · 43 unmodified lines
44obj-y := $(filter-out %/, $(obj-y))44obj-y := $(filter-out %/, $(obj-y))
45endif45endif
46 46
47# Expand $(foo-objs) $(foo-y) by calling $(call suffix-search,foo.o,-objs -y)47# Expand $(foo-objs) $(foo-y) etc. by replacing their individuals
48suffix-search = $(strip $(foreach s, $2, $($(1:.o=$s))))48suffix-search = $(strip $(foreach s, $3, $($(1:%$(strip $2)=%$s))))
49# List composite targets that are constructed by combining other targets
50multi-search = $(sort $(foreach m, $1, $(if $(call suffix-search, $m, $2, $3 -), $m)))
51# List primitive targets that are compiled from source files
52real-search = $(foreach m, $1, $(if $(call suffix-search, $m, $2, $3 -), $(call suffix-search, $m, $2, $3), $m))
53
49# If $(foo-objs), $(foo-y), $(foo-m), or $(foo-) exists, foo.o is a composite object54# If $(foo-objs), $(foo-y), $(foo-m), or $(foo-) exists, foo.o is a composite object
50multi-search = $(sort $(foreach m, $1, $(if $(call suffix-search, $m, $2 -), $m)))55multi-obj-y := $(call multi-search, $(obj-y), .o, -objs -y)
51multi-obj-y := $(call multi-search,$(obj-y),-objs -y)56multi-obj-m := $(call multi-search, $(obj-m), .o, -objs -y -m)
52multi-obj-m := $(call multi-search,$(obj-m),-objs -y -m)
53multi-obj-ym := $(multi-obj-y) $(multi-obj-m)57multi-obj-ym := $(multi-obj-y) $(multi-obj-m)
54 58
55# Replace multi-part objects by their individual parts,59# Replace multi-part objects by their individual parts,
56# including built-in.a from subdirectories60# including built-in.a from subdirectories
57real-search = $(foreach m, $1, $(if $(call suffix-search, $m, $2 -), $(call suffix-search, $m, $2), $m))61real-obj-y := $(call real-search, $(obj-y), .o, -objs -y)
58real-obj-y := $(call real-search, $(obj-y),-objs -y)62real-obj-m := $(call real-search, $(obj-m), .o, -objs -y -m)
59real-obj-m := $(call real-search, $(obj-m),-objs -y -m)
60 63
61always-y += $(always-m)64always-y += $(always-m)
62 65
@@ -75,24 +78,18 @@ always-y += $(userprogs-always-y) $(userprogs-always-m) · 12 unmodified lines
75# If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built78# If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built
76dtb-$(CONFIG_OF_ALL_DTBS) += $(dtb-)79dtb-$(CONFIG_OF_ALL_DTBS) += $(dtb-)
77 80
78# List all dtbs to be generated by fdtoverlay81# Composite DTB (i.e. DTB constructed by overlay)
79overlay-y := $(foreach m,$(dtb-y), $(if $(strip $($(m:.dtb=-dtbs))),$(m),))82multi-dtb-y := $(call multi-search, $(dtb-y), .dtb, -dtbs)
80 83# Primitive DTB compiled from *.dts
81# Generate symbols for the base files so overlays can be applied to them.84real-dtb-y := $(call real-search, $(dtb-y), .dtb, -dtbs)
82$(foreach m,$(overlay-y), $(eval DTC_FLAGS_$(basename $(firstword $($(m:.dtb=-dtbs)))) += -@))85# Base DTB that overlay is applied onto (each first word of $(*-dtbs) expansion)
83 86base-dtb-y := $(foreach m, $(multi-dtb-y), $(firstword $(call suffix-search, $m, .dtb, -dtbs)))
84# Add base dtb and overlay dtbo
85dtb-y += $(foreach m,$(overlay-y), $($(m:.dtb=-dtbs)))
86 87
87always-y += $(dtb-y)88always-y += $(dtb-y)
88 89
89ifneq ($(CHECK_DTBS),)90ifneq ($(CHECK_DTBS),)
90# Don't run schema checks for dtbs created by fdtoverlay as they don't91always-y += $(patsubst %.dtb,%.dt.yaml, $(real-dtb-y))
91# have corresponding dts files.92always-y += $(patsubst %.dtbo,%.dt.yaml, $(real-dtb-y))
92dt-yaml-y := $(filter-out $(overlay-y),$(dtb-y))
93
94always-y += $(patsubst %.dtb,%.dt.yaml, $(dt-yaml-y))
95always-y += $(patsubst %.dtbo,%.dt.yaml, $(dt-yaml-y))
96endif93endif
97 94
98# Add subdir path95# Add subdir path
@@ -105,12 +102,14 @@ lib-y := $(addprefix $(obj)/,$(lib-y)) · 6 unmodified lines
105real-obj-y := $(addprefix $(obj)/,$(real-obj-y))102real-obj-y := $(addprefix $(obj)/,$(real-obj-y))
106real-obj-m := $(addprefix $(obj)/,$(real-obj-m))103real-obj-m := $(addprefix $(obj)/,$(real-obj-m))
107multi-obj-m := $(addprefix $(obj)/, $(multi-obj-m))104multi-obj-m := $(addprefix $(obj)/, $(multi-obj-m))
105multi-dtb-y := $(addprefix $(obj)/, $(multi-dtb-y))
106real-dtb-y := $(addprefix $(obj)/, $(real-dtb-y))
108subdir-ym := $(addprefix $(obj)/,$(subdir-ym))107subdir-ym := $(addprefix $(obj)/,$(subdir-ym))
109 108
110# Finds the multi-part object the current object will be linked into.109# Finds the multi-part object the current object will be linked into.
111# If the object belongs to two or more multi-part objects, list them all.110# If the object belongs to two or more multi-part objects, list them all.
112modname-multi = $(sort $(foreach m,$(multi-obj-ym),\111modname-multi = $(sort $(foreach m,$(multi-obj-ym),\
113 $(if $(filter $*.o, $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$(m:.o=))))112 $(if $(filter $*.o, $(call suffix-search, $m, .o, -objs -y -m)),$(m:.o=))))
114 113
115__modname = $(if $(modname-multi),$(modname-multi),$(basetarget))114__modname = $(if $(modname-multi),$(modname-multi),$(basetarget))
116 115
@@ -252,6 +251,9 @@ quiet_cmd_copy = COPY $@ · 135 unmodified lines
252 251
253# Shipped files252# Shipped files
254# ===========================================================================253# ===========================================================================
254# 'cp' preserves permissions. If you use it to copy a file in read-only srctree,
255# the copy would be read-only as well, leading to an error when executing the
256# rule next time. Use 'cat' instead in order to generate a writable file.
255 257
256quiet_cmd_shipped = SHIPPED $@258quiet_cmd_shipped = SHIPPED $@
257cmd_shipped = cat $< > $@259cmd_shipped = cat $< > $@
@@ -319,6 +321,9 @@ endif · 61 unmodified lines
319 321
320DTC_FLAGS += $(DTC_FLAGS_$(basetarget))322DTC_FLAGS += $(DTC_FLAGS_$(basetarget))
321 323
324# Set -@ if the target is a base DTB that overlay is applied onto
325DTC_FLAGS += $(if $(filter $(patsubst $(obj)/%,%,$@), $(base-dtb-y)), -@)
326
322# Generate an assembly file to wrap the output of the device tree compiler327# Generate an assembly file to wrap the output of the device tree compiler
323quiet_cmd_dt_S_dtb= DTB $@328quiet_cmd_dt_S_dtb= DTB $@
324cmd_dt_S_dtb= \329cmd_dt_S_dtb= \
@@ -350,14 +355,12 @@ $(obj)/%.dtb: $(src)/%.dts $(DTC) FORCE · 25 unmodified lines
350$(obj)/%.dtbo: $(src)/%.dts $(DTC) FORCE355$(obj)/%.dtbo: $(src)/%.dts $(DTC) FORCE
351 $(call if_changed_dep,dtc)356 $(call if_changed_dep,dtc)
352 357
353overlay-y := $(addprefix $(obj)/, $(overlay-y))
354
355quiet_cmd_fdtoverlay = DTOVL $@358quiet_cmd_fdtoverlay = DTOVL $@
356 cmd_fdtoverlay = $(objtree)/scripts/dtc/fdtoverlay -o $@ -i $(real-prereqs)359 cmd_fdtoverlay = $(objtree)/scripts/dtc/fdtoverlay -o $@ -i $(real-prereqs)
357 360
358$(overlay-y): FORCE361$(multi-dtb-y): FORCE
359 $(call if_changed,fdtoverlay)362 $(call if_changed,fdtoverlay)
360$(call multi_depend, $(overlay-y), .dtb, -dtbs)363$(call multi_depend, $(multi-dtb-y), .dtb, -dtbs)
361 364
362DT_CHECKER ?= dt-validate365DT_CHECKER ?= dt-validate
363DT_CHECKER_FLAGS ?= $(if $(DT_SCHEMA_FILES),,-m)366DT_CHECKER_FLAGS ?= $(if $(DT_SCHEMA_FILES),,-m)
scripts/basic/.gitignore+1−1
@@ -1,2 +1,2 @@
1# SPDX-License-Identifier: GPL-2.0-only1# SPDX-License-Identifier: GPL-2.0-only
2fixdep2/fixdep
scripts/dtc/.gitignore+2−2
@@ -1,3 +1,3 @@
1# SPDX-License-Identifier: GPL-2.0-only1# SPDX-License-Identifier: GPL-2.0-only
2dtc2/dtc
3fdtoverlay3/fdtoverlay
scripts/gcc-plugins/.gitignore+1−1
@@ -1,2 +1,2 @@
1# SPDX-License-Identifier: GPL-2.0-only1# SPDX-License-Identifier: GPL-2.0-only
2randomize_layout_seed.h2/randomize_layout_seed.h
scripts/genksyms/.gitignore+1−1
@@ -1,2 +1,2 @@
1# SPDX-License-Identifier: GPL-2.0-only1# SPDX-License-Identifier: GPL-2.0-only
2genksyms2/genksyms
scripts/genksyms/Makefile+1−1
@@ -22,7 +22,7 @@ $(obj)/pars%.tab.c $(obj)/pars%.tab.h: $(src)/pars%.y FORCE · 21 unmodified lines
22 22
23endif23endif
24 24
25# -I needed for generated C source (shipped source)25# -I needed for generated C source to include headers in source tree
26HOSTCFLAGS_parse.tab.o := -I $(srctree)/$(src)26HOSTCFLAGS_parse.tab.o := -I $(srctree)/$(src)
27HOSTCFLAGS_lex.lex.o := -I $(srctree)/$(src)27HOSTCFLAGS_lex.lex.o := -I $(srctree)/$(src)
28 28
scripts/link-vmlinux.sh+0−14
@@ -320,20 +320,6 @@ cleanup() · 319 unmodified lines
320 rm -f .vmlinux.d320 rm -f .vmlinux.d
321}321}
322 322
323on_exit()
324{
325 if [ $? -ne 0 ]; then
326 cleanup
327 fi
328}
329trap on_exit EXIT
330
331on_signals()
332{
333 exit 1
334}
335trap on_signals HUP INT QUIT TERM
336
337# Use "make V=1" to debug this script323# Use "make V=1" to debug this script
338case "${KBUILD_VERBOSE}" in324case "${KBUILD_VERBOSE}" in
339*1*)325*1*)
scripts/mod/.gitignore+4−4
@@ -1,5 +1,5 @@
1# SPDX-License-Identifier: GPL-2.0-only1# SPDX-License-Identifier: GPL-2.0-only
2elfconfig.h2/devicetable-offsets.h
3mk_elfconfig3/elfconfig.h
4modpost4/mk_elfconfig
5devicetable-offsets.h5/modpost
scripts/nsdeps+1−1
@@ -44,7 +44,7 @@ generate_deps() { · 43 unmodified lines
44 for source_file in $mod_source_files; do44 for source_file in $mod_source_files; do
45 sed '/MODULE_IMPORT_NS/Q' $source_file > ${source_file}.tmp45 sed '/MODULE_IMPORT_NS/Q' $source_file > ${source_file}.tmp
46 offset=$(wc -l ${source_file}.tmp | awk '{print $1;}')46 offset=$(wc -l ${source_file}.tmp | awk '{print $1;}')
47 cat $source_file | grep MODULE_IMPORT_NS | LANG=C sort -u >> ${source_file}.tmp47 cat $source_file | grep MODULE_IMPORT_NS | LC_ALL=C sort -u >> ${source_file}.tmp
48 tail -n +$((offset +1)) ${source_file} | grep -v MODULE_IMPORT_NS >> ${source_file}.tmp48 tail -n +$((offset +1)) ${source_file} | grep -v MODULE_IMPORT_NS >> ${source_file}.tmp
49 if ! diff -q ${source_file} ${source_file}.tmp; then49 if ! diff -q ${source_file} ${source_file}.tmp; then
50 mv ${source_file}.tmp ${source_file}50 mv ${source_file}.tmp ${source_file}
scripts/recordmcount.pl+1−1
@@ -497,7 +497,7 @@ sub update_funcs · 496 unmodified lines
497#497#
498# Step 2: find the sections and mcount call sites498# Step 2: find the sections and mcount call sites
499#499#
500open(IN, "LANG=C $objdump -hdr $inputfile|") || die "error running $objdump";500open(IN, "LC_ALL=C $objdump -hdr $inputfile|") || die "error running $objdump";
501 501
502my $text;502my $text;
503 503
scripts/remove-stale-files+31−0
@@ -0,0 +1,31 @@
1#!/bin/sh
2
3set -e
4
5# When you move, remove or rename generated files, you probably also update
6# .gitignore and cleaning rules in the Makefile. This is the right thing
7# to do. However, people usually do 'git pull', 'git bisect', etc. without
8# running 'make clean'. Then, the stale generated files are left over, often
9# causing build issues.
10#
11# Also, 'git status' shows such stale build artifacts as untracked files.
12# What is worse, some people send a wrong patch to get them back to .gitignore
13# without checking the commit history.
14#
15# So, when you (re)move generated files, please move the cleaning rules from
16# the Makefile to this script. This is run before Kbuild starts building
17# anything, so people will not be annoyed by such garbage files.
18#
19# This script is not intended to grow endlessly. Rather, it is a temporary scrap
20# yard. Stale files stay in this file for a while (for some release cycles?),
21# then will be really dead and removed from the code base entirely.
22
23# These were previously generated source files. When you are building the kernel
24# with O=, make sure to remove the stale files in the output tree. Otherwise,
25# the build system wrongly compiles the stale ones.
26if [ -n "${building_out_of_srctree}" ]; then
27 for f in fdt_rw.c fdt_ro.c fdt_wip.c fdt.c
28 do
29 rm -f arch/arm/boot/compressed/${f}
30 done
31fi
scripts/setlocalversion+1−1
@@ -126,7 +126,7 @@ scm_version() · 125 unmodified lines
126 fi126 fi
127 127
128 # Check for svn and a svn repo.128 # Check for svn and a svn repo.
129 if rev=$(LANG= LC_ALL= LC_MESSAGES=C svn info 2>/dev/null | grep '^Last Changed Rev'); then129 if rev=$(LC_ALL=C svn info 2>/dev/null | grep '^Last Changed Rev'); then
130 rev=$(echo $rev | awk '{print $NF}')130 rev=$(echo $rev | awk '{print $NF}')
131 printf -- '-svn%s' "$rev"131 printf -- '-svn%s' "$rev"
132 132
scripts/tags.sh+1−1
@@ -326,5 +326,5 @@ esac · 325 unmodified lines
326 326
327# Remove structure forward declarations.327# Remove structure forward declarations.
328if [ -n "$remove_structs" ]; then328if [ -n "$remove_structs" ]; then
329 LANG=C sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' $1329 LC_ALL=C sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' $1
330fi330fi