Commit 2042b548 authored by Masahiro Yamada's avatar Masahiro Yamada

kbuild: unset variables in top Makefile instead of setting 0

There is no need to set 0 to variables such as config-targets,
mixed-targets, etc.

Unset instead of setting 0 in order to use 'ifdef' to test them.

I also renamed:

  config-targets  ->  config-build
  mixed-targets   ->  mixed-build
  dot-config      ->  need-config

to clarify what we are doing.
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
parent 125d059b
...@@ -272,32 +272,32 @@ no-dot-config-targets := $(clean-targets) \ ...@@ -272,32 +272,32 @@ no-dot-config-targets := $(clean-targets) \
no-sync-config-targets := $(no-dot-config-targets) install %install \ no-sync-config-targets := $(no-dot-config-targets) install %install \
kernelrelease kernelrelease
config-targets := 0 config-build :=
mixed-targets := 0 mixed-build :=
dot-config := 1 need-config := 1
may-sync-config := 1 may-sync-config := 1
ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),) ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),) ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
dot-config := 0 need-config :=
endif endif
endif endif
ifneq ($(filter $(no-sync-config-targets), $(MAKECMDGOALS)),) ifneq ($(filter $(no-sync-config-targets), $(MAKECMDGOALS)),)
ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),) ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),)
may-sync-config := 0 may-sync-config :=
endif endif
endif endif
ifneq ($(KBUILD_EXTMOD),) ifneq ($(KBUILD_EXTMOD),)
may-sync-config := 0 may-sync-config :=
endif endif
ifeq ($(KBUILD_EXTMOD),) ifeq ($(KBUILD_EXTMOD),)
ifneq ($(filter config %config,$(MAKECMDGOALS)),) ifneq ($(filter config %config,$(MAKECMDGOALS)),)
config-targets := 1 config-build := 1
ifneq ($(words $(MAKECMDGOALS)),1) ifneq ($(words $(MAKECMDGOALS)),1)
mixed-targets := 1 mixed-build := 1
endif endif
endif endif
endif endif
...@@ -305,18 +305,18 @@ endif ...@@ -305,18 +305,18 @@ endif
# For "make -j clean all", "make -j mrproper defconfig all", etc. # For "make -j clean all", "make -j mrproper defconfig all", etc.
ifneq ($(filter $(clean-targets),$(MAKECMDGOALS)),) ifneq ($(filter $(clean-targets),$(MAKECMDGOALS)),)
ifneq ($(filter-out $(clean-targets),$(MAKECMDGOALS)),) ifneq ($(filter-out $(clean-targets),$(MAKECMDGOALS)),)
mixed-targets := 1 mixed-build := 1
endif endif
endif endif
# install and modules_install need also be processed one by one # install and modules_install need also be processed one by one
ifneq ($(filter install,$(MAKECMDGOALS)),) ifneq ($(filter install,$(MAKECMDGOALS)),)
ifneq ($(filter modules_install,$(MAKECMDGOALS)),) ifneq ($(filter modules_install,$(MAKECMDGOALS)),)
mixed-targets := 1 mixed-build := 1
endif endif
endif endif
ifeq ($(mixed-targets),1) ifdef mixed-build
# =========================================================================== # ===========================================================================
# We're called with mixed targets (*config and build targets). # We're called with mixed targets (*config and build targets).
# Handle them one by one. # Handle them one by one.
...@@ -332,7 +332,7 @@ __build_one_by_one: ...@@ -332,7 +332,7 @@ __build_one_by_one:
$(MAKE) -f $(srctree)/Makefile $$i; \ $(MAKE) -f $(srctree)/Makefile $$i; \
done done
else else # !mixed-build
include scripts/Kbuild.include include scripts/Kbuild.include
...@@ -544,7 +544,7 @@ endif ...@@ -544,7 +544,7 @@ endif
# and from include/config/auto.conf.cmd to detect the compiler upgrade. # and from include/config/auto.conf.cmd to detect the compiler upgrade.
CC_VERSION_TEXT = $(shell $(CC) --version 2>/dev/null | head -n 1) CC_VERSION_TEXT = $(shell $(CC) --version 2>/dev/null | head -n 1)
ifeq ($(config-targets),1) ifdef config-build
# =========================================================================== # ===========================================================================
# *config targets only - make sure prerequisites are updated, and descend # *config targets only - make sure prerequisites are updated, and descend
# in scripts/kconfig to make the *config target # in scripts/kconfig to make the *config target
...@@ -561,7 +561,7 @@ config: scripts_basic outputmakefile FORCE ...@@ -561,7 +561,7 @@ config: scripts_basic outputmakefile FORCE
%config: scripts_basic outputmakefile FORCE %config: scripts_basic outputmakefile FORCE
$(Q)$(MAKE) $(build)=scripts/kconfig $@ $(Q)$(MAKE) $(build)=scripts/kconfig $@
else else #!config-build
# =========================================================================== # ===========================================================================
# Build targets only - this includes vmlinux, arch specific targets, clean # Build targets only - this includes vmlinux, arch specific targets, clean
# targets and others. In general all targets except *config targets. # targets and others. In general all targets except *config targets.
...@@ -604,7 +604,7 @@ endif ...@@ -604,7 +604,7 @@ endif
export KBUILD_MODULES KBUILD_BUILTIN export KBUILD_MODULES KBUILD_BUILTIN
ifeq ($(dot-config),1) ifdef need-config
include include/config/auto.conf include include/config/auto.conf
endif endif
...@@ -652,8 +652,8 @@ ARCH_AFLAGS := ...@@ -652,8 +652,8 @@ ARCH_AFLAGS :=
ARCH_CFLAGS := ARCH_CFLAGS :=
include arch/$(SRCARCH)/Makefile include arch/$(SRCARCH)/Makefile
ifeq ($(dot-config),1) ifdef need-config
ifeq ($(may-sync-config),1) ifdef may-sync-config
# Read in dependencies to all Kconfig* files, make sure to run syncconfig if # Read in dependencies to all Kconfig* files, make sure to run syncconfig if
# changes are detected. This should be included after arch/$(SRCARCH)/Makefile # changes are detected. This should be included after arch/$(SRCARCH)/Makefile
# because some architectures define CROSS_COMPILE there. # because some architectures define CROSS_COMPILE there.
...@@ -676,7 +676,7 @@ $(KCONFIG_CONFIG): ...@@ -676,7 +676,7 @@ $(KCONFIG_CONFIG):
# The syncconfig should be executed only once to make all the targets. # The syncconfig should be executed only once to make all the targets.
%/auto.conf %/auto.conf.cmd %/tristate.conf: $(KCONFIG_CONFIG) %/auto.conf %/auto.conf.cmd %/tristate.conf: $(KCONFIG_CONFIG)
$(Q)$(MAKE) -f $(srctree)/Makefile syncconfig $(Q)$(MAKE) -f $(srctree)/Makefile syncconfig
else else # !may-sync-config
# External modules and some install targets need include/generated/autoconf.h # External modules and some install targets need include/generated/autoconf.h
# and include/config/auto.conf but do not care if they are up-to-date. # and include/config/auto.conf but do not care if they are up-to-date.
# Use auto.conf to trigger the test # Use auto.conf to trigger the test
...@@ -692,7 +692,7 @@ include/config/auto.conf: ...@@ -692,7 +692,7 @@ include/config/auto.conf:
/bin/false) /bin/false)
endif # may-sync-config endif # may-sync-config
endif # $(dot-config) endif # need-config
KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,)
KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,) KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,)
...@@ -1809,9 +1809,9 @@ existing-targets := $(wildcard $(sort $(targets))) ...@@ -1809,9 +1809,9 @@ existing-targets := $(wildcard $(sort $(targets)))
-include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd) -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
endif # ifeq ($(config-targets),1) endif # config-targets
endif # ifeq ($(mixed-targets),1) endif # mixed-build
endif # need-sub-make endif # need-sub-make
PHONY += FORCE PHONY += FORCE
FORCE: FORCE:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment