From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: linux-kbuild@vger.kernel.org
Cc: Christoph Hellwig <hch@lst.de>, Sam Ravnborg <sam@ravnborg.org>,
Masahiro Yamada <yamada.masahiro@socionext.com>,
Michal Marek <michal.lkml@markovi.net>,
linux-kernel@vger.kernel.org
Subject: [PATCH 07/11] kbuild: unset variables in top Makefile instead of setting 0
Date: Sun, 11 Aug 2019 00:53:03 +0900 [thread overview]
Message-ID: <20190810155307.29322-8-yamada.masahiro@socionext.com> (raw)
In-Reply-To: <20190810155307.29322-1-yamada.masahiro@socionext.com>
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: Masahiro Yamada <yamada.masahiro@socionext.com>
---
Makefile | 46 +++++++++++++++++++++++-----------------------
1 file changed, 23 insertions(+), 23 deletions(-)
diff --git a/Makefile b/Makefile
index 3c186f59f152..706ca0d633df 100644
--- a/Makefile
+++ b/Makefile
@@ -272,32 +272,32 @@ no-dot-config-targets := $(clean-targets) \
no-sync-config-targets := $(no-dot-config-targets) install %install \
kernelrelease
-config-targets := 0
-mixed-targets := 0
-dot-config := 1
-may-sync-config := 1
+config-build :=
+mixed-build :=
+need-config := 1
+may-sync-config := 1
ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
- dot-config := 0
+ need-config :=
endif
endif
ifneq ($(filter $(no-sync-config-targets), $(MAKECMDGOALS)),)
ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),)
- may-sync-config := 0
+ may-sync-config :=
endif
endif
ifneq ($(KBUILD_EXTMOD),)
- may-sync-config := 0
+ may-sync-config :=
endif
ifeq ($(KBUILD_EXTMOD),)
ifneq ($(filter config %config,$(MAKECMDGOALS)),)
- config-targets := 1
+ config-build := 1
ifneq ($(words $(MAKECMDGOALS)),1)
- mixed-targets := 1
+ mixed-build := 1
endif
endif
endif
@@ -305,18 +305,18 @@ endif
# For "make -j clean all", "make -j mrproper defconfig all", etc.
ifneq ($(filter $(clean-targets),$(MAKECMDGOALS)),)
ifneq ($(filter-out $(clean-targets),$(MAKECMDGOALS)),)
- mixed-targets := 1
+ mixed-build := 1
endif
endif
# install and modules_install need also be processed one by one
ifneq ($(filter install,$(MAKECMDGOALS)),)
ifneq ($(filter modules_install,$(MAKECMDGOALS)),)
- mixed-targets := 1
+ mixed-build := 1
endif
endif
-ifeq ($(mixed-targets),1)
+ifdef mixed-build
# ===========================================================================
# We're called with mixed targets (*config and build targets).
# Handle them one by one.
@@ -332,7 +332,7 @@ __build_one_by_one:
$(MAKE) -f $(srctree)/Makefile $$i; \
done
-else
+else # !mixed-build
include scripts/Kbuild.include
@@ -544,7 +544,7 @@ endif
# and from include/config/auto.conf.cmd to detect the compiler upgrade.
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
# in scripts/kconfig to make the *config target
@@ -561,7 +561,7 @@ config: scripts_basic outputmakefile FORCE
%config: scripts_basic outputmakefile FORCE
$(Q)$(MAKE) $(build)=scripts/kconfig $@
-else
+else #!config-build
# ===========================================================================
# Build targets only - this includes vmlinux, arch specific targets, clean
# targets and others. In general all targets except *config targets.
@@ -604,7 +604,7 @@ endif
export KBUILD_MODULES KBUILD_BUILTIN
-ifeq ($(dot-config),1)
+ifdef need-config
include include/config/auto.conf
endif
@@ -652,8 +652,8 @@ ARCH_AFLAGS :=
ARCH_CFLAGS :=
include arch/$(SRCARCH)/Makefile
-ifeq ($(dot-config),1)
-ifeq ($(may-sync-config),1)
+ifdef need-config
+ifdef may-sync-config
# Read in dependencies to all Kconfig* files, make sure to run syncconfig if
# changes are detected. This should be included after arch/$(SRCARCH)/Makefile
# because some architectures define CROSS_COMPILE there.
@@ -676,7 +676,7 @@ $(KCONFIG_CONFIG):
# The syncconfig should be executed only once to make all the targets.
%/auto.conf %/auto.conf.cmd %/tristate.conf: $(KCONFIG_CONFIG)
$(Q)$(MAKE) -f $(srctree)/Makefile syncconfig
-else
+else # !may-sync-config
# 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.
# Use auto.conf to trigger the test
@@ -692,7 +692,7 @@ include/config/auto.conf:
/bin/false)
endif # may-sync-config
-endif # $(dot-config)
+endif # need-config
KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,)
KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,)
@@ -1809,9 +1809,9 @@ existing-targets := $(wildcard $(sort $(targets)))
-include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
-endif # ifeq ($(config-targets),1)
-endif # ifeq ($(mixed-targets),1)
-endif # need-sub-make
+endif # config-targets
+endif # mixed-build
+endif # need-sub-make
PHONY += FORCE
FORCE:
--
2.17.1
next prev parent reply other threads:[~2019-08-10 15:54 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-10 15:52 [PATCH 00/11] kbuild: clean-ups and improvement of single targets Masahiro Yamada
2019-08-10 15:52 ` [PATCH 01/11] kbuild: move the Module.symvers check for external module build Masahiro Yamada
2019-08-10 15:52 ` [PATCH 02/11] kbuild: refactor part-of-module more Masahiro Yamada
2019-08-10 15:52 ` [PATCH 03/11] kbuild: fix modkern_aflags implementation Masahiro Yamada
2019-08-10 15:53 ` [PATCH 04/11] kbuild: remove 'make /' support Masahiro Yamada
2019-08-10 15:53 ` [PATCH 05/11] kbuild: remove meaningless 'targets' in ./Kbuild Masahiro Yamada
2019-08-10 15:53 ` [PATCH 06/11] kbuild: do not descend to ./Kbuild when cleaning Masahiro Yamada
2019-08-10 15:53 ` Masahiro Yamada [this message]
2019-08-10 15:53 ` [PATCH 08/11] kbuild: unify vmlinux-dirs and module-dirs rules Masahiro Yamada
2019-08-10 15:53 ` [PATCH 09/11] kbuild: unify clean-dirs rule for in-kernel and external module Masahiro Yamada
2019-08-10 15:53 ` [PATCH 10/11] kbuild: make single targets work more correctly Masahiro Yamada
2019-08-10 15:53 ` [PATCH 11/11] treewide: remove dummy Makefiles for single targets Masahiro Yamada
2019-08-11 9:55 ` Leon Romanovsky
2019-08-19 14:52 ` [PATCH 00/11] kbuild: clean-ups and improvement of " Masahiro Yamada
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190810155307.29322-8-yamada.masahiro@socionext.com \
--to=yamada.masahiro@socionext.com \
--cc=hch@lst.de \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.lkml@markovi.net \
--cc=sam@ravnborg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.