2026-08-23 11:39:58 +01:00
|
|
|
# Makefile for the kernel bindings. The root Makefile is the usual entry point;
|
|
|
|
|
# this one exists for building and testing just this package.
|
2024-11-27 12:08:50 +02:00
|
|
|
|
2026-08-23 11:39:58 +01:00
|
|
|
NIMBLE ?= nimble
|
|
|
|
|
|
|
|
|
|
# Resolved by Nimble, not vendored.
|
|
|
|
|
export LOGOS_DELIVERY_DIR ?= $(shell $(NIMBLE) path logos_delivery 2>/dev/null | tail -1)
|
2025-12-23 01:46:21 +05:30
|
|
|
|
|
|
|
|
# Debugging output
|
|
|
|
|
print-paths:
|
2026-06-09 23:04:57 +01:00
|
|
|
@echo "LOGOS_DELIVERY_DIR: $(LOGOS_DELIVERY_DIR)"
|
2026-08-23 11:39:58 +01:00
|
|
|
@echo "HEADER_PATH: $(LOGOS_DELIVERY_HEADER_PATH)"
|
|
|
|
|
@echo "LIB_PATH: $(LOGOS_DELIVERY_LIB_PATH)"
|
2025-12-16 17:15:06 +05:30
|
|
|
|
2026-08-23 11:39:58 +01:00
|
|
|
# Default paths for the library and headers (can be overridden)
|
|
|
|
|
export LOGOS_DELIVERY_HEADER_PATH ?= $(LOGOS_DELIVERY_DIR)/library
|
|
|
|
|
export LOGOS_DELIVERY_LIB_PATH ?= $(CURDIR)/../../build
|
2025-12-16 17:15:06 +05:30
|
|
|
|
2026-08-23 11:39:58 +01:00
|
|
|
export CGO_CFLAGS := -I$(LOGOS_DELIVERY_HEADER_PATH)/
|
|
|
|
|
export CGO_LDFLAGS := -L$(LOGOS_DELIVERY_LIB_PATH)/ -llogosdelivery -Wl,-rpath,$(LOGOS_DELIVERY_LIB_PATH)/
|
2024-11-27 12:08:50 +02:00
|
|
|
|
2025-11-25 17:49:42 +01:00
|
|
|
# Expected files
|
2026-08-23 11:39:58 +01:00
|
|
|
HEADER_FILE := $(LOGOS_DELIVERY_HEADER_PATH)/liblogosdelivery.h
|
|
|
|
|
LIB_FILES := $(wildcard $(LOGOS_DELIVERY_LIB_PATH)/liblogosdelivery.*)
|
2025-11-25 17:49:42 +01:00
|
|
|
|
2026-08-23 11:39:58 +01:00
|
|
|
.PHONY: all clean prepare build test build-auto test-auto
|
2024-11-27 12:08:50 +02:00
|
|
|
|
2025-11-25 17:49:42 +01:00
|
|
|
# Validate necessary folders and files
|
|
|
|
|
check-folders:
|
2026-08-23 11:39:58 +01:00
|
|
|
@echo Checking header directory ...
|
|
|
|
|
@if [ -z "$(LOGOS_DELIVERY_HEADER_PATH)" ]; then \
|
|
|
|
|
echo "ERROR: LOGOS_DELIVERY_HEADER_PATH not set"; exit 1; \
|
2025-11-25 17:49:42 +01:00
|
|
|
fi
|
2026-08-23 11:39:58 +01:00
|
|
|
@if [ ! -d "$(LOGOS_DELIVERY_HEADER_PATH)" ]; then \
|
|
|
|
|
echo "ERROR: Header path does not exist: $(LOGOS_DELIVERY_HEADER_PATH)"; exit 1; \
|
2025-11-25 17:49:42 +01:00
|
|
|
fi
|
2024-11-27 12:08:50 +02:00
|
|
|
|
2026-08-23 11:39:58 +01:00
|
|
|
@echo Checking library directory ...
|
|
|
|
|
@if [ -z "$(LOGOS_DELIVERY_LIB_PATH)" ]; then \
|
|
|
|
|
echo "ERROR: LOGOS_DELIVERY_LIB_PATH not set"; exit 1; \
|
2025-11-25 17:49:42 +01:00
|
|
|
fi
|
2026-08-23 11:39:58 +01:00
|
|
|
@if [ ! -d "$(LOGOS_DELIVERY_LIB_PATH)" ]; then \
|
|
|
|
|
echo "ERROR: Library path does not exist: $(LOGOS_DELIVERY_LIB_PATH)"; exit 1; \
|
2025-11-25 17:49:42 +01:00
|
|
|
fi
|
2025-10-30 10:59:13 +00:00
|
|
|
|
2026-07-20 17:55:30 +01:00
|
|
|
@echo Checking for liblogosdelivery.h ...
|
2025-11-25 17:49:42 +01:00
|
|
|
@if [ ! -f "$(HEADER_FILE)" ]; then \
|
2026-07-20 17:55:30 +01:00
|
|
|
echo "ERROR: liblogosdelivery.h not found at: $(HEADER_FILE)"; exit 1; \
|
2025-11-25 17:49:42 +01:00
|
|
|
fi
|
|
|
|
|
|
2026-08-23 11:39:58 +01:00
|
|
|
@echo Checking for the library file ...
|
2025-11-25 17:49:42 +01:00
|
|
|
@if [ -z "$(LIB_FILES)" ]; then \
|
2026-08-23 11:39:58 +01:00
|
|
|
echo "ERROR: No library file found in: $(LOGOS_DELIVERY_LIB_PATH)"; exit 1; \
|
2025-11-25 17:49:42 +01:00
|
|
|
fi
|
|
|
|
|
|
2025-12-22 18:52:43 +05:30
|
|
|
build:
|
2026-01-08 23:27:46 +05:30
|
|
|
@echo "Building Logos Messaging Go Bindings (manual)..."
|
2026-06-10 10:13:55 +01:00
|
|
|
CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" go build -o kernel-bindings .
|
2025-12-20 01:52:47 +05:30
|
|
|
|
|
|
|
|
test: build
|
|
|
|
|
@echo "Running tests (manual)..."
|
|
|
|
|
@if [ -z "$(TEST)" ]; then \
|
2025-12-23 02:21:12 +05:30
|
|
|
CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" go test .; \
|
2025-12-20 01:52:47 +05:30
|
|
|
else \
|
2025-12-23 02:21:12 +05:30
|
|
|
CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" go test . -count=1 -run $(TEST) -v; \
|
2025-12-20 01:52:47 +05:30
|
|
|
fi
|
|
|
|
|
|
2024-11-27 12:08:50 +02:00
|
|
|
# Clean up generated files
|
|
|
|
|
clean:
|
|
|
|
|
@echo "Cleaning up..."
|
2026-06-10 10:13:55 +01:00
|
|
|
@rm -f kernel-bindings
|