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.
7 # The initial file is assumed to be in Unix notation.
9 %def_hints = ('object-ending' => '.o',
10 'path-separator' => '/',
11 'continuation' => "\\");
13 sub do_transform
($$) {
16 $l =~ s/\x01/$$h{'object-ending'}/g;
17 $l =~ s/\x02/$$h{'path-separator'}/g;
18 $l =~ s/\x03/$$h{'continuation'}/g;
26 $first_file = $ARGV[0];
27 die unless (defined($first_file));
29 foreach $file (@ARGV) {
30 open(FILE
, "< $file\0") or die;
32 # First, read the syntax hints
34 while (defined($line = <FILE
>)) {
35 if ($line =~ /^\#\s+\@(\S+)\:\s*\"([^\"]+)\"/) {
40 # Read and process the file
44 while (defined($line = <FILE
>)) {
47 if ($line eq '#--- End File Lists ---#') {
48 push(@lines, $line."\n");
52 my $oe = "\Q$hints{'object-ending'}";
53 my $ps = "\Q$hints{'path-separator'}";
54 my $cn = "\Q$hints{'continuation'}";
56 $xl =~ s/${oe}(\s|$)/\x01$1/g;
57 $xl =~ s/${ps}/\x02/g;
58 $xl =~ s/${cn}$/\x03/;
59 push(@file_list, $xl);
63 push(@lines, $line."\n");
64 if ($line eq '#--- Begin File Lists ---#') {
67 push(@lines, "# Edit in $first_file, not here!\n");
68 foreach $l (@file_list) {
69 push(@lines, do_transform
($l, \
%hints)."\n");
77 # Write the file back out
79 open(FILE
, "> $file\0") or die;