]>
git.ipfire.org Git - thirdparty/squid.git/blob - scripts/format-makefile-am.pl
3 ## Copyright (C) 1996-2021 The Squid Software Foundation and contributors
5 ## Squid software is distributed under GPLv2+ license and includes
6 ## contributions from numerous individuals and organizations.
7 ## Please see the COPYING and CONTRIBUTORS files for details.
13 my $current_source_section='';
20 # accumulate files and prep for sorting
22 if (/^(\S+_SOURCES)\s*(\+?=)\s*(.*[^\\])$/ ) {
23 my @parts = split(/\s+/, $3);
24 if ($#parts == 0) { # one file only specified on same line as SOURCES
28 foreach my $file (@parts) {
29 &addfile
(\
%files, $file, $1);
32 &print_files
(\
%files);
35 if (/^(\S+_SOURCES)\s*(\+?=)\s*(.*?)\s*\\$/) {
36 $current_source_section=$1;
39 foreach my $file (split(/\s+/, $3)) {
40 &addfile
(\
%files, $file, $current_source_section);
50 foreach my $file (split(/\s+/, $1)) {
51 &addfile
(\
%files, $file, $current_source_section) if (length $file);
53 if (! /\\$/ ) { # last line in the list
54 &print_files
(\
%files);
62 # arg: ref to hash to add the file to, filename
67 my $current_source_section = shift @_;
69 $fn =~ m!\s*(tests/stub_|tests/test)?(\S+)(\s+\\\s*)?$! || die "no parse";
70 my $prefix = (defined $1) ?
$1 : '';
71 my $filename = (defined $2) ?
$2 : '';
73 print STDERR
"WARNING: duplicate $prefix$filename ".
74 "detected in $current_source_section\n"
75 if exists($files->{"$filename.$prefix"});
77 $files->{"$filename.$prefix"}="$prefix$filename";
80 # arg is hash ref, print values in order of key
85 foreach my $k (sort keys %files) {
86 push @q, "\t".$files{$k};
88 print join(" \\\n", @q)."\n";