From ddd2b4e3bf7f8a16646e68f4fcc4019d0ad93ab9 Mon Sep 17 00:00:00 2001 From: Raul Marin Date: Tue, 31 Oct 2017 14:48:48 +0100 Subject: [PATCH] Makefile: Add support for PARALLEL categories --- Makefile.global | 3 +++ src/pg/Makefile | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/Makefile.global b/Makefile.global index 140d486..135571b 100644 --- a/Makefile.global +++ b/Makefile.global @@ -6,3 +6,6 @@ RELEASE_VERSION ?= $(EXTVERSION) SED = sed PIP = pip NOSETESTS = nosetests +AWK = awk +PG_CONFIG = pg_config +PG_PARALLEL := $(shell $(PG_CONFIG) --version | ($(AWK) '{$$2*=1000; if ($$2 >= 9600) print 1; else print 0;}' 2> /dev/null || echo 0)) diff --git a/src/pg/Makefile b/src/pg/Makefile index c6fe484..32f543b 100644 --- a/src/pg/Makefile +++ b/src/pg/Makefile @@ -23,6 +23,13 @@ REPLACEMENTS = -e 's/@@VERSION@@/$(EXTVERSION)/g' $(DATA): $(SOURCES_DATA) $(SED) $(REPLACEMENTS) $(SOURCES_DATA_DIR)/*.sql > $@ +ifeq ($(PG_PARALLEL), 0) +# Remove PARALLEL in aggregates and functions + $(eval TMPFILE := $(shell mktemp /tmp/$(basename $0).XXXXXXXX)) + $(SED) -e 's/PARALLEL \= [A-Z]*,/''/g' \ + -e 's/PARALLEL [A-Z]*/''/g' $@ > $(TMPFILE) + mv $(TMPFILE) $@ +endif TEST_DIR = test REGRESS = $(sort $(notdir $(basename $(wildcard $(TEST_DIR)/sql/*test.sql))))