| 1 |
#------------------------------------------------------------------------- |
| 2 |
# |
| 3 |
# Makefile for src/include/catalog |
| 4 |
# |
| 5 |
# Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group |
| 6 |
# Portions Copyright (c) 1994, Regents of the University of California |
| 7 |
# |
| 8 |
# src/include/catalog/Makefile |
| 9 |
# |
| 10 |
#------------------------------------------------------------------------- |
| 11 |
|
| 12 |
subdir = src/include/catalog |
| 13 |
top_builddir = ../../.. |
| 14 |
include $(top_builddir)/src/Makefile.global |
| 15 |
|
| 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. |
| 20 |
CATALOG_HEADERS := \ |
| 21 |
pg_proc.h \ |
| 22 |
pg_type.h \ |
| 23 |
pg_attribute.h \ |
| 24 |
pg_class.h \ |
| 25 |
pg_attrdef.h \ |
| 26 |
pg_constraint.h \ |
| 27 |
pg_inherits.h \ |
| 28 |
pg_index.h \ |
| 29 |
pg_operator.h \ |
| 30 |
pg_opfamily.h \ |
| 31 |
pg_opclass.h \ |
| 32 |
pg_am.h \ |
| 33 |
pg_amop.h \ |
| 34 |
pg_amproc.h \ |
| 35 |
pg_language.h \ |
| 36 |
pg_largeobject_metadata.h \ |
| 37 |
pg_largeobject.h \ |
| 38 |
pg_aggregate.h \ |
| 39 |
pg_statistic.h \ |
| 40 |
pg_statistic_ext.h \ |
| 41 |
pg_statistic_ext_data.h \ |
| 42 |
pg_rewrite.h \ |
| 43 |
pg_trigger.h \ |
| 44 |
pg_event_trigger.h \ |
| 45 |
pg_description.h \ |
| 46 |
pg_cast.h \ |
| 47 |
pg_enum.h \ |
| 48 |
pg_namespace.h \ |
| 49 |
pg_conversion.h \ |
| 50 |
pg_depend.h \ |
| 51 |
pg_database.h \ |
| 52 |
pg_db_role_setting.h \ |
| 53 |
pg_tablespace.h \ |
| 54 |
pg_authid.h \ |
| 55 |
pg_auth_members.h \ |
| 56 |
pg_shdepend.h \ |
| 57 |
pg_shdescription.h \ |
| 58 |
pg_ts_config.h \ |
| 59 |
pg_ts_config_map.h \ |
| 60 |
pg_ts_dict.h \ |
| 61 |
pg_ts_parser.h \ |
| 62 |
pg_ts_template.h \ |
| 63 |
pg_extension.h \ |
| 64 |
pg_foreign_data_wrapper.h \ |
| 65 |
pg_foreign_server.h \ |
| 66 |
pg_user_mapping.h \ |
| 67 |
pg_foreign_table.h \ |
| 68 |
pg_policy.h \ |
| 69 |
pg_replication_origin.h \ |
| 70 |
pg_default_acl.h \ |
| 71 |
pg_init_privs.h \ |
| 72 |
pg_seclabel.h \ |
| 73 |
pg_shseclabel.h \ |
| 74 |
pg_collation.h \ |
| 75 |
pg_parameter_acl.h \ |
| 76 |
pg_partitioned_table.h \ |
| 77 |
pg_range.h \ |
| 78 |
pg_transform.h \ |
| 79 |
pg_sequence.h \ |
| 80 |
pg_publication.h \ |
| 81 |
pg_publication_namespace.h \ |
| 82 |
pg_publication_rel.h \ |
| 83 |
pg_subscription.h \ |
| 84 |
pg_subscription_rel.h |
| 85 |
|
| 86 |
GENERATED_HEADERS := $(CATALOG_HEADERS:%.h=%_d.h) |
| 87 |
|
| 88 |
POSTGRES_BKI_SRCS := $(addprefix $(top_srcdir)/src/include/catalog/, $(CATALOG_HEADERS)) |
| 89 |
|
| 90 |
# The .dat files we need can just be listed alphabetically. |
| 91 |
POSTGRES_BKI_DATA = \ |
| 92 |
pg_aggregate.dat \ |
| 93 |
pg_am.dat \ |
| 94 |
pg_amop.dat \ |
| 95 |
pg_amproc.dat \ |
| 96 |
pg_authid.dat \ |
| 97 |
pg_cast.dat \ |
| 98 |
pg_class.dat \ |
| 99 |
pg_collation.dat \ |
| 100 |
pg_conversion.dat \ |
| 101 |
pg_database.dat \ |
| 102 |
pg_language.dat \ |
| 103 |
pg_namespace.dat \ |
| 104 |
pg_opclass.dat \ |
| 105 |
pg_operator.dat \ |
| 106 |
pg_opfamily.dat \ |
| 107 |
pg_proc.dat \ |
| 108 |
pg_range.dat \ |
| 109 |
pg_tablespace.dat \ |
| 110 |
pg_ts_config.dat \ |
| 111 |
pg_ts_config_map.dat \ |
| 112 |
pg_ts_dict.dat \ |
| 113 |
pg_ts_parser.dat \ |
| 114 |
pg_ts_template.dat \ |
| 115 |
pg_type.dat |
| 116 |
|
| 117 |
GENBKI_OUTPUT_FILES = \ |
| 118 |
$(GENERATED_HEADERS) \ |
| 119 |
postgres.bki \ |
| 120 |
system_constraints.sql \ |
| 121 |
schemapg.h \ |
| 122 |
syscache_ids.h \ |
| 123 |
syscache_info.h \ |
| 124 |
system_fk_info.h |
| 125 |
|
| 126 |
all: generated-headers |
| 127 |
|
| 128 |
.PHONY: generated-headers |
| 129 |
|
| 130 |
generated-headers: bki-stamp |
| 131 |
|
| 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) |
| 143 |
touch $@ |
| 144 |
|
| 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; \ |
| 155 |
done |
| 156 |
endif |
| 157 |
|
| 158 |
installdirs: |
| 159 |
$(MKDIR_P) '$(DESTDIR)$(datadir)' '$(DESTDIR)$(includedir_server)' |
| 160 |
|
| 161 |
uninstall: |
| 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)) |
| 164 |
|
| 165 |
clean: |
| 166 |
rm -f bki-stamp $(GENBKI_OUTPUT_FILES) |
| 167 |
|
| 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. |
| 171 |
reformat-dat-files: |
| 172 |
$(PERL) $(srcdir)/reformat_dat_file.pl --output $(srcdir) $(srcdir)/pg_*.dat |
| 173 |
|
| 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. |
| 177 |
expand-dat-files: |
| 178 |
$(PERL) $(srcdir)/reformat_dat_file.pl --output $(srcdir) $(srcdir)/pg_*.dat --full-tuples |
| 179 |
|
| 180 |
.PHONY: reformat-dat-files expand-dat-files |