1 #-------------------------------------------------------------------------
3 # Makefile for src/include/catalog
5 # Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
6 # Portions Copyright (c) 1994, Regents of the University of California
8 # src/include/catalog/Makefile
10 #-------------------------------------------------------------------------
12 subdir
= src
/include/catalog
13 top_builddir
= ..
/..
/..
14 include $(top_builddir
)/src
/Makefile.global
16 # Note: the order of this list determines the order in which the catalog
17 # header files are assembled into postgres.bki. BKI_BOOTSTRAP catalogs
18 # must appear first, and pg_statistic before pg_statistic_ext_data, and
19 # there are reputedly other, undocumented ordering dependencies.
36 pg_largeobject_metadata.h \
41 pg_statistic_ext_data.h \
52 pg_db_role_setting.h \
64 pg_foreign_data_wrapper.h \
69 pg_replication_origin.h \
76 pg_partitioned_table.h \
81 pg_publication_namespace.h \
82 pg_publication_rel.h \
86 GENERATED_HEADERS
:= $(CATALOG_HEADERS
:%.h
=%_d.h
)
88 POSTGRES_BKI_SRCS
:= $(addprefix $(top_srcdir
)/src
/include/catalog
/, $(CATALOG_HEADERS
))
90 # The .dat files we need can just be listed alphabetically.
111 pg_ts_config_map.dat \
117 GENBKI_OUTPUT_FILES
= \
118 $(GENERATED_HEADERS
) \
120 system_constraints.sql \
126 all: generated-headers
128 .PHONY
: generated-headers
130 generated-headers
: bki-stamp
132 # bki-stamp records the last time we ran genbki.pl. We don't rely on
133 # the timestamps of the individual output files, because the Perl script
134 # won't update them if they didn't change (to avoid unnecessary recompiles).
135 # Technically, this should depend on Makefile.global which supplies
136 # $(MAJORVERSION); but then genbki.pl would need to be re-run after every
137 # configure run, even in distribution tarballs. So depending on configure.ac
138 # instead is cheating a bit, but it will achieve the goal of updating the
139 # version number when it changes.
140 bki-stamp
: $(top_srcdir
)/src
/backend
/catalog
/genbki.pl
$(top_srcdir
)/src
/backend
/catalog
/Catalog.pm
$(POSTGRES_BKI_SRCS
) $(POSTGRES_BKI_DATA
) $(top_srcdir
)/configure.ac
$(top_srcdir
)/src
/include/access
/transam.h
141 $(PERL
) $< --include-path
=$(top_srcdir
)/src
/include/ \
142 --set-version
=$(MAJORVERSION
) $(POSTGRES_BKI_SRCS
)
145 install: all installdirs
146 $(INSTALL_DATA
) postgres.bki
'$(DESTDIR)$(datadir)/postgres.bki'
147 $(INSTALL_DATA
) system_constraints.sql
'$(DESTDIR)$(datadir)/system_constraints.sql'
148 # In non-vpath builds, src/include/Makefile already installs all headers.
149 ifeq ($(vpath_build
),yes
)
150 $(INSTALL_DATA
) schemapg.h
'$(DESTDIR)$(includedir_server)'/catalog
/schemapg.h
151 $(INSTALL_DATA
) syscache_ids.h
'$(DESTDIR)$(includedir_server)'/catalog
/syscache_ids.h
152 $(INSTALL_DATA
) system_fk_info.h
'$(DESTDIR)$(includedir_server)'/catalog
/system_fk_info.h
153 for file in
$(GENERATED_HEADERS
); do \
154 $(INSTALL_DATA
) $$file '$(DESTDIR)$(includedir_server)'/catalog
/$$file || exit
; \
159 $(MKDIR_P
) '$(DESTDIR)$(datadir)' '$(DESTDIR)$(includedir_server)'
162 rm -f
$(addprefix '$(DESTDIR)$(datadir)'/, postgres.bki system_constraints.sql
)
163 rm -f
$(addprefix '$(DESTDIR)$(includedir_server)'/catalog
/, schemapg.h syscache_ids.h system_fk_info.h
$(GENERATED_HEADERS
))
166 rm -f bki-stamp
$(GENBKI_OUTPUT_FILES
)
168 # 'make reformat-dat-files' is a convenience target for rewriting the
169 # catalog data files in our standard format. This includes collapsing
170 # out any entries that are redundant with a BKI_DEFAULT annotation.
172 $(PERL
) $(srcdir)/reformat_dat_file.pl
--output
$(srcdir) $(srcdir)/pg_
*.dat
174 # 'make expand-dat-files' is a convenience target for expanding out all
175 # default values in the catalog data files. This should be run before
176 # altering or removing any BKI_DEFAULT annotation.
178 $(PERL
) $(srcdir)/reformat_dat_file.pl
--output
$(srcdir) $(srcdir)/pg_
*.dat
--full-tuples
180 .PHONY
: reformat-dat-files expand-dat-files