-
Notifications
You must be signed in to change notification settings - Fork 23
/
Makefile
96 lines (79 loc) · 2.91 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
######################################################################-------------------------------------------------------------------------
#
# DuckDB Foreign Data Wrapper for PostgreSQL
#
# Portions Copyright (c) 2021, TOSHIBA CORPORATION
#
# IDENTIFICATION
# Makefile
#
##########################################################################
# Check if DUCKDB_VERSION is defined
ifeq ($(DUCKDB_VERSION),)
# Try to read from .duckdb_version file
-include .duckdb_version
# If still not defined, try to get from environment
ifndef DUCKDB_VERSION
$(error DUCKDB_VERSION is not set. Please set it using: make DUCKDB_VERSION=x.x.x or create a .duckdb_version file)
endif
endif
MODULE_big = duckdb_fdw
OBJS = connection.o option.o deparse.o sqlite_query.o duckdb_fdw.o sqlite3_api_wrapper.o
EXTENSION = duckdb_fdw
DATA = duckdb_fdw--1.0.0.sql duckdb_fdw--1.0.0--1.1.2.sql duckdb_fdw--1.1.2--1.1.3.sql
REGRESS = extra/duckdb_fdw_post extra/float4 extra/float8 extra/int4 extra/int8 extra/numeric extra/join extra/limit extra/aggregates extra/prepare extra/select_having extra/select extra/insert extra/update extra/timestamp duckdb_fdw type aggregate selectfunc
ifeq '$(findstring ;,$(PATH))' ';'
detected_OS := Windows
else
detected_OS := $(shell uname 2>/dev/null || echo Unknown)
detected_OS := $(patsubst CYGWIN%,Cygwin,$(detected_OS))
detected_OS := $(patsubst MSYS%,MSYS,$(detected_OS))
detected_OS := $(patsubst MINGW%,MSYS,$(detected_OS))
endif
ifeq ($(detected_OS),Windows)
DLSUFFIX = .dll
endif
ifeq ($(detected_OS),Darwin) # Mac OS X
DLSUFFIX = .dylib
PG_CXXFLAGS = -std=c++11
endif
ifeq ($(detected_OS),Linux)
# DLSUFFIX = .so
PG_CXXFLAGS = -std=c++11
detected_arch := $(shell uname -m)
ifeq ($(detected_arch),x86_64)
PG_CXXFLAGS = -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0
endif
endif
SHLIB_LINK := -L. -lduckdb.$(DUCKDB_VERSION) -lstdc++
ifdef USE_PGXS
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
PG_LIB := $(shell $(PG_CONFIG) --pkglibdir)
VERSION := $(shell $(PG_CONFIG) --version)
include $(PGXS)
ifndef MAJORVERSION
MAJORVERSION := $(basename $(VERSION))
endif
ifeq (,$(findstring $(MAJORVERSION), 10 11 12 13 14 15 16 17))
$(error PostgreSQL 10, 11, 12, 13, 14, 15, 16 or 17 is required to compile this extension)
endif
else
subdir = contrib/duckdb_fdw
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
endif
ifdef REGRESS_PREFIX
REGRESS_PREFIX_SUB = $(REGRESS_PREFIX)
else
REGRESS_PREFIX_SUB = $(VERSION)
endif
REGRESS := $(addprefix $(REGRESS_PREFIX_SUB)/,$(REGRESS))
$(shell mkdir -p results/$(REGRESS_PREFIX_SUB)/extra)
install-duckdb: $(shlib)
$(install_bin) -m 755 libduckdb.$(DUCKDB_VERSION)$(DLSUFFIX) $(DESTDIR)$(PG_LIB)
install: install-duckdb
uninstall-duckdb:
rm -f $(DESTDIR)$(PG_LIB)/libduckdb.$(DUCKDB_VERSION)$(DLSUFFIX)
uninstall: uninstall-duckdb