Bug 524139 - Eval .all.pp instead of including it. This means that in the normal case we avoid any make restarts and the associated I/O that goes with them, which could possibly be slowing Windows builds down considerably r=ted
authorBenjamin Smedberg <benjamin@smedbergs.us>
Fri, 23 Oct 2009 13:00:19 -0400
changeset 34232 29d7c945849de259737e1ba2c5ff84056b149d3b
parent 34231 01f7f005522bcb55387aba21b953c6c99bdb5650
child 34233 15f4223cd977045852702c2d552ffc7e1fc0cbf4
push idunknown
push userunknown
push dateunknown
reviewersted
bugs524139
milestone1.9.3a1pre
Bug 524139 - Eval .all.pp instead of including it. This means that in the normal case we avoid any make restarts and the associated I/O that goes with them, which could possibly be slowing Windows builds down considerably r=ted
build/unix/mddepend.pl
config/rules.mk
js/src/build/unix/mddepend.pl
js/src/config/rules.mk
--- a/build/unix/mddepend.pl
+++ b/build/unix/mddepend.pl
@@ -68,77 +68,81 @@ while (<>) {
 
   my ($obj,$rest) = split /\s*:\s+/, $line, 2;
   $line = '';
   next if !$obj || !$rest;
 
   my @deps = split /\s+/, $rest;
   push @{$alldeps{$obj}}, @deps;
   if (DEBUG >= 2) {
-    foreach my $dep (@deps) { print "add $obj $dep\n"; }
+    foreach my $dep (@deps) { print STDERR "add $obj $dep\n"; }
   }
 }
 
 # Test dependencies
 my %modtimes; # cache
 my @objs;     # force rebuild on these
 OBJ_LOOP: foreach my $obj (keys %alldeps) {
   my $mtime = (stat $obj)[9] or next;
 
   my %not_in_cache;
   my $deps = $alldeps{$obj};
   foreach my $dep_file (@{$deps}) {
     my $dep_mtime = $modtimes{$dep_file};
     if (not defined $dep_mtime) {
-      print "Skipping $dep_file for $obj, will stat() later\n" if DEBUG >= 2;
+      print STDERR "Skipping $dep_file for $obj, will stat() later\n" if DEBUG >= 2;
       $not_in_cache{$dep_file} = 1;
       next;
     }
 
-    print "Found $dep_file in cache\n" if DEBUG >= 2;
+    print STDERR "Found $dep_file in cache\n" if DEBUG >= 2;
 
     if ($dep_mtime > $mtime) {
-      print "$dep_file($dep_mtime) newer than $obj($mtime)\n" if DEBUG;
+      print STDERR "$dep_file($dep_mtime) newer than $obj($mtime)\n" if DEBUG;
     }
     elsif ($dep_mtime == -1) {
-      print "Couldn't stat $dep_file for $obj\n" if DEBUG;
+      print STDERR "Couldn't stat $dep_file for $obj\n" if DEBUG;
     }
     else {
-      print "$dep_file($dep_mtime) older than $obj($mtime)\n" if DEBUG >= 2;
+      print STDERR "$dep_file($dep_mtime) older than $obj($mtime)\n" if DEBUG >= 2;
       next;
     }
 
     push @objs, $obj; # dependency is missing or newer
     next OBJ_LOOP; # skip checking the rest of the dependencies
   }
 
   foreach my $dep_file (keys %not_in_cache) {
-    print "STAT $dep_file for $obj\n" if DEBUG >= 2;
+    print STDERR "STAT $dep_file for $obj\n" if DEBUG >= 2;
     my $dep_mtime = $modtimes{$dep_file} = (stat $dep_file)[9] || -1;
 
     if ($dep_mtime > $mtime) {
-      print "$dep_file($dep_mtime) newer than $obj($mtime)\n" if DEBUG;
+      print STDERR "$dep_file($dep_mtime) newer than $obj($mtime)\n" if DEBUG;
     }
     elsif ($dep_mtime == -1) {
-      print "Couldn't stat $dep_file for $obj\n" if DEBUG;
+      print STDERR "Couldn't stat $dep_file for $obj\n" if DEBUG;
     }
     else {
-      print "$dep_file($dep_mtime) older than $obj($mtime)\n" if DEBUG >= 2;
+      print STDERR "$dep_file($dep_mtime) older than $obj($mtime)\n" if DEBUG >= 2;
       next;
     }
 
     push @objs, $obj; # dependency is missing or newer
     next OBJ_LOOP; # skip checking the rest of the dependencies
   }
 
   # If we get here it means nothing needs to be done for $obj
 }
 
 # Output objects to rebuild (if needed).
