Update makefile

This commit is contained in:
Arnaud 2025-10-15 14:56:54 +02:00
parent 6d23c70508
commit 9ce61c2fcf
No known key found for this signature in database
GPG Key ID: 20E40A5D3110766F

View File

@ -1,8 +1,8 @@
# 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
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
CGO_CFLAGS := -I$(LIBS_DIR)
CGO_LDFLAGS := -L$(LIBS_DIR) -lcodex -Wl,-rpath,@executable_path/libs
@ -21,14 +21,17 @@ endif
OS ?= "linux"
ARCH ?= "amd64"
VERSION ?= "v0.0.17"
LATEST_URL := "https://github.com/codex-storage/codex-go-bindings/releases/latest/download/codex-${OS}-${ARCH}.zip"
VERSIONED_URL := "https://github.com/codex-storage/codex-go-bindings/releases/download/$(VERSION)/codex-${OS}-${ARCH}.zip"
DOWNLOAD_URL ?= "https://github.com/codex-storage/codex-go-bindings/releases/latest/download/codex-${OS}-${ARCH}.zip"
ifneq ($(VERSION),)
DOWNLOAD_URL := "https://github.com/codex-storage/codex-go-bindings/releases/download/$(VERSION)/codex-${OS}-${ARCH}.zip"
endif
all: run
fetch:
@echo "Fetching libcodex from GitHub Actions: ${LATEST_URL}"
curl -fSL --create-dirs -o $(LIBS_DIR)/codex-${OS}-${ARCH}.zip ${LATEST_URL}
@echo "Fetching libcodex from GitHub Actions from: ${DOWNLOAD_URL}"
curl -fSL --create-dirs -o $(LIBS_DIR)/codex-${OS}-${ARCH}.zip ${DOWNLOAD_URL}
unzip -o -qq $(LIBS_DIR)/codex-${OS}-${ARCH}.zip -d $(LIBS_DIR)
rm -f $(LIBS_DIR)/*.zip
# Update the path to the shared library on macOS