I experimented today (for the first time in a long time) with building
Postgres outside the source tree. Didn't work:
make[3]: Entering directory `/home/users/t/tg/tgl/builddir/src/backend/bootstrap'
gcc -O1 -g -Wall -Wmissing-prototypes -Wmissing-declarations -g -I../../../src/include
-I/home/users/t/tg/tgl/pgsql/src/include -c -o bootparse.o
/home/users/t/tg/tgl/pgsql/src/backend/bootstrap/bootparse.c
gcc -O1 -g -Wall -Wmissing-prototypes -Wmissing-declarations -g -I../../../src/include
-I/home/users/t/tg/tgl/pgsql/src/include -c -o bootscanner.o
/home/users/t/tg/tgl/pgsql/src/backend/bootstrap/bootscanner.c
bootscanner.l:43: bootstrap_tokens.h: No such file or directory
make[3]: *** [bootscanner.o] Error 1
and similarly in src/interfaces/ecpg/preproc.
The problem was that I already had bison output files built in the
source tree. If I remove those, the build goes through (with bison
output files built in the object tree). However, since our source
distribution tarballs come with prebuilt bison outputs, this means
that a VPATH build from a source tarball won't work.
The simplest fix is probably to addoverride CPPFLAGS := -I$(srcdir) $(CPPFLAGS)
to the Makefiles in these two directories. (I observe that plpgsql
already has this, which is why it fails to fail; backend/parser gets
around the same problem by installing symlinks.) Any objections?
regards, tom lane