mirror of
https://github.com/logos-messaging/logos-messaging-go-bindings.git
synced 2026-01-02 14:03:10 +00:00
waku/Makefile now assumes lib already exists
This commit is contained in:
parent
3d5e8e550b
commit
5ec2ab11de
@ -1,30 +1,53 @@
|
||||
# Makefile for Waku Go Bindings
|
||||
|
||||
# Directories
|
||||
THIRD_PARTY_DIR := $(shell pwd)/../third_party
|
||||
NWAKU_REPO := https://github.com/waku-org/nwaku
|
||||
NWAKU_DIR := $(THIRD_PARTY_DIR)/nwaku
|
||||
# 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}/"
|
||||
|
||||
.PHONY: all clean build-libwaku build
|
||||
# Expected files
|
||||
HEADER_FILE := $(LIBWAKU_HEADER_PATH)/libwaku.h
|
||||
LIB_FILES := $(wildcard $(LIBWAKU_LIB_PATH)/libwaku.*)
|
||||
|
||||
.PHONY: all clean prepare build
|
||||
|
||||
# Default target
|
||||
all: build
|
||||
|
||||
# Build libwaku
|
||||
build-libwaku:
|
||||
@echo "Building libwaku..."
|
||||
@cd $(NWAKU_DIR) && make libwaku
|
||||
# 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
|
||||
|
||||
# Build Waku Go Bindings
|
||||
@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
|
||||
|
||||
build: export CGO_CFLAGS = "-I${NWAKU_DIR}/library/"
|
||||
build: export CGO_LDFLAGS = "-L${NWAKU_DIR}/build/ -lwaku -L${NWAKU_DIR} -Wl,-rpath,${NWAKU_DIR}/build/"
|
||||
build:
|
||||
@echo Checking for libwaku.h ...
|
||||
@if [ ! -f "$(HEADER_FILE)" ]; then \
|
||||
echo "ERROR: libwaku.h not found at: $(HEADER_FILE)"; exit 1; \
|
||||
fi
|
||||
|
||||
@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
|
||||
@echo "Building Waku Go Bindings..."
|
||||
go build ./...
|
||||
|
||||
# Clean up generated files
|
||||
clean:
|
||||
@echo "Cleaning up..."
|
||||
@rm -rf $(THIRD_PARTY_DIR)
|
||||
@rm -f waku-go-bindings
|
||||
@rm -f waku-go-bindings
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user