64 lines
1.7 KiB
Makefile
64 lines
1.7 KiB
Makefile
# NOSTR WebSocket Library Makefile
|
|
# Production-ready WebSocket implementation for NOSTR protocol
|
|
|
|
CC = gcc
|
|
CFLAGS = -Wall -Wextra -std=c99 -O2
|
|
INCLUDES = -I. -I.. -I../mbedtls/include -I../mbedtls/tf-psa-crypto/include -I../mbedtls/tf-psa-crypto/drivers/builtin/include
|
|
LIBS = -lm -L../mbedtls/library -lmbedtls -lmbedx509 -lmbedcrypto
|
|
|
|
# Source files
|
|
WEBSOCKET_SOURCES = nostr_websocket_mbedtls.c ../cjson/cJSON.c
|
|
WEBSOCKET_HEADERS = nostr_websocket_tls.h ../cjson/cJSON.h
|
|
|
|
# Test programs
|
|
TEST_SOURCES = test_5_events_clean.c
|
|
TEST_PROGRAMS = test_5_events_clean
|
|
|
|
# Object files
|
|
WEBSOCKET_OBJECTS = $(WEBSOCKET_SOURCES:.c=.o)
|
|
|
|
.PHONY: all clean test
|
|
|
|
all: $(TEST_PROGRAMS)
|
|
|
|
# Test programs
|
|
test_5_events_clean: test_5_events_clean.o $(WEBSOCKET_OBJECTS)
|
|
$(CC) -o $@ $^ $(LIBS)
|
|
|
|
# Object file compilation
|
|
%.o: %.c $(WEBSOCKET_HEADERS)
|
|
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
|
|
|
|
# Test target
|
|
test: test_5_events_clean
|
|
@echo "🧪 Running WebSocket test..."
|
|
@echo "Press Ctrl-C to stop the test"
|
|
./test_5_events_clean
|
|
|
|
# Clean build artifacts
|
|
clean:
|
|
rm -f *.o $(TEST_PROGRAMS)
|
|
rm -f ../cjson/*.o
|
|
|
|
# Display library info
|
|
info:
|
|
@echo "📚 NOSTR WebSocket Library"
|
|
@echo "=========================="
|
|
@echo "Core files:"
|
|
@echo " - nostr_websocket_tls.h (header)"
|
|
@echo " - nostr_websocket_mbedtls.c (implementation)"
|
|
@echo " - ../cjson/cJSON.h/c (JSON support)"
|
|
@echo ""
|
|
@echo "Dependencies:"
|
|
@echo " - mbedTLS (SSL/TLS support)"
|
|
@echo " - Standard C libraries"
|
|
@echo ""
|
|
@echo "Usage:"
|
|
@echo " make - Build test programs"
|
|
@echo " make test - Run WebSocket test"
|
|
@echo " make clean - Clean build artifacts"
|
|
@echo " make info - Show this information"
|
|
|
|
# Help target
|
|
help: info
|