Commit 356f2cbb authored by Robert Haas's avatar Robert Haas

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.
parent afb6dee1
...@@ -30,18 +30,6 @@ SUBDIRS = \ ...@@ -30,18 +30,6 @@ SUBDIRS = \
# don't attempt parallel make here. # don't attempt parallel make here.
.NOTPARALLEL: .NOTPARALLEL:
# generate errcodes.h before recursing in the subdirectories
$(SUBDIRS:%=all-%-recurse): $(top_builddir)/src/include/utils/errcodes.h
$(SUBDIRS:%=install-%-recurse): $(top_builddir)/src/include/utils/errcodes.h
backend/utils/errcodes.h: backend/utils/generate-errcodes.pl $(top_srcdir)/src/backend/utils/errcodes.txt
$(MAKE) -C backend/utils errcodes.h
$(top_builddir)/src/include/utils/errcodes.h: backend/utils/errcodes.h
prereqdir=`cd $(dir $<) >/dev/null && pwd` && \
cd $(dir $@) && rm -f $(notdir $@) && \
$(LN_S) "$$prereqdir/$(notdir $<)" .
$(recurse) $(recurse)
install: install-local install: install-local
......
...@@ -114,13 +114,16 @@ endif ...@@ -114,13 +114,16 @@ 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/utils/fmgroids.h $(top_builddir)/src/include/utils/probes.h $(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
# run this unconditionally to avoid needing to know its dependencies here: # run this unconditionally to avoid needing to know its dependencies here:
submake-schemapg: submake-schemapg:
$(MAKE) -C catalog schemapg.h $(MAKE) -C catalog schemapg.h
.PHONY: submake-schemapg # src/port needs a convenient way to force errcodes.h to get built
submake-errcodes: $(top_builddir)/src/include/utils/errcodes.h
.PHONY: submake-schemapg submake-errcodes
catalog/schemapg.h: | submake-schemapg catalog/schemapg.h: | submake-schemapg
...@@ -143,6 +146,9 @@ parser/gram.h: parser/gram.y ...@@ -143,6 +146,9 @@ parser/gram.h: parser/gram.y
utils/fmgroids.h: utils/Gen_fmgrtab.pl catalog/Catalog.pm $(top_srcdir)/src/include/catalog/pg_proc.h utils/fmgroids.h: utils/Gen_fmgrtab.pl catalog/Catalog.pm $(top_srcdir)/src/include/catalog/pg_proc.h
$(MAKE) -C utils fmgroids.h $(MAKE) -C utils fmgroids.h
utils/errcodes.h: utils/generate-errcodes.pl utils/errcodes.txt
$(MAKE) -C utils errcodes.h
utils/probes.h: utils/probes.d utils/probes.h: utils/probes.d
$(MAKE) -C utils probes.h $(MAKE) -C utils probes.h
...@@ -167,6 +173,10 @@ $(top_builddir)/src/include/catalog/schemapg.h: catalog/schemapg.h ...@@ -167,6 +173,10 @@ $(top_builddir)/src/include/catalog/schemapg.h: catalog/schemapg.h
cd $(dir $@) && rm -f $(notdir $@) && \ cd $(dir $@) && rm -f $(notdir $@) && \
$(LN_S) "$$prereqdir/$(notdir $<)" . $(LN_S) "$$prereqdir/$(notdir $<)" .
$(top_builddir)/src/include/utils/errcodes.h: utils/errcodes.h
cd $(dir $@) && rm -f $(notdir $@) && \
$(LN_S) ../../../$(subdir)/utils/errcodes.h .
$(top_builddir)/src/include/utils/fmgroids.h: utils/fmgroids.h $(top_builddir)/src/include/utils/fmgroids.h: utils/fmgroids.h
prereqdir=`cd $(dir $<) >/dev/null && pwd` && \ prereqdir=`cd $(dir $<) >/dev/null && pwd` && \
cd $(dir $@) && rm -f $(notdir $@) && \ cd $(dir $@) && rm -f $(notdir $@) && \
...@@ -187,7 +197,7 @@ distprep: ...@@ -187,7 +197,7 @@ distprep:
$(MAKE) -C parser gram.c gram.h scan.c $(MAKE) -C parser gram.c gram.h scan.c
$(MAKE) -C bootstrap bootparse.c bootscanner.c $(MAKE) -C bootstrap bootparse.c bootscanner.c
$(MAKE) -C catalog schemapg.h postgres.bki postgres.description postgres.shdescription $(MAKE) -C catalog schemapg.h postgres.bki postgres.description postgres.shdescription
$(MAKE) -C utils fmgrtab.c fmgroids.h $(MAKE) -C utils fmgrtab.c fmgroids.h errcodes.h
$(MAKE) -C utils/misc guc-file.c $(MAKE) -C utils/misc guc-file.c
......
...@@ -16,7 +16,7 @@ catalogdir = $(top_srcdir)/src/backend/catalog ...@@ -16,7 +16,7 @@ catalogdir = $(top_srcdir)/src/backend/catalog
include $(top_srcdir)/src/backend/common.mk include $(top_srcdir)/src/backend/common.mk
all: fmgroids.h probes.h all: errcodes.h fmgroids.h probes.h
$(SUBDIRS:%=%-recursive): fmgroids.h $(SUBDIRS:%=%-recursive): fmgroids.h
......
...@@ -40,6 +40,7 @@ install: all installdirs ...@@ -40,6 +40,7 @@ install: all installdirs
# These headers are needed for server-side development # These headers are needed for server-side development
$(INSTALL_DATA) pg_config.h '$(DESTDIR)$(includedir_server)' $(INSTALL_DATA) pg_config.h '$(DESTDIR)$(includedir_server)'
$(INSTALL_DATA) pg_config_os.h '$(DESTDIR)$(includedir_server)' $(INSTALL_DATA) pg_config_os.h '$(DESTDIR)$(includedir_server)'
$(INSTALL_DATA) utils/errcodes.h '$(DESTDIR)$(includedir_server)/utils'
$(INSTALL_DATA) utils/fmgroids.h '$(DESTDIR)$(includedir_server)/utils' $(INSTALL_DATA) utils/fmgroids.h '$(DESTDIR)$(includedir_server)/utils'
# We don't use INSTALL_DATA for performance reasons --- there are a lot of files # We don't use INSTALL_DATA for performance reasons --- there are a lot of files
cp $(srcdir)/*.h '$(DESTDIR)$(includedir_server)'/ || exit; \ cp $(srcdir)/*.h '$(DESTDIR)$(includedir_server)'/ || exit; \
......
...@@ -70,6 +70,13 @@ libpgport_srv.a: $(OBJS_SRV) ...@@ -70,6 +70,13 @@ libpgport_srv.a: $(OBJS_SRV)
%_srv.o: %.c %_srv.o: %.c
$(CC) $(CFLAGS) $(subst -DFRONTEND,, $(CPPFLAGS)) -c $< -o $@ $(CC) $(CFLAGS) $(subst -DFRONTEND,, $(CPPFLAGS)) -c $< -o $@
$(OBJS_SRV): | submake-errcodes
.PHONY: submake-errcodes
submake-errcodes:
make -C ../backend submake-errcodes
# Dependency is to ensure that path changes propagate # Dependency is to ensure that path changes propagate
path.o: path.c pg_config_paths.h path.o: path.c pg_config_paths.h
......
...@@ -20,6 +20,7 @@ REM Delete files created with GenerateFiles() in Solution.pm ...@@ -20,6 +20,7 @@ REM Delete files created with GenerateFiles() in Solution.pm
if exist src\include\pg_config.h del /q src\include\pg_config.h if exist src\include\pg_config.h del /q src\include\pg_config.h
if exist src\include\pg_config_os.h del /q src\include\pg_config_os.h if exist src\include\pg_config_os.h del /q src\include\pg_config_os.h
if %DIST%==1 if exist src\backend\parser\gram.h del /q src\backend\parser\gram.h if %DIST%==1 if exist src\backend\parser\gram.h del /q src\backend\parser\gram.h
if exist src\include\utils\errcodes.h del /q src\include\utils\errcodes.h
if exist src\include\utils\fmgroids.h del /q src\include\utils\fmgroids.h if exist src\include\utils\fmgroids.h del /q src\include\utils\fmgroids.h
if exist src\include\utils\probes.h del /q src\include\utils\probes.h if exist src\include\utils\probes.h del /q src\include\utils\probes.h
......
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