This commit is contained in:
Arnaud 2025-10-15 12:15:38 +02:00
parent 0ed267cdb6
commit cfeeb3fc29
No known key found for this signature in database
GPG Key ID: 20E40A5D3110766F

View File

@ -1,16 +1,9 @@
# Destination folder for the downloaded libraries
LIBS_DIR := $(abspath ./libs)
UNAME_S := $(shell uname -s)
# Flags for CGO to find the headers and the shared library
ifeq ($(UNAME_S),Darwin)
CGO_CFLAGS := -I$(LIBS_DIR)
CGO_LDFLAGS := -L$(LIBS_DIR) -lcodex -Wl,-rpath,@executable_path/libs
else
CGO_CFLAGS := -I$(LIBS_DIR)
CGO_LDFLAGS := -L$(LIBS_DIR) -lcodex -Wl,-rpath,$(LIBS_DIR)
endif
CGO_CFLAGS := -I$(LIBS_DIR)
CGO_LDFLAGS := -L$(LIBS_DIR) -lcodex -Wl,-rpath,$(LIBS_DIR)
ifeq ($(OS),Windows_NT)
BIN_NAME := example.exe
@ -33,7 +26,7 @@ fetch:
unzip -o -qq $(LIBS_DIR)/codex-${OS}-${ARCH}.zip -d $(LIBS_DIR)
rm -f $(LIBS_DIR)/*.zip
ifeq ($(UNAME_S),Darwin)
install_name_tool -id @rpath/libcodex.dylib libs/libcodex.dylib
install_name_tool -id @rpath/libcodex.dylib $(LIBS_DIR)/libcodex.dylib
endif
build:
@echo "CGO_CFLAGS=$(CGO_CFLAGS)"