From 3a9976bfcd13e6554a2458ce1a3b9d7b95043195 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 13 Oct 2017 18:21:47 +0200 Subject: build: Honor make's '-j' flag. * build-aux/compile-all.scm (parallel-job-count): New procedure. : Pass it to 'compile-files' as #:workers. --- build-aux/compile-all.scm | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'build-aux/compile-all.scm') diff --git a/build-aux/compile-all.scm b/build-aux/compile-all.scm index 2fc3102daa..c7ca5a6f67 100644 --- a/build-aux/compile-all.scm +++ b/build-aux/compile-all.scm @@ -19,6 +19,7 @@ (use-modules (ice-9 match) (ice-9 threads) + (srfi srfi-1) (guix build compile) (guix build utils)) @@ -44,6 +45,39 @@ (or (not (file-exists? go)) (file-mtimenumber 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 +88,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 -- cgit v1.2.3