47 lines
1.4 KiB
Makefile
47 lines
1.4 KiB
Makefile
ROOT_DIR := $(shell pwd)
|
|
VENV_BIN_DIR := $(ROOT_DIR)/.venv/bin
|
|
USER_BIN_DIR := $(HOME)/.local/bin
|
|
COMMANDS := myagents myclaude mykimi
|
|
COMP_DIR := $(HOME)/.local/bin/completions
|
|
|
|
.PHONY: help install uninstall _symlink-commands _install-completions _uninstall-completions
|
|
|
|
help:
|
|
@echo "Usage: make [target]"
|
|
@echo ""
|
|
@echo " install Sync venv, symlink bin, install completions"
|
|
@echo " uninstall Remove bin and completions"
|
|
install:
|
|
@cd "$(ROOT_DIR)" && \
|
|
if command -v uv >/dev/null 2>&1; then \
|
|
uv sync; \
|
|
else \
|
|
test -x .venv/bin/pip || python3 -m venv .venv; \
|
|
PIP_USER=0 .venv/bin/pip install -e .; \
|
|
fi
|
|
@$(MAKE) _symlink-commands
|
|
@$(MAKE) _install-completions
|
|
|
|
_symlink-commands:
|
|
@mkdir -p "$(USER_BIN_DIR)"
|
|
@for cmd in $(COMMANDS); do \
|
|
src="$(VENV_BIN_DIR)/$$cmd"; \
|
|
dst="$(USER_BIN_DIR)/$$cmd"; \
|
|
test -x "$$src" || { echo "error: missing $$src"; exit 1; }; \
|
|
ln -sf "$$src" "$$dst"; \
|
|
echo "Linked $$dst -> $$src"; \
|
|
done
|
|
|
|
_install-completions:
|
|
@$(ROOT_DIR)/scripts/install_completion.sh "$(VENV_BIN_DIR)" "$(COMP_DIR)"
|
|
|
|
uninstall: _uninstall-completions
|
|
@ROOT_DIR="$(ROOT_DIR)" python3 "$(ROOT_DIR)/scripts/rm_user_local_myagents.py"
|
|
|
|
_uninstall-completions:
|
|
@rm -f \
|
|
"$(COMP_DIR)/_myagents" "$(COMP_DIR)/myagents.bash" \
|
|
"$(COMP_DIR)/_myclaude" "$(COMP_DIR)/myclaude.bash" \
|
|
"$(COMP_DIR)/_mykimi" "$(COMP_DIR)/mykimi.bash"
|
|
@echo "Removed completions"
|