Commit 548af97f authored by Tom Lane's avatar Tom Lane

Provide and use a makefile target to build all generated headers.

As of 9.6, pg_regress doesn't build unless storage/lwlocknames.h has been
created; but there was nothing forcing that to happen if you just went into
src/test/regress/ and built there.  We previously had a similar complaint
about plpython.

To fix in a way that won't break next time we invent a generated header,
make src/backend/Makefile expose a phony target for updating all the
include files it builds, and invoke that before building pg_regress or
plpython.  In principle, maybe we ought to invoke that everywhere; but
it would add a lot of usually-useless make cycles, so let's just do it
in the places where people have complained.

I made a couple of cosmetic adjustments in src/backend/Makefile as well,
to deal with the generated headers in consistent orders.

Michael Paquier and Tom Lane

Report: <31398.1467036827@sss.pgh.pa.us>
Report: <20150916200959.GB32090@msg.df7cb.de>
parent 1bdae16f
...@@ -494,6 +494,10 @@ libpq_pgport += $(LDAP_LIBS_FE) ...@@ -494,6 +494,10 @@ libpq_pgport += $(LDAP_LIBS_FE)
endif endif
##########################################################################
#
# Commonly used submake targets
submake-libpq: submake-libpq:
$(MAKE) -C $(libpq_builddir) all $(MAKE) -C $(libpq_builddir) all
...@@ -506,7 +510,10 @@ submake-libpgfeutils: ...@@ -506,7 +510,10 @@ submake-libpgfeutils:
$(MAKE) -C $(top_builddir)/src/common all $(MAKE) -C $(top_builddir)/src/common all
$(MAKE) -C $(top_builddir)/src/fe_utils all $(MAKE) -C $(top_builddir)/src/fe_utils all
.PHONY: submake-libpq submake-libpgport submake-libpgfeutils submake-generated-headers:
$(MAKE) -C $(top_builddir)/src/backend generated-headers
.PHONY: submake-libpq submake-libpgport submake-libpgfeutils submake-generated-headers
########################################################################## ##########################################################################
......
...@@ -110,18 +110,12 @@ endif ...@@ -110,18 +110,12 @@ endif
endif # aix endif # aix
# Update the commonly used headers before building the subdirectories # Update the commonly used headers before building the subdirectories
$(SUBDIRS:%=%-recursive): $(top_builddir)/src/include/parser/gram.h $(top_builddir)/src/include/catalog/schemapg.h $(top_builddir)/src/include/storage/lwlocknames.h $(top_builddir)/src/include/utils/fmgroids.h $(top_builddir)/src/include/utils/errcodes.h $(top_builddir)/src/include/utils/probes.h $(SUBDIRS:%=%-recursive): | generated-headers
# run this unconditionally to avoid needing to know its dependencies here: # src/port needs a convenient way to force just errcodes.h to get built
submake-schemapg:
$(MAKE) -C catalog schemapg.h
# src/port needs a convenient way to force errcodes.h to get built
submake-errcodes: $(top_builddir)/src/include/utils/errcodes.h submake-errcodes: $(top_builddir)/src/include/utils/errcodes.h
.PHONY: submake-schemapg submake-errcodes .PHONY: submake-errcodes
catalog/schemapg.h: | submake-schemapg
$(top_builddir)/src/port/libpgport_srv.a: | submake-libpgport $(top_builddir)/src/port/libpgport_srv.a: | submake-libpgport
...@@ -142,15 +136,23 @@ parser/gram.h: parser/gram.y ...@@ -142,15 +136,23 @@ parser/gram.h: parser/gram.y
storage/lmgr/lwlocknames.h: storage/lmgr/generate-lwlocknames.pl storage/lmgr/lwlocknames.txt storage/lmgr/lwlocknames.h: storage/lmgr/generate-lwlocknames.pl storage/lmgr/lwlocknames.txt
$(MAKE) -C storage/lmgr lwlocknames.h $(MAKE) -C storage/lmgr lwlocknames.h
utils/fmgroids.h: utils/Gen_fmgrtab.pl catalog/Catalog.pm $(top_srcdir)/src/include/catalog/pg_proc.h
$(MAKE) -C utils fmgroids.h
utils/errcodes.h: utils/generate-errcodes.pl utils/errcodes.txt utils/errcodes.h: utils/generate-errcodes.pl utils/errcodes.txt
$(MAKE) -C utils errcodes.h $(MAKE) -C utils errcodes.h
utils/fmgroids.h: utils/Gen_fmgrtab.pl catalog/Catalog.pm $(top_srcdir)/src/include/catalog/pg_proc.h
$(MAKE) -C utils fmgroids.h
utils/probes.h: utils/probes.d utils/probes.h: utils/probes.d
$(MAKE) -C utils probes.h $(MAKE) -C utils probes.h
# run this unconditionally to avoid needing to know its dependencies here:
catalog/schemapg.h: | submake-schemapg
submake-schemapg:
$(MAKE) -C catalog schemapg.h
.PHONY: submake-schemapg
# Make symlinks for these headers in the include directory. That way # Make symlinks for these headers in the include directory. That way
# we can cut down on the -I options. Also, a symlink is automatically # we can cut down on the -I options. Also, a symlink is automatically
# up to date when we update the base file. # up to date when we update the base file.
...@@ -162,6 +164,10 @@ utils/probes.h: utils/probes.d ...@@ -162,6 +164,10 @@ utils/probes.h: utils/probes.d
# will be in the build tree, so a simple ../.. reference won't work. # will be in the build tree, so a simple ../.. reference won't work.
# For headers generated during regular builds, we prefer a relative symlink. # For headers generated during regular builds, we prefer a relative symlink.
.PHONY: generated-headers
generated-headers: $(top_builddir)/src/include/parser/gram.h $(top_builddir)/src/include/catalog/schemapg.h $(top_builddir)/src/include/storage/lwlocknames.h $(top_builddir)/src/include/utils/errcodes.h $(top_builddir)/src/include/utils/fmgroids.h $(top_builddir)/src/include/utils/probes.h
$(top_builddir)/src/include/parser/gram.h: parser/gram.h $(top_builddir)/src/include/parser/gram.h: parser/gram.h
prereqdir=`cd '$(dir $<)' >/dev/null && pwd` && \ prereqdir=`cd '$(dir $<)' >/dev/null && pwd` && \
cd '$(dir $@)' && rm -f $(notdir $@) && \ cd '$(dir $@)' && rm -f $(notdir $@) && \
......
...@@ -95,7 +95,7 @@ REGRESS_PLPYTHON3_MANGLE := $(REGRESS) ...@@ -95,7 +95,7 @@ REGRESS_PLPYTHON3_MANGLE := $(REGRESS)
include $(top_srcdir)/src/Makefile.shlib include $(top_srcdir)/src/Makefile.shlib
all: all-lib all: submake-generated-headers all-lib
install: all install-lib install-data install: all install-lib install-data
...@@ -119,15 +119,15 @@ uninstall-data: ...@@ -119,15 +119,15 @@ uninstall-data:
include $(srcdir)/regress-python3-mangle.mk include $(srcdir)/regress-python3-mangle.mk
check: submake check: submake-pg-regress
$(pg_regress_check) $(REGRESS_OPTS) $(REGRESS) $(pg_regress_check) $(REGRESS_OPTS) $(REGRESS)
installcheck: submake installcheck: submake-pg-regress
$(pg_regress_installcheck) $(REGRESS_OPTS) $(REGRESS) $(pg_regress_installcheck) $(REGRESS_OPTS) $(REGRESS)
.PHONY: submake .PHONY: submake-pg-regress
submake: submake-pg-regress:
$(MAKE) -C $(top_builddir)/src/test/regress pg_regress$(X) $(MAKE) -C $(top_builddir)/src/test/regress pg_regress$(X)
clean distclean: clean-lib clean distclean: clean-lib
......
...@@ -17,9 +17,6 @@ SUBDIRS = \ ...@@ -17,9 +17,6 @@ SUBDIRS = \
test_shm_mq \ test_shm_mq \
worker_spi worker_spi
all: submake-errcodes all: submake-generated-headers
submake-errcodes:
$(MAKE) -C $(top_builddir)/src/backend submake-errcodes
$(recurse) $(recurse)
...@@ -36,7 +36,7 @@ EXTRADEFS = '-DHOST_TUPLE="$(host_tuple)"' \ ...@@ -36,7 +36,7 @@ EXTRADEFS = '-DHOST_TUPLE="$(host_tuple)"' \
all: pg_regress$(X) all: pg_regress$(X)
pg_regress$(X): pg_regress.o pg_regress_main.o $(WIN32RES) | submake-libpgport pg_regress$(X): pg_regress.o pg_regress_main.o $(WIN32RES) | submake-libpgport submake-generated-headers
$(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@ $(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@
# dependencies ensure that path changes propagate # dependencies ensure that path changes propagate
...@@ -105,7 +105,7 @@ $(top_builddir)/contrib/spi/refint$(DLSUFFIX): | submake-contrib-spi ; ...@@ -105,7 +105,7 @@ $(top_builddir)/contrib/spi/refint$(DLSUFFIX): | submake-contrib-spi ;
$(top_builddir)/contrib/spi/autoinc$(DLSUFFIX): | submake-contrib-spi ; $(top_builddir)/contrib/spi/autoinc$(DLSUFFIX): | submake-contrib-spi ;
submake-contrib-spi: submake-contrib-spi: | submake-libpgport submake-generated-headers
$(MAKE) -C $(top_builddir)/contrib/spi $(MAKE) -C $(top_builddir)/contrib/spi
.PHONY: submake-contrib-spi .PHONY: submake-contrib-spi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment