[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <2bd8fdf9c54d336f5c47383b545c79e64c794c0a.1595822871.git.tommyhebb@gmail.com>
Date: Sun, 26 Jul 2020 21:08:15 -0700
From: Thomas Hebb <tommyhebb@...il.com>
To: linux-kernel@...r.kernel.org
Cc: Thomas Hebb <tommyhebb@...il.com>
Subject: [PATCH 2/3] tools lib api: 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/api/Makefile | 4 ----
1 file changed, 4 deletions(-)
diff --git a/tools/lib/api/Makefile b/tools/lib/api/Makefile
index a13e9c7f1fc5..5f2e3f8acbd0 100644
--- a/tools/lib/api/Makefile
+++ b/tools/lib/api/Makefile
@@ -9,10 +9,6 @@ srctree := $(patsubst %/,%,$(dir $(srctree)))
#$(info Determined 'srctree' to be $(srctree))
endif
-CC ?= $(CROSS_COMPILE)gcc
-AR ?= $(CROSS_COMPILE)ar
-LD ?= $(CROSS_COMPILE)ld
-
MAKEFLAGS += --no-print-directory
LIBFILE = $(OUTPUT)libapi.a
--
2.27.0
Powered by blists - more mailing lists