- sub src2dep {
- my %args = @_;
- my $dep = $args{obj};
- my $deps = join(", -\n\t\t", @{$args{srcs}}, @{$args{deps}});
-
- # Because VMS C isn't very good at combining a /INCLUDE path with
- # #includes having a relative directory (like '#include "../foo.h"),
- # the best choice is to move to the first source file's intended
- # directory before compiling, and make sure to write the object file
- # in the correct position (important when the object tree is other
- # than the source tree).
- my $forward = dirname($args{srcs}->[0]);
- my $backward = abs2rel(rel2abs("."), rel2abs($forward));
- my $depd = abs2rel(rel2abs(dirname($dep)), rel2abs($forward));
- my $depn = basename($dep);
- my $srcs =
- join(", ",
- map { abs2rel(rel2abs($_), rel2abs($forward)) } @{$args{srcs}});
- my $incs =
- "/INCLUDE=(".join(",",
- map {
- file_name_is_absolute($_)
- ? $_ : catdir($backward,$_)
- } @{$args{incs}}).")";
- my $before = $unified_info{before}->{$dep.".OBJ"} || "\@ !";
- my $after = $unified_info{after}->{$dep.".OBJ"} || "\@ !";
-
- return <<"EOF";
-$dep.MMS : $deps
- ${before}
- SET DEFAULT $forward
- \$(CC) \$(CFLAGS)${incs} /MMS=(TARGET=.OBJ)/OBJECT=${depd}${depn}.MMS $srcs
- SET DEFAULT $backward
- ${after}
- - PURGE $dep.MMS
-EOF
- }