On Wed, Mar 23, 2016 at 5:55 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
I'm not terribly happy with the hack I used to get pgbench to be able to borrow psql's psqlscan.l lexer. It's a mess for the MSVC build scripts, and I have seen it causing two concurrent builds of psqlscan.o in parallel builds, which is likely to cause a build failure some of the time. Another unresolved issue is that we can't apply FLEX_NO_BACKUP testing to both of psql's lexers, because that causes each of those make steps to want to write lex.backup in the current directory.
I have a modest proposal for improving this: let's move all the code that's currently shared by two or more src/bin/ subdirectories into a new directory, say src/feutils, and build it into a ".a" library in the same way that src/common/ is handled. This would remove the following klugy cross-directory links:
Note: the reason for a new subdirectory, rather than putting this stuff into src/common/, is that src/common/ is meant for code that's shared between frontend and backend, which this stuff is not. Also, many of these files depend on libpq which seems like an inappropriate dependency for src/common.
Having said that, I also notice these dependencies: