3 # Sync the output file list between Makefiles
4 # Use the mkdep.pl parameters to get the filename syntax
6 # The first file is the source file; the other ones target.
17 sub do_transform
($\
%) {
19 my($ps) = $$h{'path-separator'};
21 $l =~ s/\x01/$$h{'object-ending'}/g;
22 $l =~ s/\x03/$$h{'continuation'}/g;
25 # Remove the path separator and the preceeding directory
26 $l =~ s/[^\s\=]*\x02//g;
28 # Convert the path separator
39 my $first_file = $ARGV[0];
40 die unless (defined($first_file));
42 for my $filename (@ARGV) {
43 open( FILE
, '<', $filename ) or die;
45 # First, read the syntax hints
46 my %hints = %def_hints;
47 while( my $line = <FILE
> ){
48 if ( $line =~ /^\s*\#\s*@([a-z0-9-]+):\s*\"([^\"]*)\"/ ) {
53 # Read and process the file
57 while( my $line = <FILE
> ){
60 if ($line eq '#-- End File Lists --#') {
61 push(@lines, $line."\n");
65 my $oe = "\Q$hints{'object-ending'}";
66 my $ps = "\Q$hints{'path-separator'}";
67 my $cn = "\Q$hints{'continuation'}";
69 $xl =~ s/${oe}(\s|$)/\x01$1/g;
70 $xl =~ s/${ps}/\x02/g;
71 $xl =~ s/${cn}$/\x03/;
72 push(@file_list, $xl);
76 push(@lines, $line."\n");
77 if ($line eq '#-- Begin File Lists --#') {
80 push(@lines, "# Edit in $first_file, not here!\n");
81 for my $l (@file_list) {
82 push(@lines, do_transform
($l, %hints)."\n");
90 # Write the file back out
92 open( FILE
, '>', $filename ) or die;