backports.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] backports: significantly speed up build
@ 2019-12-03 16:15 Johannes Berg
  2019-12-03 16:28 ` Johannes Berg
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Berg @ 2019-12-03 16:15 UTC (permalink / raw)
  To: backports; +Cc: Johannes Berg

From: Johannes Berg <johannes.berg@intel.com>

When building with /bin/sh -> bash, things are SUPER slow (at least
for me), because bash takes a LOOONG time to look at the environment
variables (and we typically have around 6k), adding over a second to
each bash invocation for me.

The reason we export them is that we need them in all of the sub-
makes, and those only read auto.conf, which we can't change.

Work around this by overriding 'make' itself, and using --eval to
read *our* .config file into each make that gets called. This way,
the variables are present in all make invocations in the same way
as they would be through the environment, but don't get passed to
shell invocations.

If --eval is not supported, keep doing what we did before.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 backport/Makefile.build | 7 +++++++
 backport/scripts/make   | 4 ++++
 2 files changed, 11 insertions(+)
 create mode 100755 backport/scripts/make

diff --git a/backport/Makefile.build b/backport/Makefile.build
index a848b37ed64b..9c272b2ddf62 100644
--- a/backport/Makefile.build
+++ b/backport/Makefile.build
@@ -1,4 +1,11 @@
+# detect if make supports --eval
+_EVAL := $(shell make --eval "test:" -f /dev/null test >/dev/null 2>&1 && echo YES || echo NO)
+ifeq ($(_EVAL),YES)
+MAKE=$(BACKPORT_DIR)/scripts/make
+else
 -include .config
+endif
+
 export
 
 .PHONY: modules
diff --git a/backport/scripts/make b/backport/scripts/make
new file mode 100755
index 000000000000..cff7d0031478
--- /dev/null
+++ b/backport/scripts/make
@@ -0,0 +1,4 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+exec make --eval '-include $(BACKPORT_DIR)/.config' "$@"
-- 
2.23.0

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] backports: significantly speed up build
  2019-12-03 16:15 [PATCH v2] backports: significantly speed up build Johannes Berg
@ 2019-12-03 16:28 ` Johannes Berg
  2019-12-23 18:51   ` Hauke Mehrtens
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Berg @ 2019-12-03 16:28 UTC (permalink / raw)
  To: backports

On Tue, 2019-12-03 at 17:15 +0100, Johannes Berg wrote:
> 
> If --eval is not supported, keep doing what we did before.

It's a bit disconcerting that we have systems that run make 3.81 or
older, but apparently that's what happened?! That was released over 9
years ago, and --eval was added to the code base 10 years ago ...

johannes

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] backports: significantly speed up build
  2019-12-03 16:28 ` Johannes Berg
@ 2019-12-23 18:51   ` Hauke Mehrtens
  2019-12-23 19:16     ` Johannes Berg
  0 siblings, 1 reply; 4+ messages in thread
From: Hauke Mehrtens @ 2019-12-23 18:51 UTC (permalink / raw)
  To: Johannes Berg; +Cc: backports

On 12/3/19 5:28 PM, Johannes Berg wrote:
> On Tue, 2019-12-03 at 17:15 +0100, Johannes Berg wrote:
>>
>> If --eval is not supported, keep doing what we did before.
> 
> It's a bit disconcerting that we have systems that run make 3.81 or
> older, but apparently that's what happened?! That was released over 9
> years ago, and --eval was added to the code base 10 years ago ...
> 
> johannes

Hi Johannes,

This looks good, but I am not an bash expert.

Even RedHat 7.7 uses make 3.82, so I do not care about older versions
any more.

Hauke
--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] backports: significantly speed up build
  2019-12-23 18:51   ` Hauke Mehrtens
@ 2019-12-23 19:16     ` Johannes Berg
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Berg @ 2019-12-23 19:16 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: backports

On Mon, 2019-12-23 at 19:51 +0100, Hauke Mehrtens wrote:
> On 12/3/19 5:28 PM, Johannes Berg wrote:
> > On Tue, 2019-12-03 at 17:15 +0100, Johannes Berg wrote:
> > > If --eval is not supported, keep doing what we did before.
> > 
> > It's a bit disconcerting that we have systems that run make 3.81 or
> > older, but apparently that's what happened?! That was released over 9
> > years ago, and --eval was added to the code base 10 years ago ...
> > 
> > johannes

> This looks good, but I am not an bash expert.

Neither am I! I just noticed the speed problem :-)

Really though, this change isn't much related to bash, right? It just
passes the variables to the sub-make in a different way.

> Even RedHat 7.7 uses make 3.82, so I do not care about older versions
> any more.

Cool. We had some older ones around in our infrastructure ... working to
get rid of them :)

johannes

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-12-23 19:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-03 16:15 [PATCH v2] backports: significantly speed up build Johannes Berg
2019-12-03 16:28 ` Johannes Berg
2019-12-23 18:51   ` Hauke Mehrtens
2019-12-23 19:16     ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).