Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 548af97

Browse files
committed
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>
1 parent 1bdae16 commit 548af97

File tree

5 files changed

+34
-24
lines changed

5 files changed

+34
-24
lines changed

src/Makefile.global.in

+8-1
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,10 @@ libpq_pgport += $(LDAP_LIBS_FE)
494494
endif
495495

496496

497+
##########################################################################
498+
#
499+
# Commonly used submake targets
500+
497501
submake-libpq:
498502
$(MAKE) -C $(libpq_builddir) all
499503

@@ -506,7 +510,10 @@ submake-libpgfeutils:
506510
$(MAKE) -C $(top_builddir)/src/common all
507511
$(MAKE) -C $(top_builddir)/src/fe_utils all
508512

509-
.PHONY: submake-libpq submake-libpgport submake-libpgfeutils
513+
submake-generated-headers:
514+
$(MAKE) -C $(top_builddir)/src/backend generated-headers
515+
516+
.PHONY: submake-libpq submake-libpgport submake-libpgfeutils submake-generated-headers
510517

511518

512519
##########################################################################

src/backend/Makefile

+18-12
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,12 @@ endif
110110
endif # aix
111111

112112
# Update the commonly used headers before building the subdirectories
113-
$(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
113+
$(SUBDIRS:%=%-recursive): | generated-headers
114114

115-
# run this unconditionally to avoid needing to know its dependencies here:
116-
submake-schemapg:
117-
$(MAKE) -C catalog schemapg.h
118-
119-
# src/port needs a convenient way to force errcodes.h to get built
115+
# src/port needs a convenient way to force just errcodes.h to get built
120116
submake-errcodes: $(top_builddir)/src/include/utils/errcodes.h
121117

122-
.PHONY: submake-schemapg submake-errcodes
123-
124-
catalog/schemapg.h: | submake-schemapg
118+
.PHONY: submake-errcodes
125119

126120
$(top_builddir)/src/port/libpgport_srv.a: | submake-libpgport
127121

@@ -142,15 +136,23 @@ parser/gram.h: parser/gram.y
142136
storage/lmgr/lwlocknames.h: storage/lmgr/generate-lwlocknames.pl storage/lmgr/lwlocknames.txt
143137
$(MAKE) -C storage/lmgr lwlocknames.h
144138

145-
utils/fmgroids.h: utils/Gen_fmgrtab.pl catalog/Catalog.pm $(top_srcdir)/src/include/catalog/pg_proc.h
146-
$(MAKE) -C utils fmgroids.h
147-
148139
utils/errcodes.h: utils/generate-errcodes.pl utils/errcodes.txt
149140
$(MAKE) -C utils errcodes.h
150141

142+
utils/fmgroids.h: utils/Gen_fmgrtab.pl catalog/Catalog.pm $(top_srcdir)/src/include/catalog/pg_proc.h
143+
$(MAKE) -C utils fmgroids.h
144+
151145
utils/probes.h: utils/probes.d
152146
$(MAKE) -C utils probes.h
153147

148+
# run this unconditionally to avoid needing to know its dependencies here:
149+
catalog/schemapg.h: | submake-schemapg
150+
151+
submake-schemapg:
152+
$(MAKE) -C catalog schemapg.h
153+
154+
.PHONY: submake-schemapg
155+
154156
# Make symlinks for these headers in the include directory. That way
155157
# we can cut down on the -I options. Also, a symlink is automatically
156158
# up to date when we update the base file.
@@ -162,6 +164,10 @@ utils/probes.h: utils/probes.d
162164
# will be in the build tree, so a simple ../.. reference won't work.
163165
# For headers generated during regular builds, we prefer a relative symlink.
164166

167+
.PHONY: generated-headers
168+
169+
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
170+
165171
$(top_builddir)/src/include/parser/gram.h: parser/gram.h
166172
prereqdir=`cd '$(dir $<)' >/dev/null && pwd` && \
167173
cd '$(dir $@)' && rm -f $(notdir $@) && \

src/pl/plpython/Makefile

+5-5
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ REGRESS_PLPYTHON3_MANGLE := $(REGRESS)
9595

9696
include $(top_srcdir)/src/Makefile.shlib
9797

98-
all: all-lib
98+
all: submake-generated-headers all-lib
9999

100100

101101
install: all install-lib install-data
@@ -119,15 +119,15 @@ uninstall-data:
119119
include $(srcdir)/regress-python3-mangle.mk
120120

121121

122-
check: submake
122+
check: submake-pg-regress
123123
$(pg_regress_check) $(REGRESS_OPTS) $(REGRESS)
124124

125-
installcheck: submake
125+
installcheck: submake-pg-regress
126126
$(pg_regress_installcheck) $(REGRESS_OPTS) $(REGRESS)
127127

128128

129-
.PHONY: submake
130-
submake:
129+
.PHONY: submake-pg-regress
130+
submake-pg-regress:
131131
$(MAKE) -C $(top_builddir)/src/test/regress pg_regress$(X)
132132

133133
clean distclean: clean-lib

src/test/modules/Makefile

+1-4
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ SUBDIRS = \
1717
test_shm_mq \
1818
worker_spi
1919

20-
all: submake-errcodes
21-
22-
submake-errcodes:
23-
$(MAKE) -C $(top_builddir)/src/backend submake-errcodes
20+
all: submake-generated-headers
2421

2522
$(recurse)

src/test/regress/GNUmakefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ EXTRADEFS = '-DHOST_TUPLE="$(host_tuple)"' \
3636

3737
all: pg_regress$(X)
3838

39-
pg_regress$(X): pg_regress.o pg_regress_main.o $(WIN32RES) | submake-libpgport
39+
pg_regress$(X): pg_regress.o pg_regress_main.o $(WIN32RES) | submake-libpgport submake-generated-headers
4040
$(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@
4141

4242
# dependencies ensure that path changes propagate
@@ -105,7 +105,7 @@ $(top_builddir)/contrib/spi/refint$(DLSUFFIX): | submake-contrib-spi ;
105105

106106
$(top_builddir)/contrib/spi/autoinc$(DLSUFFIX): | submake-contrib-spi ;
107107

108-
submake-contrib-spi:
108+
submake-contrib-spi: | submake-libpgport submake-generated-headers
109109
$(MAKE) -C $(top_builddir)/contrib/spi
110110

111111
.PHONY: submake-contrib-spi

0 commit comments

Comments
 (0)