CC = gcc
CFLAGS = -Wall -Wextra -std=c99
LIBS = -lm
LIBS_STATIC = -static -lm
TARGET = otp
SOURCE = otp.c
CHACHA20_SOURCE = nostr_chacha20.c

# Default build target
$(TARGET): $(SOURCE)
	$(CC) $(CFLAGS) -o $(TARGET) $(SOURCE) $(CHACHA20_SOURCE) $(LIBS)

# Static linking target
static: $(SOURCE)
	$(CC) $(CFLAGS) -o $(TARGET) $(SOURCE) $(CHACHA20_SOURCE) $(LIBS_STATIC)

clean:
	rm -f $(TARGET) *.pad *.state

install:
	sudo cp $(TARGET) /usr/local/bin/

uninstall:
	sudo rm -f /usr/local/bin/$(TARGET)

.PHONY: clean install uninstall static
