better makefile

merge-cstore-pykello
Jeff Davis 2020-09-16 10:42:32 -07:00
parent 3b3d1b1f89
commit ec8afe0a5d
5 changed files with 53 additions and 20 deletions

View File

@ -5,8 +5,26 @@
MODULE_big = cstore_fdw MODULE_big = cstore_fdw
VER := $(lastword $(shell pg_config --version))
VER_WORDS = $(subst ., ,$(VER))
# versions prior to 10 (those with 3 version numbers) not supported
ifeq ($(words $(VER_WORDS)),3)
$(error version $(VER) not supported)
endif
MVER = $(firstword $(VER_WORDS))
ifeq ($(lastword $(sort 12 $(MVER))),$(MVER))
USE_TABLEAM = yes
USE_FDW = yes
else
USE_TABLEAM = no
USE_FDW = yes
endif
PG_CPPFLAGS = -std=c11 PG_CPPFLAGS = -std=c11
OBJS = cstore.o cstore_fdw.o cstore_writer.o cstore_reader.o \ OBJS = cstore.o cstore_writer.o cstore_reader.o \
cstore_compression.o mod.o cstore_metadata_tables.o cstore_compression.o mod.o cstore_metadata_tables.o
EXTENSION = cstore_fdw EXTENSION = cstore_fdw
@ -14,24 +32,27 @@ DATA = cstore_fdw--1.7.sql cstore_fdw--1.6--1.7.sql cstore_fdw--1.5--1.6.sql cs
cstore_fdw--1.3--1.4.sql cstore_fdw--1.2--1.3.sql cstore_fdw--1.1--1.2.sql \ cstore_fdw--1.3--1.4.sql cstore_fdw--1.2--1.3.sql cstore_fdw--1.1--1.2.sql \
cstore_fdw--1.0--1.1.sql cstore_fdw--1.7--1.8.sql cstore_fdw--1.0--1.1.sql cstore_fdw--1.7--1.8.sql
#
# disabled tests: am_block_filtering am_analyze am_alter
#
REGRESS = extension_create REGRESS = extension_create
EXTRA_CLEAN = cstore.pb-c.h cstore.pb-c.c data/*.cstore data/*.cstore.footer \ EXTRA_CLEAN = cstore.pb-c.h cstore.pb-c.c data/*.cstore data/*.cstore.footer \
sql/block_filtering.sql sql/create.sql sql/data_types.sql sql/load.sql \ sql/block_filtering.sql sql/create.sql sql/data_types.sql sql/load.sql \
sql/copyto.sql expected/block_filtering.out expected/create.out \ sql/copyto.sql expected/block_filtering.out expected/create.out \
expected/data_types.out expected/load.out expected/copyto.out expected/data_types.out expected/load.out expected/copyto.out
VER := $(shell pg_config --version) ifeq ($(USE_FDW),yes)
ifeq ($(findstring 12,$(VER)),12) PG_CFLAGS += -DUSE_FDW
REGRESS += am_create am_load am_query am_data_types am_functions \ OBJS += cstore_fdw.o
am_drop am_insert am_copyto am_truncate clean REGRESS += fdw_create fdw_load fdw_query fdw_analyze fdw_data_types \
OBJS += cstore_tableam.o fdw_functions fdw_block_filtering fdw_drop fdw_insert \
fdw_copyto fdw_alter fdw_truncate fdw_clean
endif endif
REGRESS += fdw_create fdw_load fdw_query fdw_analyze fdw_data_types fdw_functions \ # disabled tests: am_block_filtering am_analyze am_alter
fdw_block_filtering fdw_drop fdw_insert fdw_copyto fdw_alter fdw_truncate ifeq ($(USE_TABLEAM),yes)
PG_CFLAGS += -DUSE_TABLEAM
OBJS += cstore_tableam.o
REGRESS += am_create am_load am_query am_data_types am_functions \
am_drop am_insert am_copyto am_truncate am_clean
endif
ifeq ($(enable_coverage),yes) ifeq ($(enable_coverage),yes)
PG_CPPFLAGS += --coverage PG_CPPFLAGS += --coverage
@ -53,14 +74,6 @@ PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs) PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS) include $(PGXS)
ifndef MAJORVERSION
MAJORVERSION := $(basename $(VERSION))
endif
ifeq (,$(findstring $(MAJORVERSION), 9.3 9.4 9.5 9.6 10 11 12))
$(error PostgreSQL 9.3 to 12 is required to compile this extension)
endif
installcheck: remove_cstore_files installcheck: remove_cstore_files
remove_cstore_files: remove_cstore_files:

10
expected/fdw_clean.out Normal file
View File

@ -0,0 +1,10 @@
DROP FOREIGN TABLE collation_block_filtering_test;
DROP FOREIGN TABLE test_block_filtering;
DROP FOREIGN TABLE test_null_values;
DROP FOREIGN TABLE test_other_types;
DROP FOREIGN TABLE test_range_types;
DROP FOREIGN TABLE test_enum_and_composite_types;
DROP TYPE composite_type;
DROP TYPE enum_type;
DROP FOREIGN TABLE test_datetime_types;
DROP FOREIGN TABLE test_array_types;

10
sql/fdw_clean.sql Normal file
View File

@ -0,0 +1,10 @@
DROP FOREIGN TABLE collation_block_filtering_test;
DROP FOREIGN TABLE test_block_filtering;
DROP FOREIGN TABLE test_null_values;
DROP FOREIGN TABLE test_other_types;
DROP FOREIGN TABLE test_range_types;
DROP FOREIGN TABLE test_enum_and_composite_types;
DROP TYPE composite_type;
DROP TYPE enum_type;
DROP FOREIGN TABLE test_datetime_types;
DROP FOREIGN TABLE test_array_types;