[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1f8ccfa329a210e2d58608b62c7f731de9fa60c2.1595822871.git.tommyhebb@gmail.com>
Date: Sun, 26 Jul 2020 21:08:16 -0700
From: Thomas Hebb <tommyhebb@...il.com>
To: linux-kernel@...r.kernel.org
Cc: Thomas Hebb <tommyhebb@...il.com>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
Ian Rogers <irogers@...gle.com>,
James Clark <James.Clark@....com>
Subject: [PATCH 3/3] libsubcmd: Get rid of useless conditional assignments
Conditional assignment does not work properly for variables that Make
implicitly sets, among which are CC and AR. To quote
tools/scripts/Makefile.include, which handles this properly:
# Makefiles suck: This macro sets a default value of $(2) for the
# variable named by $(1), unless the variable has been set by
# environment or command line. This is necessary for CC and AR
# because make sets default values, so the simpler ?= approach
# won't work as expected.
In other words, the conditional assignments will not run even if the
variables are not overridden in the environment; Make will set CC and AR
to default values when it starts[1], meaning they're not empty by the
time the conditional assignments are evaluated.
Since the assignments never run, we can just get rid of them. CC and AR
are already set properly by Makefile.include using the macro mentioned
in the quote above. In addition, we can get rid of the LD assignment,
because it's also set by Makefile.include.
[1] https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html
Signed-off-by: Thomas Hebb <tommyhebb@...il.com>
---
tools/lib/subcmd/Makefile | 4 ----
1 file changed, 4 deletions(-)
diff --git a/tools/lib/subcmd/Makefile b/tools/lib/subcmd/Makefile
index 1c777a72bb39..5f2058a6a1ce 100644
--- a/tools/lib/subcmd/Makefile
+++ b/tools/lib/subcmd/Makefile
@@ -9,10 +9,6 @@ srctree := $(patsubst %/,%,$(dir $(srctree)))
#$(info Determined 'srctree' to be $(srctree))
endif
-CC ?= $(CROSS_COMPILE)gcc
-LD ?= $(CROSS_COMPILE)ld
-AR ?= $(CROSS_COMPILE)ar
-
RM = rm -f
MAKEFLAGS += --no-print-directory
--
2.27.0
Powered by blists - more mailing lists