Version v0.3.23 - Reorganized project structure - all sources in src/, builds in build/

This commit is contained in:
2025-12-18 08:54:57 -04:00
parent 3ff91e7681
commit a5a1bd92c4
23 changed files with 57 additions and 369 deletions

View File

@@ -1,29 +1,32 @@
CC = gcc
CFLAGS = -Wall -Wextra -std=c99 -Iinclude
CFLAGS = -Wall -Wextra -std=c99 -Isrc
LIBS = -lm
LIBS_STATIC = -static -lm
TARGET = otp
SOURCES = $(wildcard src/*.c) nostr_chacha20.c otp.c
ARCH = $(shell uname -m)
TARGET = build/otp-$(ARCH)
SOURCES = $(wildcard src/*.c)
OBJS = $(SOURCES:.c=.o)
# Default build target
$(TARGET): $(OBJS)
@mkdir -p build
$(CC) $(CFLAGS) -o $(TARGET) $(OBJS) $(LIBS)
# Static linking target
static: $(OBJS)
@mkdir -p build
$(CC) $(CFLAGS) -o $(TARGET) $(OBJS) $(LIBS_STATIC)
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
clean:
rm -f $(TARGET) $(OBJS) *.pad *.state
rm -f $(OBJS) src/*.o build/otp-* *.pad *.state
install:
sudo cp $(TARGET) /usr/local/bin/
sudo cp $(TARGET) /usr/local/bin/otp
uninstall:
sudo rm -f /usr/local/bin/$(TARGET)
sudo rm -f /usr/local/bin/otp
.PHONY: clean install uninstall static