Wed Oct 20 09:18:05 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl>
[MPC.git] / modules / Depgen / MakeDependencyWriter.pm
bloba10d061996b6580e4baa50963faa78ea8dd8ccb3
1 package MakeDependencyWriter;
3 # ************************************************************
4 # Description : Generates generic Makefile dependencies.
5 # Author : Chad Elliott
6 # Create Date : 2/10/2002
7 # ************************************************************
9 # ************************************************************
10 # Pragmas
11 # ************************************************************
13 use strict;
14 use DependencyWriter;
16 use vars qw(@ISA);
17 @ISA = qw(DependencyWriter);
19 # ************************************************************
20 # Data Section
21 # ************************************************************
23 my $cygwin = (defined $ENV{OS} && $ENV{OS} =~ /windows/i);
25 # ************************************************************
26 # Subroutine Section
27 # ************************************************************
29 sub process {
30 ## Replace whitespace with escaped whitespace.
31 map(s/(\s)/\\$1/g, @{$_[2]});
33 ## Replace <drive letter>: with /cygdrive/<drive letter>. The user may
34 ## or may not be using Cygwin, but leaving the colon in there will
35 ## cause make to fail catastrophically on the next invocation.
36 map(s/([A-Z]):/\/cygdrive\/$1/gi, @{$_[2]}) if ($cygwin);
38 ## Sort the dependencies to make them reproducible.
39 return "@{$_[1]}: \\\n " . join(" \\\n ", sort @{$_[2]}) . "\n";