Skip to content

Commit

Permalink
linux compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexR2D2 committed Feb 20, 2023
1 parent 033494e commit 8b31ddf
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,20 @@ PRIV_DIR = $(MIX_APP_PATH)/priv
LIB_NAME = $(PRIV_DIR)/duckdb_nif.so

ifneq ($(CROSSCOMPILE),)
LIB_CXXFLAGS := -shared -fPIC -fvisibility=hidden
SO_LDFLAGS := -Wl,-soname,libduckdb.so.0
CXXFLAGS += -fPIC -fvisibility=hidden
LDFLAGS += -fPIC -shared
else
ifeq ($(KERNEL_NAME), Linux)
LIB_CXXFLAGS := -shared -fPIC -fvisibility=hidden
SO_LDFLAGS := -Wl,-soname,libduckdb.so.0
CXXFLAGS += -fPIC -fvisibility=hidden
LDFLAGS += -fPIC -shared
endif
ifeq ($(KERNEL_NAME), Darwin)
LIB_CXXFLAGS := -dynamiclib -undefined dynamic_lookup
CXXFLAGS += -fPIC
LDFLAGS += -dynamiclib -undefined dynamic_lookup
endif
ifeq ($(KERNEL_NAME), $(filter $(KERNEL_NAME),OpenBSD FreeBSD NetBSD))
LIB_CXXFLAGS := -shared -fPIC
CXXFLAGS += -fPIC
LDFLAGS += -fPIC -shared
endif
endif

Expand All @@ -51,7 +53,7 @@ $(PRIV_DIR)/%.o: $(SRC_DIR)/%.cpp | $$(@D)/.
$(CXX) $(CXXFLAGS) -c $< -o $@

$(LIB_NAME): $(OBJ)
$(CXX) $(CXXFLAGS) $(LIB_CXXFLAGS) $(SO_LDFLAGS) $^ -o $@
$(CXX) $(LDFLAGS) $^ -o $@

all: $(PRIV_DIR) $(SRC) $(LIB_NAME)

Expand Down

0 comments on commit 8b31ddf

Please sign in to comment.