54 lines
1.6 KiB
Makefile
Raw Permalink Normal View History

2024-11-27 12:08:50 +02:00
# Makefile for Waku Go Bindings
# The LIBWAKU_LIB_PATH and LIBWAKU_HEADER_PATH env vars should be defined beforehand
# Therefore, we assume the libwaku library and headers are located in the specified paths
export CGO_CFLAGS="-I${LIBWAKU_HEADER_PATH}/"
export CGO_LDFLAGS="-L${LIBWAKU_LIB_PATH}/ -lsds -Wl,-rpath,${LIBWAKU_LIB_PATH}/"
2024-11-27 12:08:50 +02:00
# Expected files
HEADER_FILE := $(LIBWAKU_HEADER_PATH)/libwaku.h
LIB_FILES := $(wildcard $(LIBWAKU_LIB_PATH)/libwaku.*)
.PHONY: all clean prepare build
2024-11-27 12:08:50 +02:00
# Default target
all: build
# Validate necessary folders and files
check-folders:
@echo Checking libwaku header directory ...
@if [ -z "$(LIBWAKU_HEADER_PATH)" ]; then \
echo "ERROR: LIBWAKU_HEADER_PATH not set"; exit 1; \
fi
@if [ ! -d "$(LIBWAKU_HEADER_PATH)" ]; then \
echo "ERROR: Header path does not exist: $(LIBWAKU_HEADER_PATH)"; exit 1; \
fi
@echo Checking libwaku lib directory ...
@if [ -z "$(LIBWAKU_LIB_PATH)" ]; then \
echo "ERROR: LIBWAKU_LIB_PATH not set"; exit 1; \
fi
@if [ ! -d "$(LIBWAKU_LIB_PATH)" ]; then \
echo "ERROR: Library path does not exist: $(LIBWAKU_LIB_PATH)"; exit 1; \
fi
@echo Checking for libwaku.h ...
@if [ ! -f "$(HEADER_FILE)" ]; then \
echo "ERROR: libwaku.h not found at: $(HEADER_FILE)"; exit 1; \
fi
2024-11-27 12:08:50 +02:00
@echo Checking for libwaku library file ...
@if [ -z "$(LIB_FILES)" ]; then \
echo "ERROR: No libwaku library file found in: $(LIBWAKU_LIB_PATH)"; exit 1; \
fi
# Build SDS Go Bindings
build: check-folders
2024-11-27 12:08:50 +02:00
@echo "Building Waku Go Bindings..."
2025-01-22 18:58:23 +01:00
go build ./...
2024-11-27 12:08:50 +02:00
# Clean up generated files
clean:
@echo "Cleaning up..."
@rm -f waku-go-bindings