Minimalist agentic harness in C
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657CFLAGS ?= -O2 -gSTD = -std=gnu23 -Wall -Wextra -Wmissing-prototypesSAN = -O0 -g -fsanitize=address,undefined
LIB = lib/vec.c lib/str.c lib/log.cHDR = lib/lib.h lib/vec.h lib/str.h lib/log.h
# Needs libcurl, so only provider targets build it.HTTP_LIB = lib/httpClient.cHTTP_HDR = lib/httpClient.h
# pkg-config packages the provider links against.PROVIDER_PKGS = libcurl jansson# Recursive (=), so pkg-config only runs when a provider is actually built.PROVIDER_LIBS = $(shell pkg-config --cflags --libs $(PROVIDER_PKGS))
golf: golf.c $(LIB) $(HDR) $(CC) $(STD) $(CFLAGS) -o $@ golf.c $(LIB)
golf_provider_openai: golf_provider_openai.c $(LIB) $(HTTP_LIB) $(HDR) $(HTTP_HDR) | check-provider-deps $(CC) $(STD) $(CFLAGS) -o $@ golf_provider_openai.c $(LIB) $(HTTP_LIB) $(PROVIDER_LIBS)
# Order-only prerequisite: runs before every provider build, but never forces a rebuild.check-provider-deps: @missing=0; \ for pkg in $(PROVIDER_PKGS); do \ pkg-config --exists $$pkg || { echo "error: $$pkg not found (pkg-config)."; missing=1; }; \ done; \ if [ $$missing = 1 ]; then \ echo "Install them, e.g. 'pacman -S curl jansson' or 'apt install libcurl4-openssl-dev libjansson-dev'."; \ exit 1; \ fi
# Always rebuilds, since make can't tell a sanitized binary from a release one.debug: $(MAKE) -B CFLAGS='$(SAN)' golf
# Tests always run under the sanitizers.test: test/vec_test test/lib_test test/str_test ./test/vec_test ./test/lib_test ./test/str_test
test/vec_test: test/vec_test.c lib/vec.c $(HDR) $(CC) $(STD) $(SAN) -o $@ test/vec_test.c lib/vec.c
test/lib_test: test/lib_test.c lib/lib.h $(CC) $(STD) $(SAN) -o $@ test/lib_test.c
test/str_test: test/str_test.c lib/str.c lib/vec.c $(HDR) $(CC) $(STD) $(SAN) -o $@ test/str_test.c lib/str.c lib/vec.c
clean: rm -f golf golf_provider_openai test/vec_test test/lib_test test/str_test
.PHONY: debug test clean check-provider-deps