mirror of
https://github.com/neondatabase/neon.git
synced 2025-12-22 21:59:59 +00:00
Refactor Makefile rules for building the extensions under pgxn/ (#12305)
This commit is contained in:
committed by
GitHub
parent
af46b5286f
commit
3d822dbbde
28
Makefile
28
Makefile
@@ -176,31 +176,11 @@ postgres-check-%: postgres-%
|
||||
|
||||
.PHONY: neon-pg-ext-%
|
||||
neon-pg-ext-%: postgres-%
|
||||
+@echo "Compiling neon $*"
|
||||
mkdir -p $(BUILD_DIR)/neon-$*
|
||||
+@echo "Compiling neon-specific Postgres extensions for $*"
|
||||
mkdir -p $(BUILD_DIR)/pgxn-$*
|
||||
$(MAKE) PG_CONFIG=$(POSTGRES_INSTALL_DIR)/$*/bin/pg_config COPT='$(COPT)' \
|
||||
-C $(BUILD_DIR)/neon-$* \
|
||||
-f $(ROOT_PROJECT_DIR)/pgxn/neon/Makefile install
|
||||
+@echo "Compiling neon_walredo $*"
|
||||
mkdir -p $(BUILD_DIR)/neon-walredo-$*
|
||||
$(MAKE) PG_CONFIG=$(POSTGRES_INSTALL_DIR)/$*/bin/pg_config COPT='$(COPT)' \
|
||||
-C $(BUILD_DIR)/neon-walredo-$* \
|
||||
-f $(ROOT_PROJECT_DIR)/pgxn/neon_walredo/Makefile install
|
||||
+@echo "Compiling neon_rmgr $*"
|
||||
mkdir -p $(BUILD_DIR)/neon-rmgr-$*
|
||||
$(MAKE) PG_CONFIG=$(POSTGRES_INSTALL_DIR)/$*/bin/pg_config COPT='$(COPT)' \
|
||||
-C $(BUILD_DIR)/neon-rmgr-$* \
|
||||
-f $(ROOT_PROJECT_DIR)/pgxn/neon_rmgr/Makefile install
|
||||
+@echo "Compiling neon_test_utils $*"
|
||||
mkdir -p $(BUILD_DIR)/neon-test-utils-$*
|
||||
$(MAKE) PG_CONFIG=$(POSTGRES_INSTALL_DIR)/$*/bin/pg_config COPT='$(COPT)' \
|
||||
-C $(BUILD_DIR)/neon-test-utils-$* \
|
||||
-f $(ROOT_PROJECT_DIR)/pgxn/neon_test_utils/Makefile install
|
||||
+@echo "Compiling neon_utils $*"
|
||||
mkdir -p $(BUILD_DIR)/neon-utils-$*
|
||||
$(MAKE) PG_CONFIG=$(POSTGRES_INSTALL_DIR)/$*/bin/pg_config COPT='$(COPT)' \
|
||||
-C $(BUILD_DIR)/neon-utils-$* \
|
||||
-f $(ROOT_PROJECT_DIR)/pgxn/neon_utils/Makefile install
|
||||
-C $(BUILD_DIR)/pgxn-$*\
|
||||
-f $(ROOT_PROJECT_DIR)/pgxn/Makefile install
|
||||
|
||||
# Build walproposer as a static library. walproposer source code is located
|
||||
# in the pgxn/neon directory.
|
||||
|
||||
@@ -1634,18 +1634,7 @@ FROM pg-build AS neon-ext-build
|
||||
ARG PG_VERSION
|
||||
|
||||
COPY pgxn/ pgxn/
|
||||
RUN make -j $(getconf _NPROCESSORS_ONLN) \
|
||||
-C pgxn/neon \
|
||||
-s install && \
|
||||
make -j $(getconf _NPROCESSORS_ONLN) \
|
||||
-C pgxn/neon_utils \
|
||||
-s install && \
|
||||
make -j $(getconf _NPROCESSORS_ONLN) \
|
||||
-C pgxn/neon_test_utils \
|
||||
-s install && \
|
||||
make -j $(getconf _NPROCESSORS_ONLN) \
|
||||
-C pgxn/neon_rmgr \
|
||||
-s install
|
||||
RUN make -j $(getconf _NPROCESSORS_ONLN) -C pgxn -s install-compute
|
||||
|
||||
#########################################################################################
|
||||
#
|
||||
|
||||
28
pgxn/Makefile
Normal file
28
pgxn/Makefile
Normal file
@@ -0,0 +1,28 @@
|
||||
# This makefile assumes that 'pg_config' is in the path, or is passed in the
|
||||
# PG_CONFIG variable.
|
||||
#
|
||||
# This is used in two different ways:
|
||||
#
|
||||
# 1. The main makefile calls this, when you invoke the `make neon-pg-ext-%`
|
||||
# target. It passes PG_CONFIG pointing to pg_install/%/bin/pg_config.
|
||||
# This is a VPATH build; the current directory is build/pgxn-%, and
|
||||
# the path to the Makefile is passed with the -f argument.
|
||||
#
|
||||
# 2. compute-node.Dockerfile invokes this to build the compute extensions
|
||||
# for the specific Postgres version. It relies on pg_config already
|
||||
# being in $(PATH).
|
||||
|
||||
srcdir = $(dir $(firstword $(MAKEFILE_LIST)))
|
||||
|
||||
PG_CONFIG = pg_config
|
||||
|
||||
subdirs = neon neon_rmgr neon_walredo neon_utils neon_test_utils
|
||||
|
||||
.PHONY: install install-compute install-storage $(subdirs)
|
||||
install: $(subdirs)
|
||||
install-compute: neon neon_utils neon_test_utils neon_rmgr
|
||||
install-storage: neon_rmgr neon_walredo
|
||||
|
||||
$(subdirs): %:
|
||||
mkdir -p $*
|
||||
$(MAKE) PG_CONFIG=$(PG_CONFIG) -C $* -f $(abspath $(srcdir)/$@/Makefile) install
|
||||
Reference in New Issue
Block a user