-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
58 lines (44 loc) · 1.76 KB
/
Makefile
File metadata and controls
58 lines (44 loc) · 1.76 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
# Makefile for EPUB to XTC Converter & Optimizer
.PHONY: all serve docker-serve cli-install cli-convert cli-optimize tag help
PORT ?= 8000
# Default target
all: help
## Development:
serve: ## Run local web server (http://localhost:8000)
@echo "Starting server at http://localhost:8000"
@cd web && python3 -m http.server 8000
docker-serve: ## Run in Docker (Ctrl+C to stop). Usage: make docker-serve [PORT=8000]
@docker build -t epub-to-xtc .
@echo "Running at http://localhost:$(PORT) (Ctrl+C to stop)"
@docker run --rm -p $(PORT):8000 epub-to-xtc
## CLI:
cli-install: ## Install CLI dependencies
@cd cli && npm install
cli-convert: ## Convert EPUB to XTC. Usage: make cli-convert INPUT=book.epub OUTPUT=book.xtc CONFIG=settings.json
@cd cli && node index.js convert $(INPUT) -o $(OUTPUT) -c $(CONFIG)
cli-optimize: ## Optimize EPUB for e-paper. Usage: make cli-optimize INPUT=book.epub OUTPUT=optimized.epub CONFIG=settings.json
@cd cli && node index.js optimize $(INPUT) -o $(OUTPUT) -c $(CONFIG)
## Release:
tag: ## Create and push a version tag (triggers GitHub release)
@read -p "Enter tag version (e.g., 1.0.0): " TAG; \
if [[ $$TAG =~ ^[0-9]+\.[0-9]+\.[0-9]+$$ ]]; then \
git tag -a v$$TAG -m "v$$TAG"; \
git push origin v$$TAG; \
echo "Tag v$$TAG created and pushed successfully."; \
else \
echo "Invalid tag format. Please use X.Y.Z (e.g., 1.0.0)"; \
exit 1; \
fi
## Help:
help: ## Show this help
@echo "EPUB to XTC Converter - Commands"
@echo ""
@echo "Usage: make [target]"
@echo ""
@awk 'BEGIN {FS = ":.*##"; section=""} \
/^##/ { section=substr($$0, 4); next } \
/^[a-zA-Z_-]+:.*##/ { \
if (section != "") { printf "\n\033[1m%s\033[0m\n", section; section="" } \
printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 \
}' $(MAKEFILE_LIST)
@echo ""