"Das U-Boot" Source Tree

kconfig / kbuild: Re-sync with Linux 4.20

Align Kconfig and Kbuild logic to Linux 4.20 release with minimal impact
on files outside of this scope.

Our previous Kconfig sync was done by commit 587e4a429698 ("kconfig /
kbuild: Re-sync with Linux 4.19").

As part of this re-sync, a few related changes from previous Linux
releases were found to have been missed and merged in, and are not in
the following list.

The imported Linux commits are:

[From prior to v4.19]
b1e0d8b70fa3 kbuild: Fix gcc -x syntax
a4353898980c kconfig: add CC_IS_GCC and GCC_VERSION
469cb7376c06 kconfig: add CC_IS_CLANG and CLANG_VERSION

[From v4.19 to v4.20]
487c7c7702ab kbuild: prefix Makefile.dtbinst path with $(srctree) unconditionally
0d91bf584fe5 kbuild: remove old check for CFLAGS use
25815cf5ffec kbuild: hide most of targets when running config or mixed targets
00d78ab2ba75 kbuild: remove dead code in cmd_files calculation in top Makefile
23066c3f4e21 Compiler Attributes: enable -Wstringop-truncation on W=1 (gcc >= 8)
37c8a5fafa3b kbuild: consolidate Devicetree dtb build rules
80463f1b7bf9 kbuild: add --include-dir flag only for out-of-tree build
77ec0c20c7e0 kbuild: remove VERSION and PATCHLEVEL from $(objtree)/Makefile
74bc0c09b2da kbuild: remove user ID check in scripts/mkmakefile
4fd61277f662 kbuild: do not pass $(objtree) to scripts/mkmakefile
80d0dda3a4e5 kbuild: simplify command line creation in scripts/mkmakefile
fb073a4b473e kbuild: add -Wno-pointer-sign flag unconditionally
9df3e7a7d7d6 kbuild: add -Wno-unused-but-set-variable flag unconditionally
69ea912fda74 kbuild: remove unneeded link_multi_deps
7d0ea2524202 kbuild: use 'else ifeq' for checksrc to improve readability
04c459d20448 kconfig: remove oldnoconfig target
0085b4191f3e kconfig: remove silentoldconfig target
3f80babd9ca4 kbuild: remove unused cc-fullversion variable
2cd3faf87d2d merge_config.sh: Allow to define config prefix
076f421da5d4 kbuild: replace cc-name test with CONFIG_CC_IS_CLANG
6bbe4385d035 kconfig: merge_config: avoid false positive matches from comment lines

[From post v4.20]
885480b08469 Makefile: Move -Wno-unused-but-set-variable out of GCC only block

There are a number of changes related to additional warnings as well as
being able to drop cc-name entirely that have been omitted for now as
additional work is required first.

Cc: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

Tom Rini 473fc279 e57c7c5c

+124 -99
+15
Kconfig
··· 57 57 58 58 which is done within the script "scripts/setlocalversion".) 59 59 60 + config CC_IS_GCC 61 + def_bool $(success,$(CC) --version | head -n 1 | grep -q gcc) 62 + 63 + config GCC_VERSION 64 + int 65 + default $(shell,$(srctree)/scripts/gcc-version.sh -p $(CC) | sed 's/^0*//') if CC_IS_GCC 66 + default 0 67 + 68 + config CC_IS_CLANG 69 + def_bool $(success,$(CC) --version | head -n 1 | grep -q clang) 70 + 71 + config CLANG_VERSION 72 + int 73 + default $(shell,$(srctree)/scripts/clang-version.sh $(CC)) 74 + 60 75 config CC_OPTIMIZE_FOR_SIZE 61 76 bool "Optimize for size" 62 77 default y
+49 -14
Makefile
··· 12 12 # Comments in this file are targeted only to the developer, do not 13 13 # expect to learn how to build the kernel reading this file. 14 14 15 - # o Do not use make's built-in rules and variables 16 - # (this increases performance and avoids hard-to-debug behaviour); 17 - # o Look for make include files relative to root of kernel src 18 - MAKEFLAGS += -rR --include-dir=$(CURDIR) 15 + # Do not use make's built-in rules and variables 16 + # (this increases performance and avoids hard-to-debug behaviour) 17 + MAKEFLAGS += -rR 19 18 20 19 # Determine target architecture for the sandbox 21 20 include include/host_arch.h ··· 161 160 && /bin/pwd) 162 161 $(if $(KBUILD_OUTPUT),, \ 163 162 $(error failed to create output directory "$(saved-output)")) 163 + 164 + # Look for make include files relative to root of kernel src 165 + # 166 + # This does not become effective immediately because MAKEFLAGS is re-parsed 167 + # once after the Makefile is read. It is OK since we are going to invoke 168 + # 'sub-make' below. 169 + MAKEFLAGS += --include-dir=$(CURDIR) 164 170 165 171 PHONY += $(MAKECMDGOALS) sub-make 166 172 ··· 492 498 outputmakefile: 493 499 ifneq ($(KBUILD_SRC),) 494 500 $(Q)ln -fsn $(srctree) source 495 - $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \ 496 - $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) 501 + $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree) 497 502 endif 498 503 499 504 # To make sure we do not include .config for any of the *config targets ··· 572 577 # Carefully list dependencies so we do not try to build scripts twice 573 578 # in parallel 574 579 PHONY += scripts 575 - scripts: scripts_basic include/config/auto.conf 580 + scripts: scripts_basic scripts_dtc include/config/auto.conf 576 581 $(Q)$(MAKE) $(build)=$(@) 577 582 578 583 ifeq ($(dot-config),1) ··· 709 714 endif 710 715 KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks) 711 716 717 + # disable pointer signed / unsigned warnings in gcc 4.0 718 + KBUILD_CFLAGS += -Wno-pointer-sign 719 + 712 720 # disable stringop warnings in gcc 8+ 713 721 KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation) 714 722 ··· 739 747 KBUILD_CFLAGS += $(call cc-option,-Wno-format-nonliteral) 740 748 KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) 741 749 742 - ifeq ($(cc-name),clang) 750 + ifdef CONFIG_CC_IS_CLANG 743 751 KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) 744 752 KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier) 745 753 KBUILD_CFLAGS += $(call cc-disable-warning, gnu) ··· 751 759 # See modpost pattern 2 752 760 KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,) 753 761 KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior) 754 - else 762 + endif 755 763 756 764 # These warnings generated too much noise in a regular build. 757 765 # Use make W=1 to enable them (see scripts/Makefile.extrawarn) 758 766 KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) 759 - endif 760 767 761 768 # Prohibit date/time macros, which would make the build non-deterministic 762 769 KBUILD_CFLAGS += $(call cc-option,-Werror=date-time) ··· 1947 1954 $(call filechk,defaultenv.h) 1948 1955 1949 1956 # --------------------------------------------------------------------------- 1957 + # Devicetree files 1958 + 1959 + ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/boot/dts/),) 1960 + dtstree := arch/$(SRCARCH)/boot/dts 1961 + endif 1962 + 1963 + ifneq ($(dtstree),) 1964 + 1965 + %.dtb: prepare3 scripts_dtc 1966 + $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@ 1967 + 1968 + PHONY += dtbs dtbs_install 1969 + dtbs: prepare3 scripts_dtc 1970 + $(Q)$(MAKE) $(build)=$(dtstree) 1971 + 1972 + dtbs_install: 1973 + $(Q)$(MAKE) $(dtbinst)=$(dtstree) 1974 + 1975 + ifdef CONFIG_OF_EARLY_FLATTREE 1976 + all: dtbs 1977 + endif 1978 + 1979 + endif 1980 + 1981 + PHONY += scripts_dtc 1982 + scripts_dtc: scripts_basic 1983 + $(Q)$(MAKE) $(build)=scripts/dtc 1984 + 1985 + # --------------------------------------------------------------------------- 1950 1986 quiet_cmd_cpp_lds = LDS $@ 1951 1987 cmd_cpp_lds = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) \ 1952 1988 -D__ASSEMBLY__ -x assembler-with-cpp -std=c99 -P -o $@ $< ··· 2208 2244 $(DOC_TARGETS): scripts_basic FORCE 2209 2245 $(Q)$(MAKE) $(build)=doc $@ 2210 2246 2211 - endif #ifeq ($(config-targets),1) 2212 - endif #ifeq ($(mixed-targets),1) 2213 - 2214 2247 PHONY += checkstack ubootrelease ubootversion 2215 2248 2216 2249 checkstack: ··· 2298 2331 2299 2332 # read all saved command lines 2300 2333 2301 - cmd_files := $(wildcard .*.cmd $(foreach f,$(sort $(targets)),$(dir $(f)).$(notdir $(f)).cmd)) 2334 + cmd_files := $(wildcard .*.cmd) 2302 2335 2303 2336 ifneq ($(cmd_files),) 2304 2337 $(cmd_files): ; # Do not try to update included dependency files 2305 2338 include $(cmd_files) 2306 2339 endif 2307 2340 2341 + endif #ifeq ($(config-targets),1) 2342 + endif #ifeq ($(mixed-targets),1) 2308 2343 endif # skip-makefile 2309 2344 2310 2345 PHONY += FORCE
+1 -5
scripts/Kbuild.include
··· 142 142 # cc-version 143 143 cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC)) 144 144 145 - # cc-fullversion 146 - cc-fullversion = $(shell $(CONFIG_SHELL) \ 147 - $(srctree)/scripts/gcc-version.sh -p $(CC)) 148 - 149 145 # cc-ifversion 150 146 # Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1) 151 147 cc-ifversion = $(shell [ $(cc-version) $(1) $(2) ] && echo $(3) || echo $(4)) ··· 193 189 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.dtbinst obj= 194 190 # Usage: 195 191 # $(Q)$(MAKE) $(dtbinst)=dir 196 - dtbinst := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.dtbinst obj 192 + dtbinst := -f $(srctree)/scripts/Makefile.dtbinst obj 197 193 198 194 ### 199 195 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=
+8 -33
scripts/Makefile.build
··· 48 48 49 49 include scripts/Kbuild.include 50 50 51 - # For backward compatibility check that these variables do not change 52 - save-cflags := $(CFLAGS) 53 - 54 51 # The filename Kbuild has precedence over Makefile 55 52 kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) 56 53 kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile) ··· 60 57 asflags-y += $(PLATFORM_CPPFLAGS) 61 58 ccflags-y += $(PLATFORM_CPPFLAGS) 62 59 cppflags-y += $(PLATFORM_CPPFLAGS) 63 - 64 - # If the save-* variables changed error out 65 - ifeq ($(KBUILD_NOPEDANTIC),) 66 - ifneq ("$(save-cflags)","$(CFLAGS)") 67 - $(error CFLAGS was changed in "$(kbuild-file)". Fix it to use ccflags-y) 68 - endif 69 - endif 70 60 71 61 include scripts/Makefile.lib 72 62 ··· 99 89 @: 100 90 101 91 # Linus' kernel sanity checking tool 102 - ifneq ($(KBUILD_CHECKSRC),0) 103 - ifeq ($(KBUILD_CHECKSRC),2) 104 - quiet_cmd_force_checksrc = CHECK $< 105 - cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< ; 106 - else 107 - quiet_cmd_checksrc = CHECK $< 108 - cmd_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< ; 109 - endif 92 + ifeq ($(KBUILD_CHECKSRC),1) 93 + quiet_cmd_checksrc = CHECK $< 94 + cmd_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< ; 95 + else ifeq ($(KBUILD_CHECKSRC),2) 96 + quiet_cmd_force_checksrc = CHECK $< 97 + cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< ; 110 98 endif 111 99 112 100 # Do section mismatch analysis for each module/built-in.o ··· 369 357 targets += $(lib-target) 370 358 endif 371 359 372 - # 373 - # Rule to link composite objects 374 - # 375 - # Composite objects are specified in kbuild makefile as follows: 376 - # <composite-object>-objs := <list of .o files> 377 - # or 378 - # <composite-object>-y := <list of .o files> 379 - link_multi_deps = \ 380 - $(filter $(addprefix $(obj)/, \ 381 - $($(subst $(obj)/,,$(@:.o=-objs))) \ 382 - $($(subst $(obj)/,,$(@:.o=-y)))), $^) 383 - 384 - 385 360 quiet_cmd_link_multi-y = AR $@ 386 - cmd_link_multi-y = rm -f $@; $(AR) cDPrsT$(KBUILD_ARFLAGS) $@ $(link_multi_deps) 361 + cmd_link_multi-y = rm -f $@; $(AR) cDPrsT$(KBUILD_ARFLAGS) $@ $(filter %.o,$^) 387 362 388 363 quiet_cmd_link_multi-m = AR [M] $@ 389 364 cmd_link_multi-m = $(cmd_link_multi-y) ··· 394 369 395 370 $(multi-used-m): FORCE 396 371 $(call if_changed,link_multi-m) 397 - @{ echo $(@:.o=.ko); echo $(link_multi_deps); } > $(MODVERDIR)/$(@F:.o=.mod) 372 + @{ echo $(@:.o=.ko); echo $(filter %.o,$^); } > $(MODVERDIR)/$(@F:.o=.mod) 398 373 $(call multi_depend, $(multi-used-m), .o, -objs -y) 399 374 400 375 targets += $(multi-used-y) $(multi-used-m)
+9
scripts/Makefile.extrawarn
··· 11 11 # are not supported by all versions of the compiler 12 12 # ========================================================================== 13 13 14 + KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned) 15 + 14 16 ifeq ("$(origin W)", "command line") 15 17 export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W) 16 18 endif ··· 25 27 warning-1 += -Wold-style-definition 26 28 warning-1 += $(call cc-option, -Wmissing-include-dirs) 27 29 warning-1 += $(call cc-option, -Wunused-but-set-variable) 30 + warning-1 += $(call cc-option, -Wunused-const-variable) 31 + warning-1 += $(call cc-option, -Wpacked-not-aligned) 32 + warning-1 += $(call cc-option, -Wstringop-truncation) 28 33 warning-1 += $(call cc-disable-warning, missing-field-initializers) 34 + warning-1 += $(call cc-disable-warning, sign-compare) 29 35 30 36 warning-2 := -Waggregate-return 31 37 warning-2 += -Wcast-align ··· 34 40 warning-2 += -Wshadow 35 41 warning-2 += $(call cc-option, -Wlogical-op) 36 42 warning-2 += $(call cc-option, -Wmissing-field-initializers) 43 + warning-2 += $(call cc-option, -Wsign-compare) 44 + warning-2 += $(call cc-option, -Wmaybe-uninitialized) 45 + warning-2 += $(call cc-option, -Wunused-macros) 37 46 38 47 warning-3 := -Wbad-function-cast 39 48 warning-3 += -Wcast-qual
+1 -1
scripts/Makefile.lib
··· 320 320 # Bring in any U-Boot-specific include at the end of the file 321 321 cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \ 322 322 (cat $<; $(if $(u_boot_dtsi),echo '$(pound)include "$(u_boot_dtsi)"')) > $(pre-tmp); \ 323 - $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $(pre-tmp) ; \ 323 + $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $(pre-tmp) ; \ 324 324 $(DTC) -O dtb -o $@ -b 0 \ 325 325 -i $(dir $<) $(DTC_FLAGS) \ 326 326 -d $(depfile).dtc.tmp $(dtc-tmp) || \
+23
scripts/clang-version.sh
··· 1 + #!/bin/sh 2 + # SPDX-License-Identifier: GPL-2.0 3 + # 4 + # clang-version [-p] clang-command 5 + # 6 + # Prints the compiler version of `clang-command' in a canonical 4-digit form 7 + # such as `0500' for clang-5.0 etc. 8 + # 9 + # With the -p option, prints the patchlevel as well, for example `050001' for 10 + # clang-5.0.1 etc. 11 + # 12 + 13 + compiler="$*" 14 + 15 + if ! ( $compiler --version | grep -q clang) ; then 16 + echo 0 17 + exit 1 18 + fi 19 + 20 + MAJOR=$(echo __clang_major__ | $compiler -E -x c - | tail -n 1) 21 + MINOR=$(echo __clang_minor__ | $compiler -E -x c - | tail -n 1) 22 + PATCHLEVEL=$(echo __clang_patchlevel__ | $compiler -E -x c - | tail -n 1) 23 + printf "%d%02d%02d\\n" $MAJOR $MINOR $PATCHLEVEL
+4 -3
scripts/gcc-version.sh
··· 1 1 #!/bin/sh 2 + # SPDX-License-Identifier: GPL-2.0 2 3 # 3 4 # gcc-version [-p] gcc-command 4 5 # ··· 22 23 exit 1 23 24 fi 24 25 25 - MAJOR=$(echo __GNUC__ | $compiler -E -xc - | tail -n 1) 26 - MINOR=$(echo __GNUC_MINOR__ | $compiler -E -xc - | tail -n 1) 26 + MAJOR=$(echo __GNUC__ | $compiler -E -x c - | tail -n 1) 27 + MINOR=$(echo __GNUC_MINOR__ | $compiler -E -x c - | tail -n 1) 27 28 if [ "x$with_patchlevel" != "x" ] ; then 28 - PATCHLEVEL=$(echo __GNUC_PATCHLEVEL__ | $compiler -E -xc - | tail -n 1) 29 + PATCHLEVEL=$(echo __GNUC_PATCHLEVEL__ | $compiler -E -x c - | tail -n 1) 29 30 printf "%02d%02d%02d\\n" $MAJOR $MINOR $PATCHLEVEL 30 31 else 31 32 printf "%02d%02d\\n" $MAJOR $MINOR
+1 -15
scripts/kconfig/Makefile
··· 74 74 $(simple-targets): $(obj)/conf 75 75 $< $(silent) --$@ $(Kconfig) 76 76 77 - PHONY += oldnoconfig silentoldconfig savedefconfig defconfig 78 - 79 - # oldnoconfig is an alias of olddefconfig, because people already are dependent 80 - # on its behavior (sets new symbols to their default value but not 'n') with the 81 - # counter-intuitive name. 82 - oldnoconfig: olddefconfig 83 - @echo " WARNING: \"oldnoconfig\" target will be removed after Linux 4.19" 84 - @echo " Please use \"olddefconfig\" instead, which is an alias." 85 - 86 - # We do not expect manual invokcation of "silentoldcofig" (or "syncconfig"). 87 - silentoldconfig: syncconfig 88 - @echo " WARNING: \"silentoldconfig\" has been renamed to \"syncconfig\"" 89 - @echo " and is now an internal implementation detail." 90 - @echo " What you want is probably \"oldconfig\"." 91 - @echo " \"silentoldconfig\" will be removed after Linux 4.19" 77 + PHONY += savedefconfig defconfig 92 78 93 79 savedefconfig: $(obj)/conf 94 80 $< $(silent) --$@=defconfig $(Kconfig)
-7
scripts/kconfig/conf.c
··· 460 460 {"randconfig", no_argument, NULL, randconfig}, 461 461 {"listnewconfig", no_argument, NULL, listnewconfig}, 462 462 {"olddefconfig", no_argument, NULL, olddefconfig}, 463 - /* 464 - * oldnoconfig is an alias of olddefconfig, because people already 465 - * are dependent on its behavior(sets new symbols to their default 466 - * value but not 'n') with the counter-intuitive name. 467 - */ 468 - {"oldnoconfig", no_argument, NULL, olddefconfig}, 469 463 {NULL, 0, NULL, 0} 470 464 }; 471 465 ··· 480 474 printf(" --syncconfig Similar to oldconfig but generates configuration in\n" 481 475 " include/{generated/,config/}\n"); 482 476 printf(" --olddefconfig Same as oldconfig but sets new symbols to their default value\n"); 483 - printf(" --oldnoconfig An alias of olddefconfig\n"); 484 477 printf(" --defconfig <file> New config with default defined in <file>\n"); 485 478 printf(" --savedefconfig <file> Save the minimal current configuration to <file>\n"); 486 479 printf(" --allnoconfig New config where all options are answered with no\n");
+8 -3
scripts/kconfig/merge_config.sh
··· 33 33 echo " -n use allnoconfig instead of alldefconfig" 34 34 echo " -r list redundant entries when merging fragments" 35 35 echo " -O dir to put generated output files. Consider setting \$KCONFIG_CONFIG instead." 36 + echo 37 + echo "Used prefix: '$CONFIG_PREFIX'. You can redefine it with \$CONFIG_ environment variable." 36 38 } 37 39 38 40 RUNMAKE=true 39 41 ALLTARGET=alldefconfig 40 42 WARNREDUN=false 41 43 OUTPUT=. 44 + CONFIG_PREFIX=${CONFIG_-CONFIG_} 42 45 43 46 while true; do 44 47 case $1 in ··· 99 102 fi 100 103 101 104 MERGE_LIST=$* 102 - SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/p" 105 + SED_CONFIG_EXP1="s/^\(${CONFIG_PREFIX}[a-zA-Z0-9_]*\)=.*/\1/p" 106 + SED_CONFIG_EXP2="s/^# \(${CONFIG_PREFIX}[a-zA-Z0-9_]*\) is not set$/\1/p" 107 + 103 108 TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX) 104 109 105 110 echo "Using $INITFILE as base" ··· 112 117 echo "The merge file '$MERGE_FILE' does not exist. Exit." >&2 113 118 exit 1 114 119 fi 115 - CFG_LIST=$(sed -n "$SED_CONFIG_EXP" $MERGE_FILE) 120 + CFG_LIST=$(sed -n -e "$SED_CONFIG_EXP1" -e "$SED_CONFIG_EXP2" $MERGE_FILE) 116 121 117 122 for CFG in $CFG_LIST ; do 118 123 grep -q -w $CFG $TMP_FILE || continue ··· 155 160 156 161 157 162 # Check all specified config values took (might have missed-dependency issues) 158 - for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do 163 + for CFG in $(sed -n -e "$SED_CONFIG_EXP1" -e "$SED_CONFIG_EXP2" $TMP_FILE); do 159 164 160 165 REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE) 161 166 ACTUAL_VAL=$(grep -w -e "$CFG" "$KCONFIG_CONFIG")
+5 -18
scripts/mkmakefile
··· 1 1 #!/bin/sh 2 + # SPDX-License-Identifier: GPL-2.0 2 3 # Generates a small Makefile used in the root of the output 3 4 # directory, to allow make to be started from there. 4 5 # The Makefile also allow for more convinient build of external modules 5 6 6 7 # Usage 7 8 # $1 - Kernel src directory 8 - # $2 - Output directory 9 - # $3 - version 10 - # $4 - patchlevel 11 9 12 - 13 - test ! -r $2/Makefile -o -O $2/Makefile || exit 0 14 10 # Only overwrite automatically generated Makefiles 15 11 # (so we do not overwrite kernel Makefile) 16 - if test -e $2/Makefile && ! grep -q Automatically $2/Makefile 12 + if test -e Makefile && ! grep -q Automatically Makefile 17 13 then 18 14 exit 0 19 15 fi 20 16 if [ "${quiet}" != "silent_" ]; then 21 - echo " GEN $2/Makefile" 17 + echo " GEN Makefile" 22 18 fi 23 19 24 - cat << EOF > $2/Makefile 20 + cat << EOF > Makefile 25 21 # Automatically generated by $0: don't edit 26 22 27 - VERSION = $3 28 - PATCHLEVEL = $4 29 - 30 - lastword = \$(word \$(words \$(1)),\$(1)) 31 - makedir := \$(dir \$(call lastword,\$(MAKEFILE_LIST))) 32 - 33 23 ifeq ("\$(origin V)", "command line") 34 24 VERBOSE := \$(V) 35 25 endif ··· 37 27 Q := @ 38 28 endif 39 29 40 - MAKEARGS := -C $1 41 - MAKEARGS += O=\$(if \$(patsubst /%,,\$(makedir)),\$(CURDIR)/)\$(patsubst %/,%,\$(makedir)) 42 - 43 30 MAKEFLAGS += --no-print-directory 44 31 45 32 .PHONY: __sub-make \$(MAKECMDGOALS) 46 33 47 34 __sub-make: 48 - \$(Q)\$(MAKE) \$(MAKEARGS) \$(MAKECMDGOALS) 35 + \$(Q)\$(MAKE) -C $1 O=\$(CURDIR) \$(MAKECMDGOALS) 49 36 50 37 \$(filter-out __sub-make, \$(MAKECMDGOALS)): __sub-make 51 38 @: