Files
event_miner/Makefile
2025-08-14 15:23:30 -04:00

81 lines
2.3 KiB
Makefile

# Event Miner Makefile
# Static build with nostr_core_lib dependency
CC = gcc
CFLAGS = -Wall -Wextra -std=c99 -O2 -static
INCLUDES = -Inostr_core_lib/nostr_core
LIBS = -lm -lpthread
NOSTR_LIB = nostr_core_lib/libnostr_core.a
# Default target
all: event_miner
# Main target - build event_miner
event_miner: event_miner.c $(NOSTR_LIB)
@echo "Building event_miner..."
$(CC) $(CFLAGS) $(INCLUDES) event_miner.c $(NOSTR_LIB) $(LIBS) -o event_miner
@echo "✓ event_miner built successfully"
# Build nostr_core_lib dependency
$(NOSTR_LIB):
@echo "Building nostr_core_lib dependency..."
cd nostr_core_lib && make
@echo "✓ nostr_core_lib built successfully"
# Clean target
clean:
@echo "Cleaning build artifacts..."
rm -f event_miner
cd nostr_core_lib && make clean
# Clean only event_miner (keep nostr_core_lib)
clean-miner:
@echo "Cleaning event_miner..."
rm -f event_miner
# Test target (basic compilation test)
test: event_miner
@echo "Testing event_miner compilation..."
./event_miner --help
@echo "✓ Basic test passed"
# Install target (optional - install to /usr/local/bin)
install: event_miner
@echo "Installing event_miner to /usr/local/bin..."
sudo cp event_miner /usr/local/bin/
@echo "✓ event_miner installed"
# Uninstall target
uninstall:
@echo "Removing event_miner from /usr/local/bin..."
sudo rm -f /usr/local/bin/event_miner
@echo "✓ event_miner uninstalled"
# Force rebuild
rebuild: clean all
# Help
help:
@echo "Event Miner Build System"
@echo "========================"
@echo ""
@echo "Available targets:"
@echo " all - Build event_miner (default)"
@echo " event_miner - Build event_miner binary"
@echo " clean - Clean all build artifacts"
@echo " clean-miner - Clean only event_miner binary"
@echo " test - Build and run basic test"
@echo " install - Install to /usr/local/bin (requires sudo)"
@echo " uninstall - Remove from /usr/local/bin (requires sudo)"
@echo " rebuild - Clean and rebuild everything"
@echo " help - Show this help"
@echo ""
@echo "Usage examples:"
@echo " make # Build event_miner"
@echo " make clean && make # Clean rebuild"
@echo " make test # Build and test"
@echo ""
@echo "The binary will be statically linked with no external dependencies."
.PHONY: all clean clean-miner test install uninstall rebuild help