From patchwork Thu Jun 14 15:02:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Lynch X-Patchwork-Id: 164953 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id B4D71B7052 for ; Fri, 15 Jun 2012 01:03:29 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 7507132015; Thu, 14 Jun 2012 15:03:28 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HPzWPlCahIPR; Thu, 14 Jun 2012 15:03:24 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 7F5A13201C; Thu, 14 Jun 2012 15:03:23 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id AB9038F753 for ; Thu, 14 Jun 2012 15:03:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 96C748D2F2 for ; Thu, 14 Jun 2012 15:03:21 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uxRNS7cD91ZZ for ; Thu, 14 Jun 2012 15:03:14 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sasl.smtp.pobox.com (a-pb-sasl-sd.pobox.com [74.115.168.62]) by whitealder.osuosl.org (Postfix) with ESMTP id 9F3498D4A3 for ; Thu, 14 Jun 2012 15:02:48 +0000 (UTC) Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by b-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 71784CF39 for ; Thu, 14 Jun 2012 11:02:47 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to :subject:date:message-id:in-reply-to:references; s=sasl; bh=1olF jg6j/rcMLQE0rlDWM/L8Gz4=; b=pBZirpwjjc88zcj4pU6p4ZVcmjKN2u64z365 OsKnE10QuG6giqiu9Fwqk4rJG4FTBuXDM30ua8wpAz7YidSDLQHoImqXQTLV/6bk qIvQNmC6Gy/pkRbTiBZCqlFfJwEeWfHaG7QUFbW40aB0ez01uOi1DkAnOwjF1gqT xkbEOkg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:subject :date:message-id:in-reply-to:references; q=dns; s=sasl; b=KKdeA8 VqL43B6ZGFWIOjJzEBqwyKbKygdOOzUE8DkwigLpVVoYEYiddyBu35spWTuUt6Ws P1QrCpdmg1COjIjVYIxXUDy9Ay3qgwxOATiVWk+l/j2D+AyjZySD98Vw+uIKGj8r EJRgAZzQ7Fwi8J6bLzGGauuDKTpV0wDUFE4T4= Received: from b-pb-sasl-sd. (unknown [127.0.0.1]) by b-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 60B27CF38 for ; Thu, 14 Jun 2012 11:02:47 -0400 (EDT) Received: from orca.stoopid.dyndns.org (unknown [99.12.192.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by b-pb-sasl-sd.pobox.com (Postfix) with ESMTPSA id CF99FCF37 for ; Thu, 14 Jun 2012 11:02:46 -0400 (EDT) From: Nathan Lynch To: buildroot@busybox.net Date: Thu, 14 Jun 2012 10:02:45 -0500 Message-Id: <1339686165-10145-1-git-send-email-ntl@pobox.com> X-Mailer: git-send-email 1.7.10.2 In-Reply-To: <1339466983-19786-8-git-send-email-ntl@pobox.com> References: <1339466983-19786-8-git-send-email-ntl@pobox.com> X-Pobox-Relay-ID: 006919B6-B632-11E1-88D5-FA6787E41631-04752483!b-pb-sasl-sd.pobox.com Subject: [Buildroot] [PATCHv2 7/7] automatically set PARALLEL_JOBS when BR2_JLEVEL is 0 X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net When BR2_JLEVEL is 0, set PARALLEL_JOBS to double the number of CPUs detected. This allows one to more or less fully utilize the host system without manually tuning the configuration. Also make 0 the default value for BR2_JLEVEL. Signed-off-by: Nathan Lynch --- v2: Updated to use double number of detected CPUs per Arnout and Peter. Config.in | 8 +++++--- package/Makefile.in | 5 +++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Config.in b/Config.in index 95c2e8c..3745255 100644 --- a/Config.in +++ b/Config.in @@ -178,10 +178,12 @@ config BR2_DEBIAN_MIRROR endmenu config BR2_JLEVEL - int "Number of jobs to run simultaneously" - default "2" + int "Number of jobs to run simultaneously (0 for auto)" + default "0" help - Number of jobs to run simultaneously + Number of jobs to run simultaneously. If 0, determine + automatically according to number of CPUs on the host + system. config BR2_CCACHE bool "Enable compiler cache" diff --git a/package/Makefile.in b/package/Makefile.in index 9177a1b..95e0ae6 100644 --- a/package/Makefile.in +++ b/package/Makefile.in @@ -6,7 +6,12 @@ HOSTMAKE=$(MAKE) endif HOSTMAKE :=$(shell which $(HOSTMAKE) || type -p $(HOSTMAKE) || echo make) +ifeq ($(BR2_JLEVEL),0) +PARALLEL_JOBS:=$(shell echo \ + $$((2 * `getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1`))) +else PARALLEL_JOBS:=$(BR2_JLEVEL) +endif MAKE1:=$(HOSTMAKE) -j1 MAKE:=$(HOSTMAKE) -j$(PARALLEL_JOBS)