# Copyright (C) 2026 by Prof. Dr. Ruben Carlo Benante
# levenshtein library -- makefile
#
# Usage:
#   make              build both: cmp11sht (CLI) and test_lib11sht
#   make cmp11sht     build only the CLI
#   make test         build + run the stress test suite
#   make clean        remove built binaries
#
# Uses clang with strict warnings to catch bugs early.

CC      = clang
CFLAGS  = -std=gnu17 -O2 -g \
          -Wall -Wextra -Wpedantic \
          -Wshadow -Wpointer-arith -Wcast-qual -Wundef \
          -Wstrict-prototypes -Wmissing-prototypes \
          -fdiagnostics-color=always
LDLIBS  = -lm

LIB_SRC = lib11sht.c
LIB_HDR = lib11sht.h

.PHONY: all test clean

all: cmp11sht test_lib11sht

cmp11sht: cmp11sht.c $(LIB_SRC) $(LIB_HDR)
	$(CC) $(CFLAGS) cmp11sht.c $(LIB_SRC) $(LDLIBS) -o $@

test_lib11sht: test_lib11sht.c $(LIB_SRC) $(LIB_HDR)
	$(CC) $(CFLAGS) test_lib11sht.c $(LIB_SRC) $(LDLIBS) -o $@

test: test_lib11sht
	./test_lib11sht

clean:
	rm -f cmp11sht test_lib11sht