-if (@objs) {
+if ($outfile eq '-') {
+    if (@objs) {
+	print "@objs: FORCE\n";
+    }
+} elsif (@objs) {
   my $old_output;
   my $new_output = "@objs: FORCE\n";
 
   # Read in the current dependencies file.
   open(OLD, "<$outfile")
     and $old_output = <OLD>;
   close(OLD);
 
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -2063,31 +2063,24 @@ endif # COMPILER_DEPEND
 $(CURDIR)/$(MDDEPDIR):
 	@if test ! -d $@; then echo Creating $@; rm -rf $@; mkdir $@; else true; fi
 
 ifneq (,$(filter-out all chrome default export realchrome tools clean clobber clobber_all distclean realclean,$(MAKECMDGOALS)))
 ifneq (,$(OBJS)$(XPIDLSRCS)$(SIMPLE_PROGRAMS))
 MDDEPEND_FILES		:= $(strip $(wildcard $(MDDEPDIR)/*.pp))
 
 ifneq (,$(MDDEPEND_FILES))
-ifdef PERL
 # The script mddepend.pl checks the dependencies and writes to stdout
 # one rule to force out-of-date objects. For example,
 #   foo.o boo.o: FORCE
 # The script has an advantage over including the *.pp files directly
 # because it handles the case when header files are removed from the build.
 # 'make' would complain that there is no way to build missing headers.
-ifeq (,$(MAKE_RESTARTS))
-$(MDDEPDIR)/.all.pp: FORCE
-	@$(PERL) $(BUILD_TOOLS)/mddepend.pl $@ $(MDDEPEND_FILES)
-endif
--include $(MDDEPDIR)/.all.pp
-else
-include $(MDDEPEND_FILES)
-endif
+ALL_PP_RESULTS = $(shell $(PERL) $(BUILD_TOOLS)/mddepend.pl - $(MDDEPEND_FILES))
+$(eval $(ALL_PP_RESULTS))
 endif
 
 endif
 endif
 #############################################################################
 
 -include $(topsrcdir)/$(MOZ_BUILD_APP)/app-rules.mk
 -include $(MY_RULES)
--- a/js/src/build/unix/mddepend.pl
+++ b/js/src/build/unix/mddepend.pl
@@ -68,77 +68,81 @@ while (<>) {
 
   my ($obj,$rest) = split /\s*:\s+/, $line, 2;
   $line = '';
   next if !$obj || !$rest;
 
   my @deps = split /\s+/, $rest;
   push @{$alldeps{$obj}}, @deps;
   if (DEBUG >= 2) {
-    foreach my $dep (@deps) { print "add $obj $dep\n"; }
+    foreach my $dep (@deps) { print STDERR "add $obj $dep\n"; }
   }
 }
 
 # Test dependencies
 my %modtimes; # cache
 my @objs;     # force rebuild on these
 OBJ_LOOP: foreach my $obj (keys %alldeps) {
   my $mtime = (stat $obj)[9] or next;
 
   my %not_in_cache;
   my $deps = $alldeps{$obj};
   foreach my $dep_file (@{$deps}) {
     my $dep_mtime = $modtimes{$dep_file};
     if (not defined $dep_mtime) {
-      print "Skipping $dep_file for $obj, will stat() later\n" if DEBUG >= 2;
+      print STDERR "Skipping $dep_file for $obj, will stat() later\n" if DEBUG >= 2;
       $not_in_cache{$dep_file} = 1;
       next;
     }
 
-    print "Found $dep_file in cache\n" if DEBUG >= 2;
+    print STDERR "Found $dep_file in cache\n" if DEBUG >= 2;
 
     if ($dep_mtime > $mtime) {
-      print "$dep_file($dep_mtime) newer than $obj($mtime)\n" if DEBUG;
+      print STDERR "$dep_file($dep_mtime) newer than $obj($mtime)\n" if DEBUG;
     }
     elsif ($dep_mtime == -1) {
-      print "Couldn't stat $dep_file for $obj\n" if DEBUG;
+      print STDERR "Couldn't stat $dep_file for $obj\n" if DEBUG;
     }
     else {
-      print "$dep_file($dep_mtime) older than $obj($mtime)\n" if DEBUG >= 2;
+      print STDERR "$dep_file($dep_mtime) older than $obj($mtime)\n" if DEBUG >= 2;
       next;
     }
 
     push @objs, $obj; # dependency is missing or newer
     next OBJ_LOOP; # skip checking the rest of the dependencies
   }
 
   foreach my $dep_file (keys %not_in_cache) {
-    print "STAT $dep_file for $obj\n" if DEBUG >= 2;
+    print STDERR "STAT $dep_file for $obj\n" if DEBUG >= 2;
     my $dep_mtime = $modtimes{$dep_file} = (stat $dep_file)[9] || -1;
 
     if ($dep_mtime > $mtime) {
-      print "$dep_file($dep_mtime) newer than $obj($mtime)\n" if DEBUG;
+      print STDERR "$dep_file($dep_mtime) newer than $obj($mtime)\n" if DEBUG;
     }
     elsif ($dep_mtime == -1) {
-      print "Couldn't stat $dep_file for $obj\n" if DEBUG;
+      print STDERR "Couldn't stat $dep_file for $obj\n" if DEBUG;
     }
     else {
-      print "$dep_file($dep_mtime) older than $obj($mtime)\n" if DEBUG >= 2;
+      print STDERR "$dep_file($dep_mtime) older than $obj($mtime)\n" if DEBUG >= 2;
       next;
     }
 
     push @objs, $obj; # dependency is missing or newer
     next OBJ_LOOP; # skip checking the rest of the dependencies
   }
 
   # If we get here it means nothing needs to be done for $obj
 }
 
 # Output objects to rebuild (if needed).
-if (@objs) {
+if ($outfile eq '-') {
+    if (@objs) {
+	print "@objs: FORCE\n";
+    }
+} elsif (@objs) {
   my $old_output;
   my $new_output = "@objs: FORCE\n";
 
   # Read in the current dependencies file.
   open(OLD, "<$outfile")
     and $old_output = <OLD>;
   close(OLD);
 
--- a/js/src/config/rules.mk
+++ b/js/src/config/rules.mk
@@ -2063,31 +2063,24 @@ endif # COMPILER_DEPEND
 $(CURDIR)/$(MDDEPDIR):
 	@if test ! -d $@; then echo Creating $@; rm -rf $@; mkdir $@; else true; fi
 
 ifneq (,$(filter-out all chrome default export realchrome tools clean clobber clobber_all distclean realclean,$(MAKECMDGOALS)))
 ifneq (,$(OBJS)$(XPIDLSRCS)$(SIMPLE_PROGRAMS))
 MDDEPEND_FILES		:= $(strip $(wildcard $(MDDEPDIR)/*.pp))
 
 ifneq (,$(MDDEPEND_FILES))
-ifdef PERL
 # The script mddepend.pl checks the dependencies and writes to stdout
 # one rule to force out-of-date objects. For example,
 #   foo.o boo.o: FORCE
 # The script has an advantage over including the *.pp files directly
 # because it handles the case when header files are removed from the build.
 # 'make' would complain that there is no way to build missing headers.
-ifeq (,$(MAKE_RESTARTS))
-$(MDDEPDIR)/.all.pp: FORCE
-	@$(PERL) $(BUILD_TOOLS)/mddepend.pl $@ $(MDDEPEND_FILES)
-endif
--include $(MDDEPDIR)/.all.pp
-else
-include $(MDDEPEND_FILES)
-endif
+ALL_PP_RESULTS = $(shell $(PERL) $(BUILD_TOOLS)/mddepend.pl - $(MDDEPEND_FILES))
+$(eval $(ALL_PP_RESULTS))
 endif
 
 endif
 endif
 #############################################################################
 
 -include $(topsrcdir)/$(MOZ_BUILD_APP)/app-rules.mk
 -include $(MY_RULES)