-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (57 loc) · 2.25 KB
/
Makefile
File metadata and controls
64 lines (57 loc) · 2.25 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
.PHONY: install deps check clean uninstall help
PREFIX ?= $(HOME)/.local
BINDIR = $(PREFIX)/bin
SCRIPT = luallm.lua
TARGET = $(BINDIR)/luallm
help:
@echo "luaLLM - Makefile targets:"
@echo ""
@echo " make deps - Install Lua dependencies (lua-cjson, luafilesystem)"
@echo " make install - Install dependencies and symlink script to ~/.local/bin"
@echo " make check - Check if dependencies are installed"
@echo " make uninstall - Remove installed script"
@echo " make clean - Remove local build artifacts"
@echo ""
@echo "Options:"
@echo " PREFIX=/path - Install location (default: ~/.local)"
check:
@echo "Checking Lua installation..."
@which lua > /dev/null || (echo "ERROR: lua not found. Install lua first." && exit 1)
@which luarocks > /dev/null || (echo "ERROR: luarocks not found. Install luarocks first." && exit 1)
@echo "✓ Lua and luarocks found"
@echo ""
@echo "Checking dependencies..."
@lua -e 'require("cjson")' 2>/dev/null && echo "✓ lua-cjson installed" || echo "✗ lua-cjson missing"
@lua -e 'require("lfs")' 2>/dev/null && echo "✓ luafilesystem installed" || echo "✗ luafilesystem missing"
deps:
@echo "Installing Lua dependencies..."
@which luarocks > /dev/null || (echo "ERROR: luarocks not found. Please install luarocks first." && exit 1)
@echo "Installing lua-cjson..."
@luarocks install --local lua-cjson || luarocks install lua-cjson
@echo "Installing luafilesystem..."
@luarocks install --local luafilesystem || luarocks install luafilesystem
@echo ""
@echo "✓ Dependencies installed"
install: deps
@echo "Installing luallm..."
@chmod +x $(SCRIPT)
@echo "✓ Made $(SCRIPT) executable"
@mkdir -p $(BINDIR)
@ln -sf $$(pwd)/$(SCRIPT) $(TARGET)
@echo "✓ Symlinked $(TARGET) → $$(pwd)/$(SCRIPT)"
@echo ""
@echo "Installation complete! You can now run: luallm"
@echo ""
@echo "Note: If luarocks installed packages locally, you may need to add this to your shell config:"
@echo ' eval $$(luarocks path --bin)'
uninstall:
@echo "Uninstalling luallm..."
@rm -f $(TARGET)
@echo "✓ Removed symlink $(TARGET)"
@echo ""
@echo "Config files remain at ~/.config/luaLLM/"
@echo "Run 'rm -rf ~/.config/luaLLM' to remove them."
clean:
@echo "Cleaning up..."
@rm -f $(SCRIPT).bak
@echo "✓ Clean complete"