Files
documentdb/pg_helio_api/Makefile
T
Vinod Sridharan 0e156314f6 Merged PR 1282170: [PG16] Enable building the extension with PG16
### Does this PR have any customer impact?
No

### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Infra

### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
No

### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
Part 1: Enable building the extension and fix up pieces for building with PG16.

With this the core extension builds with PG16 and *most* of the backend tests pass. At this point, checking this in as a checkpoint (to ensure compat is retained) as more features are lit up with PG16

One thing to note is PG16 builds changes the default visibility of exports to 'private' that means that to make the current build work, we need to override that to 'default/public'. This needs to be fixed but is left as-is currently to make incremental progress.

There were some attempts to create exports in the code that are left as-is
2024-03-01 17:24:28 +03:00

91 lines
2.6 KiB
Makefile
Executable File

EXTENSION = pg_helio_api
SQL_DEPDIR=.deps/sql
SQL_BUILDDIR=build/sql
template_sql_files = $(wildcard sql/*.sql)
generated_sql_files = $(patsubst %,build/%,$(template_sql_files))
DATA_built = $(generated_sql_files)
sql_file_inputs = $(wildcard sql/**/*.sql)
BUILD_SCRIPT_DIR = ../
OSS_SRC_DIR = ../
OSS_COMMON_SQL_HEADER = $(wildcard $(OSS_SRC_DIR)/common_header.sql)
# Extension defines
API_SCHEMA_NAME=helio_api
API_SCHEMA_INTERNAL_NAME=helio_api_internal
API_CATALOG_SCHEMA_NAME=helio_api_catalog
CORE_SCHEMA_NAME=helio_core
API_DATA_SCHEMA_NAME=helio_data
API_ADMIN_ROLE=helio_admin_role
EXTENSION_OBJECT_PREFIX=helio
# compilation configuration
MODULE_big = $(EXTENSION)
include $(OSS_SRC_DIR)/Makefile.cflags
PG_CPPFLAGS += -I$(OSS_SRC_DIR)/pg_helio_core/include/
SOURCES = $(wildcard src/*.c) $(wildcard src/**/*.c)
OBJS = $(patsubst %.c,%.o,$(SOURCES))
DEBUG ?= no
ifeq ($(DEBUG),yes)
PG_CPPFLAGS += -ggdb -O0 -g
PG_CFLAGS += -ggdb -O0 -g
endif
SHLIB_LINK = $(libpq)
# clean up files generated to measure code coverage
EXTRA_CLEAN += $(addprefix src/,*.gcno *.gcda) $(addprefix src/**/,*.gcno *.gcda)
EXTRA_CLEAN += build/ .deps/
PG_CONFIG ?= pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
ifeq ($(ALLOW_DEFAULT_VISIBILITY),yes)
override LDFLAGS_SL += -fvisibility=default
override CFLAGS += -fvisibility=default
override CXXFLAGS += -fvisibility=default
endif
clean-sql:
rm -rf .deps/ build/
check:
$(MAKE) -C src/test all
citus-indent:
citus_indent
analysis: citus-indent
check-regress:
$(MAKE) -C src/test check-regress
# Before installing, trim any files extension*.sql files in the target install directory
install: trim_installed_data_files
trim_installed_data_files:
rm -f $(DESTDIR)$(datadir)/$(datamoduledir)/$(EXTENSION)--*.sql
build-sql: $(generated_sql_files)
$(generated_sql_files): build/%: %
@mkdir -p $(SQL_DEPDIR) $(SQL_BUILDDIR)
@# -MF is used to store dependency files(.Po) in another directory for separation
@# -MT is used to change the target of the rule emitted by dependency generation.
@# -P is used to inhibit generation of linemarkers in the output from the preprocessor.
@# -undef is used to not predefine any system-specific or GCC-specific macros.
@# -imacros is used to specify a file that defines macros for the global context but its output is thrown away.
@# `man cpp` for further information
cpp -undef -w $(SQL_DEFINES) -imacros $(OSS_COMMON_SQL_HEADER) -P -MMD -MP -MF$(SQL_DEPDIR)/$(*F).Po -MT$@ $< > $@
include $(OSS_SRC_DIR)/Makefile.versions
src/helio_api_extension_version.o : build/include/metadata/extension_version.h