aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorOnur Gündüz <ogunduz@gmail.com>2026-09-29 12:54:13 +0200
committerOnur Gündüz <ogunduz@gmail.com>2026-09-29 12:54:13 +0200
commit91871be6ece9317c5d49353f6474583e7e28168d (patch)
tree8cabf2546322a9e1b724bf8413f32de54378824f /Makefile
parent35ab9c12ba4d396e6cba99d6ea947e26becedad4 (diff)
downloadlangdet-91871be6ece9317c5d49353f6474583e7e28168d.tar.gz
langdet-91871be6ece9317c5d49353f6474583e7e28168d.zip
Add native CPU language detection CLI
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile26
1 files changed, 26 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..e8a19e2
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,26 @@
+CC = cc
+CPPFLAGS += -Ilibffwd -Ideps/yyjson -DUSE_BLAS -DACCELERATE_NEW_LAPACK
+CFLAGS ?= -O3 -march=native
+CFLAGS += -std=c11 -Wall -Wextra -Werror=implicit-function-declaration -pthread
+LDLIBS += -framework Accelerate -lm -pthread
+
+CPU_SOURCES = model.c model_blas.c forward.c alloc.c config.c vec.c \
+ tokenize.c bpe.c sentencepiece.c wordpiece.c safetensors.c \
+ act.c gemm.c norm.c rope.c attn.c threadpool.c generic.c neon.c avx.c
+SOURCES = langdetect.c $(addprefix libffwd/,$(CPU_SOURCES)) deps/yyjson/yyjson.c
+OBJECTS = $(SOURCES:%.c=build/%.o)
+
+.PHONY: all clean
+all: langdetect
+
+langdetect: $(OBJECTS)
+ $(CC) $(LDFLAGS) -o $@ $(OBJECTS) $(LDLIBS)
+
+build/%.o: %.c
+ @mkdir -p $(@D)
+ $(CC) $(CPPFLAGS) $(CFLAGS) -MMD -MP -c $< -o $@
+
+clean:
+ rm -rf build langdetect
+
+-include $(OBJECTS:.o=.d)