Makefile 5.4 KB
Newer Older
1 2
#-------------------------------------------------------------------------
#
3
# Makefile for backend/catalog
4
#
5
# src/backend/catalog/Makefile
6 7 8
#
#-------------------------------------------------------------------------

9 10
subdir = src/backend/catalog
top_builddir = ../../..
11
include $(top_builddir)/src/Makefile.global
12

13 14 15 16
ifndef ADDON_DIR
QUICKLZ_COMPRESSION = quicklz_compression.o
endif

17
OBJS = catalog.o dependency.o heap.o index.o indexing.o namespace.o aclchk.o \
18
       objectaddress.o pg_aggregate.o pg_constraint.o pg_conversion.o pg_depend.o pg_enum.o \
19
       pg_largeobject.o pg_namespace.o pg_operator.o pg_proc.o pg_shdepend.o \
20
       pg_type.o storage.o toasting.o \
21 22
       pg_exttable.o pg_extprotocol.o \
       pg_proc_callback.o \
23
       aoseg.o aoblkdir.o gp_fastsequence.o gp_segment_config.o \
24 25
       pg_attribute_encoding.o pg_compression.o aovisimap.o \
       gp_global_sequence.o gp_persistent.o pg_appendonly.o \
26
       oid_dispatch.o aocatalog.o zstd_compression.o $(QUICKLZ_COMPRESSION)
27

28
BKIFILES = postgres.bki postgres.description postgres.shdescription
29

30 31
CATALOG_JSON:= $(addprefix $(top_srcdir)/gpMgmt/bin/gppylib/data/, $(addsuffix .json,$(GP_MAJORVERSION)))

32 33
include $(top_srcdir)/src/backend/common.mk

34
all: $(BKIFILES) $(CATALOG_JSON)
35

36 37
# Note: there are some undocumented dependencies on the ordering in which
# the catalog header files are assembled into postgres.bki.  In particular,
38
# indexing.h had better be last, and toasting.h just before it.
39
# And pg_proc_gp.h must be immediately after pg_proc.h
40

41 42 43
POSTGRES_BKI_SRCS := $(addprefix $(top_srcdir)/src/include/catalog/, \
	pg_proc.h pg_proc_gp.h \
	pg_type.h pg_attribute.h pg_class.h pg_autovacuum.h \
44 45
	pg_attrdef.h pg_constraint.h pg_inherits.h pg_index.h pg_operator.h \
	pg_opfamily.h pg_opclass.h pg_am.h pg_amop.h pg_amproc.h \
46
	pg_language.h pg_largeobject.h pg_aggregate.h pg_statistic.h \
47
	pg_rewrite.h pg_trigger.h pg_listener.h pg_description.h pg_cast.h \
48
	pg_enum.h pg_namespace.h pg_conversion.h pg_depend.h \
49
	pg_database.h pg_tablespace.h pg_pltemplate.h \
X
xiong-gang 已提交
50
	pg_authid.h pg_auth_members.h pg_shdepend.h pg_shdescription.h pg_resqueue.h pg_resgroup.h\
51
	pg_ts_config.h pg_ts_config_map.h pg_ts_dict.h \
52
	pg_ts_parser.h pg_ts_template.h pg_extension.h \
53
	pg_foreign_data_wrapper.h pg_foreign_server.h pg_user_mapping.h \
54
	gp_configuration_history.h gp_id.h gp_policy.h gp_version.h \
55
	gp_segment_config.h \
56
	pg_exttable.h pg_appendonly.h aoseg.h \
57 58 59
	gp_fastsequence.h pg_extprotocol.h \
	pg_partition.h pg_partition_rule.h pg_filespace.h pg_filespace_entry.h \
	gp_global_sequence.h gp_persistent.h \
H
Heikki Linnakangas 已提交
60 61 62 63 64 65
	pg_attribute_encoding.h \
	pg_auth_time_constraint.h \
	pg_compression.h \
	pg_proc_callback.h \
	pg_partition_encoding.h \
	pg_type_encoding.h \
66
	toasting.h indexing.h \
67 68
    )

