On Thu, Dec 18, 2014 at 10:37 AM, Michael Paquier
<michael(dot)paquier(at)gmail(dot)com> wrote:
> On Thu, Dec 18, 2014 at 4:02 AM, Alvaro Herrera
> <alvherre(at)2ndquadrant(dot)com> wrote:
>>
>> I know this is how it currently works, but it looks way too messy to me:
>>
>> + my $pgarchivecleanup = AddSimpleFrontend('pg_archivecleanup');
>> + my $pgstandby = AddSimpleFrontend('pg_standby');
>> + my $pgtestfsync = AddSimpleFrontend('pg_test_fsync');
>> + my $pgtesttiming = AddSimpleFrontend('pg_test_timing');
>> + my $pgbench = AddSimpleFrontend('pgbench', 1);
>>
>> ISTM we should be something like
>>
>> for each $elem in src/bin/Makefile:$(SUBDIRS)
>> AddSimpleFrontend($elem)
>>
>> and avoid having to list the modules one by one.
>
> If we take this road, I'd like to avoid a huge if/elseif scanning the
> names of the submodules to do the necessary adjustments (Some need
> FRONTEND defined, others ws2_32, etc.). Also, there is the case of
> pg_basebackup where multiple binaries are included with pg_basebackup,
> pg_recvlogical and pg_receivexlog. So I think that we'd need something
> similar to what contrib does, aka:
> my @frontend_excludes = ('pg_basebackup', 'pg_dump', 'pg_dumpall',
> 'pg_xlogdump', 'initdb' ...);
> my frontend_extralibs = ('pgbench' => 'ws2_32.lib');
> my @frontend_uselibpq = ('pgbench', 'pg_ctl', 'pg_upgrade');
> And for each frontend name excluded we have an individual project
> declaration with its own exceptions. With this way of doing when a new
> frontend is added by default in src/bin it will be automatically
> compiled. How does that sound?
And here is an updated patch following those lines. Similarly to the
things in contrib/, a set of variables are used to define for each
module what are the extra libraries, include dirs, etc. This refactors
quite a bit of code, even if there are a couple of exceptions like
pg_xlogdump/ or pg_basebackup/.
--
Michael