-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
142 lines (121 loc) · 4.87 KB
/
Copy pathMakefile
File metadata and controls
142 lines (121 loc) · 4.87 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# Liquid Neural Networks - Makefile
# Org-mode tangle/detangle operations
.PHONY: help tangle detangle clean-tangled setup-tangle all run-clojure run-python test test-clojure test-python deps install
# Python interpreter (override with: make PYTHON=python3.12 ...)
PYTHON ?= python3
# Default target
all: help
# Help target
help:
@echo "Liquid Neural Networks - Makefile Commands"
@echo "========================================="
@echo " make tangle - Tangle all code blocks from SETUP.org"
@echo " make detangle - Extract code back to SETUP.org (updates)"
@echo " make clean-tangled - Remove all tangled files"
@echo " make setup-tangle - Tangle and create directory structure"
@echo " make run-clojure - Run Clojure LNN implementation"
@echo " make run-python - Run Python LNN implementation"
@echo " make test - Run all tests"
@echo " make test-clojure - Run Clojure tests"
@echo " make test-python - Run Python tests"
@echo " make deps - Install all dependencies"
@echo " make install - Install project in development mode"
@echo " make help - Show this help message"
# Tangle SETUP.org to extract all code blocks
tangle:
@echo "Tangling SETUP.org..."
@emacs --batch --eval "(require 'org)" \
--eval "(setq org-babel-tangle-comment-format-beg \"\")" \
--eval "(setq org-babel-tangle-comment-format-end \"\")" \
--eval "(org-babel-tangle-file \"SETUP.org\")"
@echo "✓ Tangling complete"
# Tangle README.org separately
tangle-readme:
@echo "Tangling README.org..."
@emacs --batch --eval "(require 'org)" \
--eval "(setq org-babel-tangle-comment-format-beg \"\")" \
--eval "(setq org-babel-tangle-comment-format-end \"\")" \
--eval "(org-babel-tangle-file \"README.org\")"
@echo "✓ README tangling complete"
# Detangle - extract code changes back to SETUP.org
detangle:
@echo "Detangling code back to SETUP.org..."
@emacs --batch --eval "(require 'org)" \
--eval "(setq org-src-preserve-indentation t)" \
--eval "(org-babel-detangle \"SETUP.org\")"
@echo "✓ Detangling complete"
# Clean all tangled files
clean-tangled:
@echo "Cleaning tangled files..."
@rm -rf src/liquid_neural_networks/core.clj
@rm -rf src/python/lnn_research.py
@rm -rf scripts/setup.sh
@rm -rf docker/Dockerfile
@rm -rf scripts/create_structure.sh
@rm -rf scripts/freebsd_setup.sh
@echo "✓ Cleaned tangled files"
# Setup and tangle
setup-tangle: tangle
@echo "Running setup scripts..."
@[ -f scripts/create_structure.sh ] && sh scripts/create_structure.sh || true
@echo "✓ Setup complete"
# Watch for changes and auto-tangle (requires inotify-tools or fswatch)
watch:
@echo "Watching SETUP.org for changes..."
@if command -v fswatch >/dev/null 2>&1; then \
fswatch -o SETUP.org | xargs -n1 -I{} make tangle; \
else \
echo "Please install fswatch: pkg install fswatch"; \
exit 1; \
fi
# Verify org-mode is available
check-org:
@emacs --batch --eval "(require 'org)" --eval "(princ (org-version))" || \
(echo "Error: Emacs org-mode not found" && exit 1)
# Generate README.md from README.org
README.md: README.org
@echo "Generating README.md from README.org..."
@emacs --batch --eval "(require 'org)" \
--eval "(require 'ox-md)" \
--eval "(with-current-buffer (find-file-noselect \"$<\") (org-md-export-to-markdown))"
@echo "✓ README.md generated"
# Run Clojure implementation
run-clojure:
@echo "Running Clojure LNN implementation..."
@clojure -M -m liquid-neural-networks.core
# Run Python implementation
run-python:
@echo "Running Python LNN implementation..."
@cd src && $(PYTHON) -m liquid_neural_networks.core
# Run research Python implementation
run-python-research:
@echo "Running Python research implementation..."
@cd src && $(PYTHON) python/lnn_research.py
# Test targets
test: test-clojure test-python
test-clojure:
@echo "Running Clojure tests..."
@bb test
test-python:
@echo "Running Python tests..."
@$(PYTHON) -m pytest tests/ --verbose || echo "No Python tests found or test failures"
# Basic smoke tests
smoke-test: tangle
@echo "Running smoke tests..."
@echo "Testing Python basic import..."
@cd src && $(PYTHON) -c "from liquid_neural_networks.core import greet; print(greet('Smoke Test'))"
@echo "Testing Clojure basic syntax..."
@clojure -e "(println \"Clojure smoke test successful\")"
@echo "✓ Smoke tests passed"
# Dependency management
deps:
@echo "Installing dependencies..."
@echo "Checking Python dependencies with uv..."
@uv pip install -r requirements-minimal.txt || echo "requirements-minimal.txt not found or issues"
@echo "Checking Clojure dependencies..."
@clojure -M -e "(println \"Clojure dependencies check completed\")" || echo "Clojure dependency issues - see deps.edn"
@echo "✓ Dependencies check completed"
install: deps
@echo "Installing project in development mode..."
@uv pip install -e . || echo "Python package installation failed"
@echo "✓ Installation completed"