Repository navigation
Expand file tree
/
Copy pathmakefile
More file actions
64 lines (48 loc) · 2.21 KB
/
Copy pathmakefile
File metadata and controls
64 lines (48 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
.POSIX:
CC = cc
# Version derived from `git describe` at build time so the binaries report
# the exact tag/commit they were built from; "dev" without git metadata.
VERSION != git describe --tags --always --dirty 2>/dev/null || echo dev
# libcurl: pkg-config when the headers are installed (libcurl-devel);
# CURL_CFLAGS/CURL_LIBS override for an unpackaged copy of the headers.
CURL_CFLAGS != pkg-config --cflags libcurl 2>/dev/null || true
CURL_LIBS != pkg-config --libs libcurl 2>/dev/null || echo -lcurl
CFLAGS = -std=c11 -pedantic -Wall -Wextra -Os -D_POSIX_C_SOURCE=200809L \
-D_DEFAULT_SOURCE -DHAI_VERSION='"$(VERSION)"' \
-isystem vendor $(CURL_CFLAGS)
LDLIBS = $(CURL_LIBS)
BINDIR = $(HOME)/.local/bin
CORE = agent.c llm.c tools.c mail.c session.c child.c mcp.c trigger.c vendor/cJSON.c
HDRS = hai.h config.h vendor/cJSON.h vendor/stb_ds.h vendor/hconf.h
all: haid hai
haid: haid.c http.c $(CORE) $(HDRS)
$(CC) $(CFLAGS) -o $@ haid.c http.c $(CORE) $(LDLIBS)
hai: hai.c hai.h
$(CC) $(CFLAGS) -o $@ hai.c
# the loop, the wire format and the tools against canned replies, no
# network: test/check.c supplies the model
check: test/check
./test/check
test/check: test/check.c $(CORE) $(HDRS)
$(CC) $(CFLAGS) -o $@ test/check.c $(CORE)
# the voice: piper and a voice model into ~/.local/share (no package on
# Void; hstt's whisper model is fetched the same way). Override VOICE=.
PIPER_URL = https://github.com/rhasspy/piper/releases/download/2023.11.14-2/piper_linux_x86_64.tar.gz
VOICE = en_US-lessac-medium
VOICE_URL = https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/lessac/medium
VOICEDIR = $(HOME)/.local/share/piper-voices
voice:
mkdir -p $(HOME)/.local/share $(VOICEDIR) $(BINDIR)
curl -L $(PIPER_URL) | tar -xz -C $(HOME)/.local/share
ln -sf $(HOME)/.local/share/piper/piper $(BINDIR)/piper
curl -L -o $(VOICEDIR)/$(VOICE).onnx $(VOICE_URL)/$(VOICE).onnx
curl -L -o $(VOICEDIR)/$(VOICE).onnx.json $(VOICE_URL)/$(VOICE).onnx.json
install: all
mkdir -p $(BINDIR)
ln -sf "$$(pwd)/haid" $(BINDIR)/haid
ln -sf "$$(pwd)/hai" $(BINDIR)/hai
uninstall:
rm -f $(BINDIR)/haid $(BINDIR)/hai
clean:
rm -f haid hai test/check
.PHONY: all check voice install uninstall clean