aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2019-06-17 12:58:02 +0200
committerBjörn Gustavsson <[email protected]>2019-06-17 12:58:02 +0200
commitd3f4351b6fc846f55fae221760da9b4c04560007 (patch)
treeadfd1e1fb4c19099fb42b20e69e708aff406b191
parentf3b8389911155e196f748b216b3ecc4cd3eb2db4 (diff)
parentf2ed968cfe1633190dcc8747c5559c9f864185c0 (diff)
downloadotp-d3f4351b6fc846f55fae221760da9b4c04560007.tar.gz
otp-d3f4351b6fc846f55fae221760da9b4c04560007.tar.bz2
otp-d3f4351b6fc846f55fae221760da9b4c04560007.zip
Merge branch 'maint'
* maint: cc.sh: Optimize dependency generation
-rw-r--r--erts/etc/win32/msys_tools/vc/cc.sh33
1 files changed, 22 insertions, 11 deletions
diff --git a/erts/etc/win32/msys_tools/vc/cc.sh b/erts/etc/win32/msys_tools/vc/cc.sh
index 2b0482e876..71af14b9b2 100644
--- a/erts/etc/win32/msys_tools/vc/cc.sh
+++ b/erts/etc/win32/msys_tools/vc/cc.sh
@@ -195,7 +195,6 @@ mkdir $TMPOBJDIR
# Compile
for x in $SOURCES; do
- start_time=`date '+%s'`
# Compile each source
if [ $LINKING = false ]; then
# We should have an output defined, which is a directory
@@ -260,16 +259,28 @@ for x in $SOURCES; do
else
tail -n +2 $ERR_FILE >&2
if test $DEPENDENCIES = true; then
- if test `grep -v $x $MSG_FILE | grep -c '#line'` != "0"; then
- o=`echo $x | sed 's,.*/,,' | sed 's,\.cp*$,.o,'`
- echo -n $o':'
-# cat $MSG_FILE | grep '#line' | grep -v $x | awk -F\" '{printf("%s\n",$2)}' | sort -u | grep -v " " | xargs -n 1 win2msys_path.sh | awk '{printf("\\\n %s ",$0)}'
- cat $MSG_FILE | grep '#line' | grep -v $x | awk -F\" '{printf("%s\n",$2)}' | sort -u | grep -v " " | sed 's,^\([A-Za-z]\):[\\/]*,/\1/,;s,\\\\*,/,g'| awk '{printf("\\\n %s ",$0)}'
- echo
- echo
- after_sed=`date '+%s'`
- echo Made dependencies for $x':' `expr $after_sed '-' $start_time` 's' >&2
- fi
+ perl -e '
+my $file = "'$x'";
+while (<>) {
+ next unless /^#line/;
+ next if /$file/o;
+ (undef,$_) = split(/\"/);
+ next if / /;
+ $all{$_} = 1;
+}
+foreach (sort keys %all) {
+ s@^([A-Za-z]):@/$1@;
+ s@\\\\@/@g;
+ push @f, "\\\n $_ ";
+}
+if (@f) {
+ my $oname = $file;
+ $oname =~ s@.*/@@;
+ $oname =~ s@[.]cp*@.o@;
+ print $oname, ":", @f;
+ print "\n\n";
+ print STDERR "Made dependencies for $file\n";
+}' $MSG_FILE
else
cat $MSG_FILE
fi