Commit 0941edb0 authored by simonm's avatar simonm
Browse files

[project @ 1998-10-08 15:11:10 by simonm]

add -s option for extra obj suffixes, like mkdependHS
parent 078694f1
...@@ -15,11 +15,12 @@ $Dashdashes_seen = 0; ...@@ -15,11 +15,12 @@ $Dashdashes_seen = 0;
$Begin_magic_str = "# DO NOT DELETE: Beginning of C dependencies\n"; $Begin_magic_str = "# DO NOT DELETE: Beginning of C dependencies\n";
$End_magic_str = "# DO NOT DELETE: End of C dependencies\n"; $End_magic_str = "# DO NOT DELETE: End of C dependencies\n";
$Obj_suffix = '.o'; $Obj_suffix = 'o';
@Defines = (); @Defines = ();
$Include_dirs = ''; $Include_dirs = '';
$Makefile = ''; $Makefile = '';
@Src_files = (); @Src_files = ();
@File_suffix = ();
if ( $ENV{'TMPDIR'} ) { # where to make tmp file names if ( $ENV{'TMPDIR'} ) { # where to make tmp file names
$Tmp_prefix = $ENV{'TMPDIR'} . "/mkdependC$$"; $Tmp_prefix = $ENV{'TMPDIR'} . "/mkdependC$$";
...@@ -60,7 +61,7 @@ foreach $sf (@Src_files) { ...@@ -60,7 +61,7 @@ foreach $sf (@Src_files) {
# a de-commenter (not implemented); # a de-commenter (not implemented);
# builds up @Depend_lines # builds up @Depend_lines
print STDERR "Here we go for source file: $sf\n" if $Verbose; print STDERR "Here we go for source file: $sf\n" if $Verbose;
($of = $sf) =~ s/\.(c|hc)$/$Obj_suffix/; ($bf = $sf) =~ s/\.(c|hc)$//;
&slurp_file($sf, 'fh00'); &slurp_file($sf, 'fh00');
} }
...@@ -111,6 +112,9 @@ sub mangle_command_line_args { ...@@ -111,6 +112,9 @@ sub mangle_command_line_args {
$Makefile = &grab_arg_arg($_); $Makefile = &grab_arg_arg($_);
} elsif ( /^-o/ ) { } elsif ( /^-o/ ) {
$Obj_suffix = &grab_arg_arg($_); $Obj_suffix = &grab_arg_arg($_);
} elsif ( /^-s/ ) {
local($suff) = &grab_arg_arg($_);
push(@File_suffix, $suff);
} elsif ( /^-bs/ ) { } elsif ( /^-bs/ ) {
$Begin_magic_str = &grab_arg_arg($_) . "\n"; $Begin_magic_str = &grab_arg_arg($_) . "\n";
} elsif ( /^-es/ ) { } elsif ( /^-es/ ) {
...@@ -178,30 +182,33 @@ sub slurp_file { # follows an example in the `open' item in perl man page ...@@ -178,30 +182,33 @@ sub slurp_file { # follows an example in the `open' item in perl man page
# don't bother w/ dependencies on /usr/include stuff # don't bother w/ dependencies on /usr/include stuff
# don't bother if it looks like a GCC built-in hdr file # don't bother if it looks like a GCC built-in hdr file
# don't bother with funny yacc-ish files # don't bother with funny yacc-ish files
# don't bother with "literate" .h files (.lh); we'll just
# depend on the de-litified versions (which have better info)
# don't let a file depend on itself # don't let a file depend on itself
next line if /^\/usr\/include/; next line if /^\/usr\/include/;
# Hack - the cygwin32 dir structure is odd! # Hack - the cygwin32 dir structupre is odd!
next line if /H-i386-cygwin32\/i386-cygwin32/; next line if /H-i386-cygwin32\/i386-cygwin32/;
next line if /H-i386-cygwin32\/lib\/gcc-lib\/i386-cygwin32/; next line if /H-i386-cygwin32\/lib\/gcc-lib\/i386-cygwin32/;
next line if /\/gcc-lib\/[^\/\n]+\/[\.0-9]+\/include\//; next line if /\/gcc-lib\/[^\/\n]+\/[\.0-9]+\/include\//;
next line if /\/gnu\/[^-\/]+-[^-\/]+-[^-\/]+\/include\//; next line if /\/gnu\/[^-\/]+-[^-\/]+-[^-\/]+\/include\//;
next line if /\/yaccpar/; next line if /\/yaccpar/;
next line if /\/bison\.(simple|hairy)/; next line if /\/bison\.(simple|hairy)/;
next line if /\.lh$/;
next line if $_ eq $fname; next line if $_ eq $fname;
print STDERR "$fname :: $_\n" if $Verbose; print STDERR "$fname :: $_\n" if $Verbose;
# ToDo: some sanity checks that we still have something reasonable? # ToDo: some sanity checks that we still have something reasonable?
$depend = "$of : $_\n"; $int_file = $_;
next line if $Depend_seen{$depend}; # already seen this one... $depend = "$bf.$Obj_suffix ";
foreach $suff (@File_suffix) {
$depend .= "$bf.${suff}_$Obj_suffix ";
}
$depend .= " : $int_file\n";
next line if $Depend_seen{$depend}; # already seen this one...
# OK, it's a new one. # OK, it's a new one.
push (@Depend_lines, $depend);
$Depend_seen{$depend} = 1; $Depend_seen{$depend} = 1;
push (@Depend_lines, $depend);
} }
close($fhandle); close($fhandle);
unlink($tempfile); unlink($tempfile);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment