-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·54 lines (47 loc) · 2.31 KB
/
Copy pathMakefile
File metadata and controls
executable file
·54 lines (47 loc) · 2.31 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
# ══════════════════════════════════════════════════════════════════════════════
# Makefile for smoltome (Explicit Script Invocation & Directory Auto-Scanning)
# ══════════════════════════════════════════════════════════════════════════════
# Core Variables
PYTHON := python3
SRC := smoltome.py
DEFAULT_PORT := 8080
DEFAULT_VLT := library.vault
.PHONY: all help convert serve clean
all: help
help:
@echo "smoltome Current-Directory Automation Workflows"
@echo "=================================================="
@echo "Execution Subcommands:"
@echo " make convert - Pack all local .epub files directly into $(DEFAULT_VLT)"
@echo " make serve - Scan local dir for the first .vault file and boot web reader"
@echo ""
@echo "Maintenance:"
@echo " make clean - Strip temporary cache structures and bytecode buffers"
convert:
@echo "Scanning current directory for EPUB files..."
@# Verify that there is at least one .epub file before invoking
@if [ -n "$$(ls *.epub 2>/dev/null)" ]; then \
echo "Found EPUBs. Passing current directory context down to script..."; \
$(PYTHON) $(SRC) convert --vault $(DEFAULT_VLT) --epub-dir . ; \
else \
echo "Error: No .epub files discovered in the current directory."; \
exit 1; \
fi
serve:
@echo "Scanning current directory for active database vaults..."
@# Find the first .vault file available in the local directory
@VAULT_FILE=$$(ls *.vault 2>/dev/null | head -n 1); \
if [ -n "$$VAULT_FILE" ]; then \
echo "Discovered vault: $$VAULT_FILE"; \
echo "Booting web reader environment on port $(DEFAULT_PORT)..."; \
$(PYTHON) $(SRC) read --port $(DEFAULT_PORT) --vault "$$VAULT_FILE"; \
else \
echo "Error: No matching .vault index stores found in this directory."; \
echo "Please execute 'make convert' first to compile your libraries."; \
exit 1; \
fi
clean:
@echo "Removing generated environment runtime structures..."
rm -rf __pycache__ .mypy_cache
find . -type d -name "__pycache__" -exec rm -rf {} +
find . -type f -name "*.pyc" -delete