aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorOnur Gündüz <ogunduz@gmail.com>2026-06-16 18:02:57 +0200
committerOnur Gündüz <ogunduz@gmail.com>2026-06-16 18:02:57 +0200
commit297a44c08675f4b7744081963248e9e3552850e7 (patch)
tree4badae72f48b67dd0299461aecea9961b355b0e6 /Makefile
parent230dc1748aa68cccde6de9aa3cdade7d64aede56 (diff)
downloadffwd-297a44c08675f4b7744081963248e9e3552850e7.tar.gz
ffwd-297a44c08675f4b7744081963248e9e3552850e7.zip
server: extract server_util, sbuf, and base64 leaf utilities
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile12
1 files changed, 10 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 9451c47..1612646 100644
--- a/Makefile
+++ b/Makefile
@@ -81,6 +81,11 @@ TOKENIZER_SRCS = src/tokenizer_bpe.c src/tokenizer_wordpiece.c
CORE_SRCS = src/model.c src/forward.c src/late.c src/vec.c src/alloc.c \
src/config.c src/safetensors.c $(KERNEL_SRCS)
+# Server-only objects: the embed-server binary and the server test link these
+# alongside server.o. Not in libembed.a - the CLI and library do not use them.
+SERVER_SRCS = src/server_util.c src/sbuf.c src/base64.c
+SERVER_OBJS = $(SERVER_SRCS:.c=.o)
+
SRCS = $(CORE_SRCS) $(TOKENIZER_SRCS) \
deps/ae/ae.c deps/ae/anet.c deps/ae/monotonic.c
@@ -171,8 +176,8 @@ $(LIB): $(OBJS) $(EXTRA_OBJS)
$(TARGET): $(LIB) src/cli.o
$(CC) $(CFLAGS) -o $@ src/cli.o $(LIB) $(LDFLAGS)
-$(SERVER_TARGET): $(LIB) src/server.o
- $(CC) $(CFLAGS) -o $@ src/server.o $(LIB) $(LDFLAGS) $(CJSON_LDFLAGS)
+$(SERVER_TARGET): $(LIB) src/server.o $(SERVER_OBJS)
+ $(CC) $(CFLAGS) -o $@ src/server.o $(SERVER_OBJS) $(LIB) $(LDFLAGS) $(CJSON_LDFLAGS)
# =============================================================================
# Tests (no model files required)
@@ -199,7 +204,10 @@ TEST_WORKSPACE_SRCS = tests/test_workspace.c $(CORE_SRCS) src/tokenizer_bpe.c
TEST_LATE_SRCS = tests/test_late.c $(CORE_SRCS) src/tokenizer_bpe.c
# test_server.c #includes ../src/server.c, so server is not a separate object
# here; it needs -I. for server.c's "deps/ae/ae.h" plus the ae sources.
+# test_server.c #includes ../src/server.c, so server.c itself is not listed;
+# the carved-out server objects (util/sbuf/base64) are separate TUs and must be.
TEST_SERVER_SRCS = tests/test_server.c $(CORE_SRCS) $(TOKENIZER_SRCS) \
+ $(SERVER_SRCS) \
deps/ae/ae.c deps/ae/anet.c deps/ae/monotonic.c
# The CLI check builds the real CLI (CPU backend) plus a driver that runs it.
TEST_CLI_BIN_SRCS = src/cli.c $(CORE_SRCS) $(TOKENIZER_SRCS)