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

Commit 356f2cb

Browse files
committed
Make handling of errcodes.h more consistent with other generated headers.
This fixes make distprep, and seems more robust in other ways as well. Some special handling is required because errcodes.txt is needed by some stuff in src/port, but just by src/backend as is the case for the other generated headers. While I'm at it, fix a few other things that were overlooked in the original patch.
1 parent afb6dee commit 356f2cb

File tree

6 files changed

+23
-16
lines changed

6 files changed

+23
-16
lines changed

src/Makefile

-12
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,6 @@ SUBDIRS = \
3030
# don't attempt parallel make here.
3131
.NOTPARALLEL:
3232

33-
# generate errcodes.h before recursing in the subdirectories
34-
$(SUBDIRS:%=all-%-recurse): $(top_builddir)/src/include/utils/errcodes.h
35-
$(SUBDIRS:%=install-%-recurse): $(top_builddir)/src/include/utils/errcodes.h
36-
37-
backend/utils/errcodes.h: backend/utils/generate-errcodes.pl $(top_srcdir)/src/backend/utils/errcodes.txt
38-
$(MAKE) -C backend/utils errcodes.h
39-
40-
$(top_builddir)/src/include/utils/errcodes.h: backend/utils/errcodes.h
41-
prereqdir=`cd $(dir $<) >/dev/null && pwd` && \
42-
cd $(dir $@) && rm -f $(notdir $@) && \
43-
$(LN_S) "$$prereqdir/$(notdir $<)" .
44-
4533
$(recurse)
4634

4735
install: install-local

src/backend/Makefile

+13-3
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,16 @@ endif
114114
endif # aix
115115

116116
# Update the commonly used headers before building the subdirectories
117-
$(SUBDIRS:%=%-recursive): $(top_builddir)/src/include/parser/gram.h $(top_builddir)/src/include/catalog/schemapg.h $(top_builddir)/src/include/utils/fmgroids.h $(top_builddir)/src/include/utils/probes.h
117+
$(SUBDIRS:%=%-recursive): $(top_builddir)/src/include/parser/gram.h $(top_builddir)/src/include/catalog/schemapg.h $(top_builddir)/src/include/utils/fmgroids.h $(top_builddir)/src/include/utils/errcodes.h $(top_builddir)/src/include/utils/probes.h
118118

119119
# run this unconditionally to avoid needing to know its dependencies here:
120120
submake-schemapg:
121121
$(MAKE) -C catalog schemapg.h
122122

123-
.PHONY: submake-schemapg
123+
# src/port needs a convenient way to force errcodes.h to get built
124+
submake-errcodes: $(top_builddir)/src/include/utils/errcodes.h
125+
126+
.PHONY: submake-schemapg submake-errcodes
124127

125128
catalog/schemapg.h: | submake-schemapg
126129

@@ -143,6 +146,9 @@ parser/gram.h: parser/gram.y
143146
utils/fmgroids.h: utils/Gen_fmgrtab.pl catalog/Catalog.pm $(top_srcdir)/src/include/catalog/pg_proc.h
144147
$(MAKE) -C utils fmgroids.h
145148

149+
utils/errcodes.h: utils/generate-errcodes.pl utils/errcodes.txt
150+
$(MAKE) -C utils errcodes.h
151+
146152
utils/probes.h: utils/probes.d
147153
$(MAKE) -C utils probes.h
148154

@@ -167,6 +173,10 @@ $(top_builddir)/src/include/catalog/schemapg.h: catalog/schemapg.h
167173
cd $(dir $@) && rm -f $(notdir $@) && \
168174
$(LN_S) "$$prereqdir/$(notdir $<)" .
169175

176+
$(top_builddir)/src/include/utils/errcodes.h: utils/errcodes.h
177+
cd $(dir $@) && rm -f $(notdir $@) && \
178+
$(LN_S) ../../../$(subdir)/utils/errcodes.h .
179+
170180
$(top_builddir)/src/include/utils/fmgroids.h: utils/fmgroids.h
171181
prereqdir=`cd $(dir $<) >/dev/null && pwd` && \
172182
cd $(dir $@) && rm -f $(notdir $@) && \
@@ -187,7 +197,7 @@ distprep:
187197
$(MAKE) -C parser gram.c gram.h scan.c
188198
$(MAKE) -C bootstrap bootparse.c bootscanner.c
189199
$(MAKE) -C catalog schemapg.h postgres.bki postgres.description postgres.shdescription
190-
$(MAKE) -C utils fmgrtab.c fmgroids.h
200+
$(MAKE) -C utils fmgrtab.c fmgroids.h errcodes.h
191201
$(MAKE) -C utils/misc guc-file.c
192202

193203

src/backend/utils/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ catalogdir = $(top_srcdir)/src/backend/catalog
1616

1717
include $(top_srcdir)/src/backend/common.mk
1818

19-
all: fmgroids.h probes.h
19+
all: errcodes.h fmgroids.h probes.h
2020

2121
$(SUBDIRS:%=%-recursive): fmgroids.h
2222

src/include/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ install: all installdirs
4040
# These headers are needed for server-side development
4141
$(INSTALL_DATA) pg_config.h '$(DESTDIR)$(includedir_server)'
4242
$(INSTALL_DATA) pg_config_os.h '$(DESTDIR)$(includedir_server)'
43+
$(INSTALL_DATA) utils/errcodes.h '$(DESTDIR)$(includedir_server)/utils'
4344
$(INSTALL_DATA) utils/fmgroids.h '$(DESTDIR)$(includedir_server)/utils'
4445
# We don't use INSTALL_DATA for performance reasons --- there are a lot of files
4546
cp $(srcdir)/*.h '$(DESTDIR)$(includedir_server)'/ || exit; \

src/port/Makefile

+7
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ libpgport_srv.a: $(OBJS_SRV)
7070
%_srv.o: %.c
7171
$(CC) $(CFLAGS) $(subst -DFRONTEND,, $(CPPFLAGS)) -c $< -o $@
7272

73+
$(OBJS_SRV): | submake-errcodes
74+
75+
.PHONY: submake-errcodes
76+
77+
submake-errcodes:
78+
make -C ../backend submake-errcodes
79+
7380
# Dependency is to ensure that path changes propagate
7481

7582
path.o: path.c pg_config_paths.h

src/tools/msvc/clean.bat

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ REM Delete files created with GenerateFiles() in Solution.pm
2020
if exist src\include\pg_config.h del /q src\include\pg_config.h
2121
if exist src\include\pg_config_os.h del /q src\include\pg_config_os.h
2222
if %DIST%==1 if exist src\backend\parser\gram.h del /q src\backend\parser\gram.h
23+
if exist src\include\utils\errcodes.h del /q src\include\utils\errcodes.h
2324
if exist src\include\utils\fmgroids.h del /q src\include\utils\fmgroids.h
2425
if exist src\include\utils\probes.h del /q src\include\utils\probes.h
2526

0 commit comments

Comments
 (0)