[m-rev.] diff: make --rebuild work with non-parallel make

Peter Wang novalazy at gmail.com
Mon Sep 24 11:16:09 AEST 2007


Estimated hours taken: 0.5
Branches: main

compiler/make.util.m:
	Make --rebuild option work again in
	foldl2_maybe_stop_at_error_maybe_parallel, when parallel make is not
	used.  It was disabled for the sequential make pass, which is the only
	pass when parallel make is not enabled.

Index: compiler/make.util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make.util.m,v
retrieving revision 1.51
diff -u -r1.51 make.util.m
--- compiler/make.util.m	28 Aug 2007 05:32:33 -0000	1.51
+++ compiler/make.util.m	24 Sep 2007 01:02:16 -0000
@@ -407,9 +407,9 @@
 
 foldl2_maybe_stop_at_error_maybe_parallel(KeepGoing, MakeTarget, Targets,
         Success, !Info, !IO) :-
-    % First pass.
     globals.io_lookup_int_option(jobs, Jobs, !IO),
     ( Jobs > 1 ->
+        % First pass.
         % fork() is disabled on threaded grades.
         ( process_util.can_fork ->
             foldl2_maybe_stop_at_error_parallel_processes(KeepGoing, Jobs,
@@ -419,23 +419,24 @@
                 MakeTarget, Targets, Success0, !.Info, !IO)
         ;
             Success0 = yes
+        ),
+        % Second pass (sequential).
+        (
+            Success0 = yes,
+            % Disable the `--rebuild' option during the sequential pass
+            % otherwise all the targets will be built a second time.
+            globals.io_lookup_bool_option(rebuild, Rebuild, !IO),
+            globals.io_set_option(rebuild, bool(no), !IO),
+            foldl2_maybe_stop_at_error(KeepGoing, MakeTarget, Targets, Success,
+                !Info, !IO),
+            globals.io_set_option(rebuild, bool(Rebuild), !IO)
+        ;
+            Success0 = no,
+            Success = no
         )
     ;
-        Success0 = yes
-    ),
-    % Second pass (sequential).
-    (
-        Success0 = yes,
-        % Disable the `--rebuild' option during the sequential pass otherwise
-        % all the targets will be built a second time.
-        globals.io_lookup_bool_option(rebuild, Rebuild, !IO),
-        globals.io_set_option(rebuild, bool(no), !IO),
         foldl2_maybe_stop_at_error(KeepGoing, MakeTarget, Targets, Success,
-            !Info, !IO),
-        globals.io_set_option(rebuild, bool(Rebuild), !IO)
-    ;
-        Success0 = no,
-        Success = no
+            !Info, !IO)
     ).
 
 :- pred do_parallel_foldl2(bool::in, int::in,

--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list