40 lines
1.2 KiB
Makefile
40 lines
1.2 KiB
Makefile
ROOT_DIR := $(shell pwd)
|
|
VENV_MYCLAUDE := $(ROOT_DIR)/.venv/bin/myclaude
|
|
USER_LOCAL_MYCLAUDE := $(HOME)/.local/bin/myclaude
|
|
COMP_DIR := $(HOME)/.local/bin/completions
|
|
|
|
.PHONY: help install uninstall _symlink-myclaude _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-myclaude
|
|
@$(MAKE) _install-completions
|
|
|
|
_symlink-myclaude:
|
|
@test -x "$(VENV_MYCLAUDE)" || { echo "error: missing $(VENV_MYCLAUDE)"; exit 1; }
|
|
@mkdir -p "$(HOME)/.local/bin"
|
|
@ln -sf "$(VENV_MYCLAUDE)" "$(USER_LOCAL_MYCLAUDE)"
|
|
@echo "Linked $(USER_LOCAL_MYCLAUDE) -> $(VENV_MYCLAUDE)"
|
|
|
|
_install-completions:
|
|
@$(ROOT_DIR)/scripts/install_completion.sh "$(VENV_MYCLAUDE)" "$(COMP_DIR)"
|
|
|
|
uninstall: _uninstall-completions
|
|
@ROOT_DIR="$(ROOT_DIR)" python3 "$(ROOT_DIR)/scripts/rm_user_local_myclaude.py"
|
|
|
|
_uninstall-completions:
|
|
@rm -f "$(COMP_DIR)/_myclaude" "$(COMP_DIR)/myclaude.bash"
|
|
@echo "Removed completions"
|