forked from Mooncake-Labs/pg_mooncake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.build
90 lines (77 loc) · 2.57 KB
/
Makefile.build
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
# ========================
# Shared Variables
# ========================
DUCKDB_DIR := ../../third_party/duckdb
EXTENSION_NAME := pg_mooncake
SQL_DIR := ../../sql
SRC_DIR := ../../src
TEST_DIR := ../../test
# ========================
# Postgres Setup
# ========================
PG_CONFIG ?= pg_config
PG_LIB_DIR := $(shell $(PG_CONFIG) --pkglibdir)
# ========================
# Source Files
# ========================
SRCS_C := $(shell cd $(SRC_DIR); find * -name '*.c')
SRCS_CXX := $(shell cd $(SRC_DIR); find * -name '*.cpp')
SRCS := $(SRCS_C) $(SRCS_CXX) thrift/transport/TBufferTransports.cpp
OBJS := $(SRCS:%=%.o) libduckdb.so libdelta.a
DEPS := $(SRCS:%=%.d)
# ========================
# Regression Tests
# ========================
REGRESS_SQL := $(shell cd $(TEST_DIR)/sql; find * -name '*.sql')
REGRESS := $(REGRESS_SQL:%.sql=%)
REGRESS_OPTS = --inputdir=$(TEST_DIR) --load-extension=$(EXTENSION_NAME)
# ========================
# Compilation Flags
# ========================
PG_CPPFLAGS := -I$(SRC_DIR) \
-I$(DUCKDB_DIR)/extension/parquet/include \
-I$(DUCKDB_DIR)/src/include \
-I$(DUCKDB_DIR)/third_party/parquet \
-I$(DUCKDB_DIR)/third_party/thrift \
-I../src \
-MMD -MP
PG_CFLAGS := $(if $(DEBUG),-ggdb3 -O0,-O2)
PG_CXXFLAGS := $(if $(DEBUG),-ggdb3 -O0,-O2) -Werror -Wno-register -Wno-sign-compare -std=c++17
SHLIB_LINK := -L. -Wl,-rpath,$(PG_LIB_DIR) -lduckdb -lstdc++
# ========================
# PGXS Configuration
# ========================
MODULES := libduckdb
MODULE_big := $(EXTENSION_NAME)
DATA := $(SQL_DIR)/pg_mooncake--0.0.1.sql
EXTENSION := ../../$(EXTENSION_NAME)
PGXS := $(shell $(PG_CONFIG) --pgxs)
override with_llvm := no
include $(PGXS)
# ========================
# Phony Targets
# ========================
.PHONY: installcheck-dirs
# ========================
# Compilation Rules
# ========================
$(SRCS_C:%=%.o): %.o: $(SRC_DIR)/%
@mkdir -p $(dir $@)
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
$(SRCS_CXX:%=%.o): %.o: $(SRC_DIR)/%
@mkdir -p $(dir $@)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
thrift/transport/TBufferTransports.cpp.o: ../../third_party/duckdb/third_party/thrift/thrift/transport/TBufferTransports.cpp
@mkdir -p $(dir $@)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
# ========================
# Regression Testing
# ========================
installcheck: installcheck-dirs
installcheck-dirs: $(addprefix results/, $(sort $(dir $(REGRESS))))
results/%:
@mkdir -p $@
# ========================
# Include Dependency Files
# ========================
-include $(DEPS)