forked from duckdb/pg_duckdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
107 lines (79 loc) · 2.88 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
97
98
99
100
101
102
103
104
105
106
107
.PHONY: duckdb install-duckdb clean-duckdb lintcheck check-regression-duckdb clean-regression .depend
MODULE_big = pg_duckdb
EXTENSION = pg_duckdb
DATA = pg_duckdb.control $(wildcard sql/pg_duckdb--*.sql)
SRCS = src/scan/heap_reader.cpp \
src/scan/index_scan_utils.cpp \
src/scan/postgres_index_scan.cpp \
src/scan/postgres_scan.cpp \
src/scan/postgres_seq_scan.cpp \
src/utility/copy.cpp \
src/vendor/pg_explain.cpp \
src/pgduckdb_metadata_cache.cpp \
src/pgduckdb_detoast.cpp \
src/pgduckdb_duckdb.cpp \
src/pgduckdb_filter.cpp \
src/pgduckdb_hooks.cpp \
src/pgduckdb_memory_allocator.cpp \
src/pgduckdb_node.cpp \
src/pgduckdb_options.cpp \
src/pgduckdb_planner.cpp \
src/pgduckdb_types.cpp \
src/pgduckdb.cpp
OBJS = $(subst .cpp,.o, $(SRCS))
DUCKDB_BUILD_CXX_FLAGS=
DUCKDB_BUILD_TYPE=
ifeq ($(DUCKDB_BUILD), Debug)
DUCKDB_BUILD_CXX_FLAGS = -g -O0
DUCKDB_BUILD_TYPE = debug
else
DUCKDB_BUILD_CXX_FLAGS =
DUCKDB_BUILD_TYPE = release
endif
override PG_CPPFLAGS += -Iinclude -Ithird_party/duckdb/src/include -Ithird_party/duckdb/third_party/re2 -std=c++17 -Wno-sign-compare ${DUCKDB_BUILD_CXX_FLAGS}
SHLIB_LINK += -Wl,-rpath,$(PG_LIB)/ -lpq -L$(PG_LIB) -lduckdb -Lthird_party/duckdb/build/$(DUCKDB_BUILD_TYPE)/src -lstdc++ -llz4
COMPILE.cc.bc = $(CXX) -Wno-ignored-attributes -Wno-register $(BITCODE_CXXFLAGS) $(CXXFLAGS) $(PG_CPPFLAGS) -I$(INCLUDEDIR_SERVER) -emit-llvm -c
%.bc : %.cpp
$(COMPILE.cc.bc) $(SHLIB_LINK) $(PG_CPPFLAGS) -I$(INCLUDE_SERVER) -o $@ $<
# determine the name of the duckdb library that is built
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
DUCKDB_LIB = libduckdb.dylib
endif
ifeq ($(UNAME_S),Linux)
DUCKDB_LIB = libduckdb.so
endif
all: duckdb $(OBJS) .depend
include Makefile.global
NO_INSTALLCHECK = 1
check-regression-duckdb:
$(MAKE) -C test/regression check-regression-duckdb
clean-regression:
$(MAKE) -C test/regression clean-regression
installcheck: all install
$(MAKE) check-regression-duckdb
FULL_DUCKDB_LIB = third_party/duckdb/build/$(DUCKDB_BUILD_TYPE)/src/$(DUCKDB_LIB)
duckdb: third_party/duckdb/Makefile $(FULL_DUCKDB_LIB)
third_party/duckdb/Makefile:
git submodule update --init --recursive
$(FULL_DUCKDB_LIB):
$(MAKE) -C third_party/duckdb \
$(DUCKDB_BUILD_TYPE) \
DISABLE_SANITIZER=1 \
ENABLE_UBSAN=0 \
BUILD_UNITTESTS=OFF \
EXTENSION_CONFIGS="../pg_duckdb_extensions.cmake"
install-duckdb: $(FULL_DUCKDB_LIB)
$(install_bin) -m 755 $(FULL_DUCKDB_LIB) $(DESTDIR)$(PG_LIB)
clean-duckdb:
rm -rf third_party/duckdb/build
install: install-duckdb
clean: clean-regression clean-duckdb
lintcheck:
clang-tidy $(SRCS) -- -I$(INCLUDEDIR) -I$(INCLUDEDIR_SERVER) -Iinclude $(CPPFLAGS) -std=c++17
.depend:
$(RM) -f .depend
$(foreach SRC,$(SRCS),$(CXX) $(CPPFLAGS) -I$(INCLUDEDIR) -I$(INCLUDEDIR_SERVER) -MM -MT $(SRC:.cpp=.o) $(SRC) >> .depend;)
format:
git clang-format origin/main
include .depend