Makefile: add install/uninstall targets (PREFIX/bin + libexec) (#167, fixes #164)

* Add make install/uninstall targets

Neither the root Makefile nor c/Makefile had an install target,
so 'build+install' never actually installed anything (fixes #164).
Adds standard PREFIX/DESTDIR/BINDIR-respecting install and uninstall
targets that place glm and coli in $(BINDIR).

* Split install: coli in bin/, engine + support files in libexec/

Addresses feedback on #164 from JustVugg and yurivict: coli goes to
$(BINDIR), glm/olmoe and their Python support modules
(resource_plan.py, doctor.py, openai_server.py, tools/) go to
$(LIBEXECDIR) (default $(PREFIX)/libexec/colibri), matching typical
Unix/FreeBSD-port conventions for a wrapper vs. its internals.

coli now resolves the engine path in this order:
  1. $COLI_ENGINE if set (explicit override)
  2. glm next to itself (run-in-place from a source checkout, unchanged)
  3. $(LIBEXECDIR)/glm (installed layout), also added to sys.path so
     the Python support modules still import correctly

Also adds a 'bench' target (builds iobench) since only cuda-bench
existed before.

Tested locally (WSL2/Ubuntu):
  - run-in-place: cd c && python3 coli info -> engine ready
  - installed:    make install PREFIX=$HOME/.local &&                    ~/.local/bin/coli info -> engine ready (found via libexec)
  - make uninstall cleans both bin/ and libexec/colibri/ fully
This commit is contained in:
Sai Saharsh Chittimilla
2026-07-14 17:19:29 +05:30
committed by GitHub
parent c333840baa
commit 6e9affba2a
3 changed files with 54 additions and 6 deletions
+23 -1
View File
@@ -71,6 +71,12 @@ EXE =
endif
endif
# --- install ---
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
LIBEXECDIR ?= $(PREFIX)/libexec/colibri
INSTALL ?= install
# CUDA=1 adds an opt-in backend for resident tensors. The default build remains
# pure C and keeps the original zero-dependency runtime.
#
@@ -222,7 +228,23 @@ check:
$(MAKE) portable
$(MAKE) test
install: glm$(EXE) olmoe$(EXE)
$(INSTALL) -d $(DESTDIR)$(BINDIR)
$(INSTALL) -d $(DESTDIR)$(LIBEXECDIR)
$(INSTALL) -d $(DESTDIR)$(LIBEXECDIR)/tools
$(INSTALL) -m 755 coli $(DESTDIR)$(BINDIR)/coli
$(INSTALL) -m 755 glm$(EXE) $(DESTDIR)$(LIBEXECDIR)/glm$(EXE)
$(INSTALL) -m 755 olmoe$(EXE) $(DESTDIR)$(LIBEXECDIR)/olmoe$(EXE)
$(INSTALL) -m 644 resource_plan.py doctor.py openai_server.py $(DESTDIR)$(LIBEXECDIR)/
$(INSTALL) -m 644 tools/*.py $(DESTDIR)$(LIBEXECDIR)/tools/
uninstall:
rm -f $(DESTDIR)$(BINDIR)/coli
rm -rf $(DESTDIR)$(LIBEXECDIR)
clean:
$(PYTHON) tools/clean.py
.PHONY: all glm cuda-test cuda-bench cuda-dll portable test-c test-python test check clean
bench: iobench$(EXE)
@if [ -n "$(ARGS)" ]; then ./iobench$(EXE) $(ARGS); else echo "built iobench$(EXE) — run: ./iobench$(EXE) <file> <MB> <iters> <threads> <direct 0|1>"; fi
.PHONY: all glm cuda-test cuda-bench cuda-dll portable test-c test-python test check clean install uninstall bench