Skip to content

Commit

Permalink
compiling duckdb
Browse files Browse the repository at this point in the history
  • Loading branch information
Tishj committed Apr 10, 2024
1 parent d9cacf0 commit fb3b0a4
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,16 @@ PG_CONFIG ?= pg_config

PGXS := $(shell $(PG_CONFIG) --pgxs)
PG_LIB := $(shell $(PG_CONFIG) --pkglibdir)
PG_CPPFLAGS := -Iinclude -Ithird_party/duckdb/src/include -std=c++17
SHLIB_LINK += -Wl,-rpath,$(PG_LIB)/ -L$(PG_LIB) -lduckdb -Lthird_party/build/src -lc++

DEBUG_FLAGS = -g -O0
override PG_CPPFLAGS += $(DEBUG_FLAGS) -Iinclude -Ithird_party/duckdb/src/include -std=c++17

SHLIB_LINK += -Wl,-rpath,$(PG_LIB)/ -lpq -L$(PG_LIB) -lduckdb -Lthird_party/duckdb/build/debug/src -lstdc++

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)
Expand All @@ -34,20 +42,16 @@ all: duckdb $(OBJS)

include $(PGXS)

duckdb: third_party/duckdb third_party/build/src/$(DUCKDB_LIB)
duckdb: third_party/duckdb third_party/duckdb/build/debug/src/$(DUCKDB_LIB)

third_party/duckdb:
git submodule update --init --recursive

third_party/build/src/$(DUCKDB_LIB):
cd third_party && \
mkdir build && \
cd build && \
cmake ../duckdb && \
make
third_party/duckdb/build/debug/src/$(DUCKDB_LIB):
$(MAKE) -C third_party/duckdb debug

install_duckdb:
$(install_bin) -m 755 third_party/build/src/$(DUCKDB_LIB) $(DESTDIR)$(PG_LIB)
$(install_bin) -m 755 third_party/duckdb/build/debug/src/$(DUCKDB_LIB) $(DESTDIR)$(PG_LIB)


install: install_duckdb

0 comments on commit fb3b0a4

Please sign in to comment.