69
pg_includes = $(sort -I$(top_srcdir)/src/include -I$(top_builddir)/src/include)
70

71 72 73
# see explanation in ../parser/Makefile
postgres.description: postgres.bki ;

74 75
postgres.shdescription: postgres.bki ;

76 77 78 79 80 81 82 83 84 85 86 87 88 89
# In Greenplum, we have added extra columns to some catalog tables. To avoid
# having to change every single DATA row in those header files, which would
# create massive merge conflicts when merging with upstream, the extra
# columns are marked with GPDB_COLUMN_DEFAULT() lines in the header files,
# which provides a default for every data row that's missing the column. That
# way, new rows can have all the columns, but there's no need to modify rows
# inherited from upstream.
#
# process_col_defaults.pl reads the catalog headers, and creates a modified
# source file (postgres_bki_srcs) that has all the defaults injected into
# the DATA rows. That is fed to genbki.sh, instead of the original headers.
postgres_bki_srcs: process_col_defaults.pl $(POSTGRES_BKI_SRCS)
	cat $(POSTGRES_BKI_SRCS) | $(PERL) process_col_defaults.pl > postgres_bki_srcs

90 91
$(CATALOG_JSON): process_foreign_keys.pl $(POSTGRES_BKI_SRCS) $(top_srcdir)/src/include/catalog/catversion.h
	cat $(POSTGRES_BKI_SRCS) $(top_srcdir)/src/include/catalog/catversion.h | $(PERL) process_foreign_keys.pl > $@
H
Heikki Linnakangas 已提交
92

93
postgres.bki: genbki.sh postgres_bki_srcs $(top_srcdir)/src/include/pg_config_manual.h
94
	AWK='$(AWK)' $(SHELL) $< $(pg_includes) --set-version=$(PG_VERSION) -o postgres postgres_bki_srcs
95

96 97
.PHONY: install-data
install-data: $(BKIFILES) installdirs
98 99 100
	$(INSTALL_DATA) $(call vpathsearch,postgres.bki) '$(DESTDIR)$(datadir)/postgres.bki'
	$(INSTALL_DATA) $(call vpathsearch,postgres.description) '$(DESTDIR)$(datadir)/postgres.description'
	$(INSTALL_DATA) $(call vpathsearch,postgres.shdescription) '$(DESTDIR)$(datadir)/postgres.shdescription'
101 102
	$(INSTALL_DATA) $(srcdir)/system_views.sql '$(DESTDIR)$(datadir)/system_views.sql'
	$(INSTALL_DATA) $(srcdir)/information_schema.sql '$(DESTDIR)$(datadir)/information_schema.sql'
103 104
	$(INSTALL_DATA) $(call vpathsearch,cdb_util.sql) '$(DESTDIR)$(datadir)/cdb_util.sql'
	$(INSTALL_DATA) $(call vpathsearch,cdb_schema.sql) '$(DESTDIR)$(datadir)/cdb_init.d/cdb_schema.sql'
105
	$(INSTALL_DATA) $(srcdir)/sql_features.txt '$(DESTDIR)$(datadir)/sql_features.txt'
106
	$(INSTALL_DATA) $(call vpathsearch,gp_toolkit.sql) '$(DESTDIR)$(datadir)/cdb_init.d/gp_toolkit.sql'
107 108

installdirs:
109
	$(MKDIR_P) '$(DESTDIR)$(datadir)'
110

111 112
.PHONY: uninstall-data
uninstall-data:
113
	rm -f $(addprefix '$(DESTDIR)$(datadir)'/, $(BKIFILES) system_views.sql information_schema.sql cdb_init.d/cdb_schema.sql sql_features.txt)
114

115
# postgres_bki_srcs is in the distribution tarball, so it is not cleaned here.
116
clean:
117
	rm -f $(BKIFILES)
118 119 120

maintainer-clean: clean
	rm -f postgres_bki_srcs