2025-04-16 18:38:09 +03:00
|
|
|
# Makefile for SDS Go Bindings
|
2025-04-09 18:20:28 +03:00
|
|
|
|
2025-10-22 00:49:05 +02:00
|
|
|
# The NIM_SDS_LIB_PATH and NIM_SDS_HEADER_PATH env vars should be defined beforehand
|
2025-11-25 17:00:43 +01:00
|
|
|
# Therefore, we assume the libsds library and headers are located in the specified paths
|
2025-10-22 00:49:05 +02:00
|
|
|
export CGO_CFLAGS="-I${NIM_SDS_HEADER_PATH}/"
|
|
|
|
|
export CGO_LDFLAGS="-L${NIM_SDS_LIB_PATH}/ -lsds -Wl,-rpath,${NIM_SDS_LIB_PATH}/"
|
2025-10-20 23:29:00 +02:00
|
|
|
|
2025-11-25 17:00:43 +01:00
|
|
|
# Expected files
|
|
|
|
|
HEADER_FILE := $(NIM_SDS_HEADER_PATH)/libsds.h
|
|
|
|
|
LIB_FILES := $(wildcard $(NIM_SDS_LIB_PATH)/libsds.*)
|
|
|
|
|
|
2025-04-09 18:20:28 +03:00
|
|
|
.PHONY: all clean prepare build-libsds build
|
|
|
|
|
|
|
|
|
|
# Default target
|
|
|
|
|
all: build
|
|
|
|
|
|
2025-11-25 17:00:43 +01:00
|
|
|
# Validate necessary folders and files
|
|
|
|
|
check-folders:
|
|
|
|
|
@echo Checking header directory ...
|
|
|
|
|
@if [ -z "$(NIM_SDS_HEADER_PATH)" ]; then \
|
|
|
|
|
echo "ERROR: NIM_SDS_HEADER_PATH not set"; exit 1; \
|
|
|
|
|
fi
|
|
|
|
|
@if [ ! -d "$(NIM_SDS_HEADER_PATH)" ]; then \
|
|
|
|
|
echo "ERROR: Header path does not exist: $(NIM_SDS_HEADER_PATH)"; exit 1; \
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
@echo Checking lib directory ...
|
|
|
|
|
@if [ -z "$(NIM_SDS_LIB_PATH)" ]; then \
|
|
|
|
|
echo "ERROR: NIM_SDS_LIB_PATH not set"; exit 1; \
|
|
|
|
|
fi
|
|
|
|
|
@if [ ! -d "$(NIM_SDS_LIB_PATH)" ]; then \
|
|
|
|
|
echo "ERROR: Library path does not exist: $(NIM_SDS_LIB_PATH)"; exit 1; \
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
@echo Checking for libsds.h ...
|
|
|
|
|
@if [ ! -f "$(HEADER_FILE)" ]; then \
|
|
|
|
|
echo "ERROR: libsds.h not found at: $(HEADER_FILE)"; exit 1; \
|
2025-04-09 18:20:28 +03:00
|
|
|
fi
|
|
|
|
|
|
2025-11-25 17:00:43 +01:00
|
|
|
@echo Checking for libsds library file ...
|
|
|
|
|
@if [ -z "$(LIB_FILES)" ]; then \
|
|
|
|
|
echo "ERROR: No libsds library file found in: $(NIM_SDS_LIB_PATH)"; exit 1; \
|
|
|
|
|
fi
|
2025-10-23 01:15:54 +02:00
|
|
|
|
2025-08-25 17:06:04 +02:00
|
|
|
# Build SDS Go Bindings
|
2025-11-25 17:00:43 +01:00
|
|
|
build: check-folders
|
2025-08-25 17:06:04 +02:00
|
|
|
@echo "Building SDS Go Bindings..."
|
|
|
|
|
go build ./...
|
2025-04-09 18:20:28 +03:00
|
|
|
|
|
|
|
|
# Clean up generated files
|
|
|
|
|
clean:
|
|
|
|
|
@echo "Cleaning up..."
|
2025-08-25 17:06:04 +02:00
|
|
|
@rm -f sds-go-bindings
|