# redpitaya_projects - venv and MCP server helper targets.

VENV   := .venv
PYTHON := $(VENV)/bin/python
PIP    := $(VENV)/bin/pip
STAMP  := $(VENV)/.installed

.PHONY: venv mcp distclean

# Create the virtual environment and install dependencies. Re-runs only when
# it is missing or when requirements.txt changes (tracked by the stamp file).
$(STAMP): requirements.txt
	python3 -m venv --system-site-packages $(VENV)
	$(PIP) install -r requirements.txt
	touch $(STAMP)

venv: $(STAMP)

# Run the MCP server (stdio) so an MCP client can use it as a tool.
mcp: $(STAMP)
	$(PYTHON) mcp/mcp_server.py

distclean:
	rm -rf $(VENV)
