[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#27284: [PATCH 2/8] build: Honor make's '-j' flag.
From: |
Ludovic Courtès |
Subject: |
bug#27284: [PATCH 2/8] build: Honor make's '-j' flag. |
Date: |
Fri, 20 Oct 2017 18:05:51 +0200 |
* build-aux/compile-all.scm (parallel-job-count): New procedure.
<top level>: Pass it to 'compile-files' as #:workers.
---
build-aux/compile-all.scm | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/build-aux/compile-all.scm b/build-aux/compile-all.scm
index 2fc3102da..4aa4ac9b9 100644
--- a/build-aux/compile-all.scm
+++ b/build-aux/compile-all.scm
@@ -44,6 +44,31 @@
(or (not (file-exists? go))
(file-mtime<? go file))))
+(define* (parallel-job-count #:optional (flags (getenv "MAKEFLAGS")))
+ "Return the number of parallel jobs as determined by FLAGS, the flags passed
+to 'make'."
+ (match flags
+ (#f (current-processor-count))
+ (flags
+ (let loop ((flags (string-tokenize flags)))
+ (match flags
+ (()
+ 1)
+ (("-j" (= string->number count) _ ...)
+ (if (integer? count)
+ count
+ (current-processor-count)))
+ ((head tail ...)
+ (if (string-prefix? "-j" head)
+ (match (string-drop head 2)
+ (""
+ (current-processor-count))
+ ((= string->number count)
+ (if (integer? count)
+ count
+ (current-processor-count))))
+ (loop tail))))))))
+
;; Install a SIGINT handler to give unwind handlers in 'compile-file' an
;; opportunity to run upon SIGINT and to remove temporary output files.
(sigaction SIGINT
@@ -54,6 +79,7 @@
((_ . files)
(compile-files srcdir (getcwd)
(filter file-needs-compilation? files)
+ #:workers (parallel-job-count)
#:host host
#:report-load (lambda (file total completed)
(when file
--
2.14.2
- bug#27284: [PATCH 0/8] 'guix pull' creates several derivations, Ludovic Courtès, 2017/10/20
- bug#27284: [PATCH 3/8] discovery: Move 'file-name->module-name' to (guix modules)., Ludovic Courtès, 2017/10/20
- bug#27284: [PATCH 2/8] build: Honor make's '-j' flag.,
Ludovic Courtès <=
- bug#27284: [PATCH 4/8] gexp: Add 'file-union'., Ludovic Courtès, 2017/10/20
- bug#27284: [PATCH 7/8] gexp: 'directory-union' has a #:quiet? parameter., Ludovic Courtès, 2017/10/20
- bug#27284: [PATCH 1/8] build: Factorize module compilation in (guix build compile)., Ludovic Courtès, 2017/10/20
- bug#27284: [PATCH 1/8] build: Factorize module compilation in (guix build compile)., Maxim Cournoyer, 2017/10/22
- bug#27284: [PATCH 1/8] build: Factorize module compilation in (guix build compile)., Ludovic Courtès, 2017/10/22
- bug#27284: [PATCH 1/8] build: Factorize module compilation in (guix build compile)., Eric Bavier, 2017/10/22
- bug#27284: [PATCH 1/8] build: Factorize module compilation in (guix build compile)., Ludovic Courtès, 2017/10/22
- bug#27284: [PATCH 1/8] build: Factorize module compilation in (guix build compile)., Eric Bavier, 2017/10/22
- bug#27284: [PATCH 1/8] build: Factorize module compilation in (guix build compile)., Ludovic Courtès, 2017/10/23
bug#27284: [PATCH 5/8] gexp: Add 'directory-union'., Ludovic Courtès, 2017/10/20