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.
8 %def_hints = ('object-ending' => '.o',
9 'path-separator' => '/',
10 'continuation' => "\\");
12 sub do_transform
($$) {
15 $l =~ s/\x01/$$h{'object-ending'}/g;
16 $l =~ s/\x02/$$h{'path-separator'}/g;
17 $l =~ s/\x03/$$h{'continuation'}/g;
25 $first_file = $ARGV[0];
26 die unless (defined($first_file));
28 foreach $file (@ARGV) {
29 open(FILE
, "< $file\0") or die;
31 # First, read the syntax hints
33 while (defined($line = <FILE
>)) {
34 if ($line =~ /^\#\s+\@(\S+)\:\s*\"([^\"]+)\"/) {
39 # Read and process the file
43 while (defined($line = <FILE
>)) {
46 if ($line eq '#--- End File Lists ---#') {
47 push(@lines, $line."\n");
51 my $oe = "\Q$hints{'object-ending'}";
52 my $ps = "\Q$hints{'path-separator'}";
53 my $cn = "\Q$hints{'continuation'}";
55 $xl =~ s/${oe}(\s|$)/\x01$1/g;
56 $xl =~ s/${ps}/\x02/g;
57 $xl =~ s/${cn}$/\x03/;
58 push(@file_list, $xl);
62 push(@lines, $line."\n");
63 if ($line eq '#--- Begin File Lists ---#') {
66 push(@lines, "# Edit in $first_file, not here!\n");
67 foreach $l (@file_list) {
68 push(@lines, do_transform
($l, \
%hints)."\n");
76 # Write the file back out
78 open(FILE
, "> $file\0") or die;