Adapt sources2buildsystem.pl for third_party headers
MODIFY
builds/sources2buildsystem.pl
builds/sources2buildsystem.pl
# sources2buildsystem.pl - maintainer utility script to keep the
# source/header file list for our build systems organized and up-to-date.
-# by carstene1ns 2018-2020, released under the MIT license
+# by carstene1ns 2018-2021, released under the MIT license
use strict;
use warnings;
@@ -15,12 +15,16 @@ my @files;
find(\&wanted, "src");
@files = sort @files;
-# put generated files after others
+# put generated and third party files after others
my @generated = grep(/\/generated\//, @files);
-my @others = grep(!/\/generated\//, @files);
-@files = (@others, @generated);
-my @sources = grep( /(\.cpp|_flags\.h|_impl\.h|src\/[^\/]*\.h)$/, @files);
-my @headers = grep(!/(\.cpp|_flags\.h|_impl\.h|src\/[^\/]*\.h)$/, @files);
+my @third_party = grep(/\/third_party\//, @files);
+my @others = grep(!/\/generated|third_party\//, @files);
+@files = (@others, @generated, @third_party);
+
+# split source and headers
+my $regex = '(\.cpp|_flags\.h|_impl\.h|src\/[^\/]*\.h)$';
+my @sources = grep( /$regex/, @files);
+my @headers = grep(!/$regex/, @files);
# cmake
my $sources_formatted = format_files(0, @sources);
@@ -33,14 +37,16 @@ burp($buildsystem_file, $data);
# autotools (needs split)
$sources_formatted = format_files(1, @sources);
-$headers_formatted = format_files(1, grep(!/\/(ldb|lmt|lmu|lsd|rpg)\//, @headers));
+$headers_formatted = format_files(1, grep(!/\/(ldb|lmt|lmu|lsd|rpg|third_party)\//, @headers));
$buildsystem_file = "Makefile.am";
$data = slurp($buildsystem_file);
$data =~ s/(?<=^liblcf_la_SOURCES = \\\n).*?\.cpp$/$sources_formatted/sm;
$data =~ s/(?<=^lcfinclude_HEADERS = \\\n).*?\.h$/$headers_formatted/sm;
-foreach my $hg ("ldb", "lmt", "lmu", "lsd", "rpg") {
- my $h = format_files(1, grep(/\/$hg\//, @headers));
- $data =~ s/(?<=^lcf${hg}include_HEADERS = \\\n).*?\.h$/$h/sm;
+foreach ("ldb", "lmt", "lmu", "lsd", "rpg", "third_party") {
+ my $g = $_;
+ my $h = format_files(1, grep(/\/$g\//, @headers));
+ $g =~ tr/_//d; # remove underscore
+ $data =~ s/(?<=^lcf${g}include_HEADERS = \\\n).*?\.h$/$h/sm;
}
burp($buildsystem_file, $data);

Adapt sources2buildsystem.pl for third_party headers