summaryrefslogtreecommitdiff
path: root/ACE/MPC/modules/Depgen/NMakeDependencyWriter.pm
blob: 0428a55c1763c3102aece3447627b8c1d7d90082 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package NMakeDependencyWriter;

# ************************************************************
# Description   : Generates NMake dependencies.
# Author        : Chad Elliott
# Create Date   : 2/10/2002
# ************************************************************

# ************************************************************
# Pragmas
# ************************************************************

use strict;
use DependencyWriter;

use vars qw(@ISA);
@ISA = qw(DependencyWriter);

# ************************************************************
# Subroutine Section
# ************************************************************

sub process {
  my $sources = $_[1];
  my $files   = $_[2];
  my $total   = 0;

  $$sources[0] =~ s/\//\\/g;
  $$sources[0] =~ s/\\\\/\\/g;
  my $dep = "$$sources[0] :\\\n";

  ## Sort the dependencies to make them reproducible
  foreach my $file (sort @$files) {
    $file =~ s/\//\\/g;
    $file =~ s/\\\\/\\/g;
    if ($file ne $$sources[0]) {
      $dep .= "\t\"$file\"\\\n";
      ++$total;
    }
  }

  if ($total == 0) {
    $dep = '';
  }
  else {
    $dep .= "\n\n";
  }

  return $dep;
}


1;