All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: backports@vger.kernel.org
Cc: Johannes Berg <johannes.berg@intel.com>
Subject: [PATCH v2] backports: significantly speed up build
Date: Tue,  3 Dec 2019 17:15:40 +0100	[thread overview]
Message-ID: <20191203161540.174109-1-johannes@sipsolutions.net> (raw)

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

             reply	other threads:[~2019-12-03 16:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-03 16:15 Johannes Berg [this message]
2019-12-03 16:28 ` [PATCH v2] backports: significantly speed up build Johannes Berg
2019-12-23 18:51   ` Hauke Mehrtens
2019-12-23 19:16     ` Johannes Berg

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=20191203161540.174109-1-johannes@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=backports@vger.kernel.org \
    --cc=johannes.berg@intel.com \
    /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.