Avoid entering directories twice. Only write out .all.pp when it has changed.

git-svn-id: svn://10.0.0.236/trunk@31990 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
slamm%netscape.com 1999-05-18 00:26:10 +00:00
parent 454553725b
commit b5a694bcee
2 changed files with 26 additions and 9 deletions

View File

@ -26,6 +26,8 @@
#
# Send comments, improvements, bugs to Steve Lamm (slamm@netscape.com).
$outfile = shift @ARGV;
@alldeps=();
# Parse dependency files
while ($line = <>) {
@ -69,10 +71,27 @@ foreach $deps (@alldeps) {
$modtimes{$dep_file} = $dep_mtime;
}
if ($dep_mtime eq '' or $dep_mtime > $mtime) {
print "$obj ";
$haveObjects = 1;
push @objs, $obj;
last;
}
}
}
print ": FORCE\n" if $haveObjects;
# Output objects to rebuild (if needed).
if ($#objs > 0) {
$new_output = "@objs: FORCE\n";
# Read in the current dependencies file.
open(OLD, "<$outfile") and $old_output = <OLD>;
close(OLD);
# Only write out the dependencies if they are different.
if ($new_output ne $old_output) {
open(OUT, ">$outfile") and print OUT $new_output;
print "Updating dependencies ($outfile).\n";
}
} elsif (-s $outfile) {
# Remove the old dependencies because all objects are up to date.
unlink $outfile;
print "Removing old dependencies ($outfile).\n";
}

View File

@ -1044,19 +1044,17 @@ endif # ! COMPILER_DEPEND
# Yet another depend system: -MD
ifdef COMPILER_DEPEND
ifdef OBJS
MDDEPEND_FILES := $(foreach obj, $(OBJS), \
$(MDDEPDIR)/$(basename $(notdir $(obj))).pp)
MDDEPEND_FILES := $(wildcard $(MDDEPEND_FILES))
MDDEPEND_FILES := $(wildcard $(MDDEPDIR)/*.pp)
ifdef 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 missing header files. 'make' would complain that
# there is no way to build missing headers.
# 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.
$(MDDEPDIR)/.all.pp: FORCE
@$(PERL) $(topsrcdir)/config/mddepend.pl $(MDDEPEND_FILES) >$@
@$(PERL) $(topsrcdir)/config/mddepend.pl $@ $(MDDEPEND_FILES)
-include $(MDDEPDIR)/.all.pp
else
include $(MDDEPEND_FILES)