41 lines
1.2 KiB
Plaintext
41 lines
1.2 KiB
Plaintext
# test_ws_client Makefile — builds the standalone WebSocket client test
|
|
# using nostr_core_lib, matching the caching/ build pattern.
|
|
|
|
CC = gcc
|
|
CFLAGS = -Wall -Wextra -std=c99 -g -O0
|
|
|
|
NOSTR_CORE_DIR = ../nostr_core_lib
|
|
|
|
INCLUDES = -I. -I$(NOSTR_CORE_DIR) -I$(NOSTR_CORE_DIR)/nostr_core \
|
|
-I$(NOSTR_CORE_DIR)/cjson -I$(NOSTR_CORE_DIR)/nostr_websocket
|
|
|
|
LIBS = -lssl -lcrypto -lwebsockets -lsecp256k1 -lz -ldl -lpthread -lm -lsqlite3 -lcurl
|
|
|
|
ARCH = $(shell uname -m)
|
|
ifeq ($(ARCH),x86_64)
|
|
NOSTR_CORE_LIB = $(NOSTR_CORE_DIR)/libnostr_core_x64.a
|
|
else ifeq ($(ARCH),aarch64)
|
|
NOSTR_CORE_LIB = $(NOSTR_CORE_DIR)/libnostr_core_arm64.a
|
|
else ifeq ($(ARCH),arm64)
|
|
NOSTR_CORE_LIB = $(NOSTR_CORE_DIR)/libnostr_core_arm64.a
|
|
else
|
|
NOSTR_CORE_LIB = $(NOSTR_CORE_DIR)/libnostr_core_x64.a
|
|
endif
|
|
|
|
TARGET = test_ws_client
|
|
|
|
all: $(TARGET)
|
|
|
|
$(TARGET): test_ws_client.c $(NOSTR_CORE_LIB)
|
|
@echo "Building test_ws_client..."
|
|
@rm -rf /tmp/twsc_lib && mkdir -p /tmp/twsc_lib && \
|
|
ar x $(NOSTR_CORE_LIB) --output=/tmp/twsc_lib && \
|
|
$(CC) $(CFLAGS) $(INCLUDES) test_ws_client.c /tmp/twsc_lib/*.o -o $(TARGET) $(LIBS) && \
|
|
rm -rf /tmp/twsc_lib && \
|
|
echo "Build complete: $(TARGET)"
|
|
|
|
clean:
|
|
rm -f $(TARGET)
|
|
|
|
.PHONY: all clean
|