Define BIN_NAME for windows

This commit is contained in:
Arnaud 2025-10-15 08:24:14 +02:00
parent 3f60ad501b
commit 3dd812b407
No known key found for this signature in database
GPG Key ID: 20E40A5D3110766F

View File

@ -12,6 +12,12 @@ else
CGO_LDFLAGS := -L$(LIBS_DIR) -lcodex -Wl,-rpath,$(LIBS_DIR)
endif
ifeq ($(OS),windows)
BIN_NAME := example.exe
else
BIN_NAME := example
endif
# Configuration for fetching the right binary
OS ?= "linux"
ARCH ?= "amd64"
@ -19,9 +25,6 @@ VERSION ?= "v0.0.16"
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"
# Just for the example
BIN=example
all: run
fetch:
@ -34,8 +37,8 @@ build:
CGO_ENABLED=1 CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" go build -o $(BIN) main.go
run:
./example
./$(BIN_NAME)
clean:
rm -f $(BIN)
rm -f $(BIN_NAME)
rm -Rf $(LIBS_DIR)/*