Files
junction/Makefile
T
Hermes Agent 87e6348642 junction: per-target 'as', example config for the van, C WoL helper
- A rule may send a different model name per target: 'pass peer-a as M, peer-b, cloud'
  rewrites only for peer-a, so a mixed local/cloud rule still asks the cloud for the
  name the client wanted.
- examples/olivia.conf: peers on the tunnel, embedding box, sleeping workstation with
  WoL + energy gate, cloud fallback, and the policy rules each with its reason.
- tools/junction-wol.c replaces the Python magic-packet helper; hooks stay shell.
- Forwarding no longer duplicates Host/Content-Length/X-Forwarded-*: Ollama answered
  400 to a request that was valid because it arrived with two Host headers.
- need_tokens: embeddings produce a vector, not tokens, so they are not charged
  default_max_tokens (a 2048-context embed endpoint refused every request).
- /status lists every target with its model, plus the rule's need window.
2026-10-29 14:13:46 +00:00

53 lines
1.6 KiB
Makefile

# junction — C99 + POSIX. TLS is optional: an OpenSSL build adds https:// upstreams
# and a TLS listener; J_WITH_TLS=0 gives a dependency-free binary.
CC ?= cc
CFLAGS ?= -std=c99 -O2 -Wall -Wextra -Wpedantic -Wshadow -Wconversion
CPPFLAGS += -D_POSIX_C_SOURCE=200809L
LDFLAGS ?=
PREFIX ?= /usr/local
J_WITH_TLS ?= auto
SRC = src/config.c src/conn.c src/http.c src/cache.c src/junction.c
OBJ = $(SRC:.c=.o)
TOOLS = tools/junction-wol
ifeq ($(J_WITH_TLS),0)
TLS_LIBS =
else
ifeq ($(wildcard /usr/include/openssl/ssl.h),)
TLS_LIBS =
else
CPPFLAGS += -DJ_HAVE_TLS
TLS_LIBS = -lssl -lcrypto
endif
endif
all: junction $(TOOLS)
tools/junction-wol: tools/junction-wol.c
$(CC) -std=c99 -O2 -Wall -Wextra -Wpedantic $< -o $@
junction: $(OBJ)
$(CC) $(CFLAGS) $(OBJ) -o $@ $(LDFLAGS) $(TLS_LIBS)
src/%.o: src/%.c src/config.h src/conn.h src/http.h src/cache.h
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
test: junction
tests/run.sh
install: junction $(TOOLS)
install -d $(DESTDIR)$(PREFIX)/bin $(DESTDIR)$(PREFIX)/share/junction/hooks
install -m 0755 junction $(DESTDIR)$(PREFIX)/bin/junction
install -m 0755 $(TOOLS) $(DESTDIR)$(PREFIX)/bin/junction-wol
install -m 0755 hooks/*.sh $(DESTDIR)$(PREFIX)/share/junction/hooks/
install -m 0755 $(TOOLS) $(DESTDIR)$(PREFIX)/share/junction/hooks/
install -m 0644 config.example $(DESTDIR)$(PREFIX)/share/junction/junction.conf
install -d $(DESTDIR)$(PREFIX)/share/junction/examples
install -m 0644 examples/*.conf $(DESTDIR)$(PREFIX)/share/junction/examples/
clean:
rm -f $(OBJ) junction $(TOOLS)
.PHONY: all test install clean