-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
121 lines (105 loc) · 3.68 KB
/
Copy pathMakefile
File metadata and controls
121 lines (105 loc) · 3.68 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
# JXLSwift Makefile
.PHONY: all build test clean install install-man man help docc docc-html docc-preview coverage coverage-html
PREFIX ?= /usr/local
BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/share/man/man1
all: build
## Build the project
build:
@echo "Building JXLSwift..."
swift build -c release
## Run all tests
test:
@echo "Running tests..."
swift test
## Generate man pages
man:
@echo "Generating man pages..."
@mkdir -p Documentation/man
swift package --allow-writing-to-directory Documentation/man \
generate-manual --multi-page --output-directory Documentation/man
## Install jxl-tool binary
install: build
@echo "Installing jxl-tool to $(BINDIR)..."
@mkdir -p $(BINDIR)
@install -m 755 .build/release/jxl-tool $(BINDIR)/jxl-tool
@echo "jxl-tool installed to $(BINDIR)/jxl-tool"
## Install man pages
install-man: man
@echo "Installing man pages to $(MANDIR)..."
@mkdir -p $(MANDIR)
@install -m 644 Documentation/man/*.1 $(MANDIR)/
@if command -v mandb >/dev/null 2>&1; then \
echo "Updating man page database..."; \
mandb -q 2>/dev/null || true; \
fi
@echo "Man pages installed to $(MANDIR)"
## Uninstall jxl-tool binary
uninstall:
@echo "Uninstalling jxl-tool from $(BINDIR)..."
@rm -f $(BINDIR)/jxl-tool
@echo "Uninstalling man pages from $(MANDIR)..."
@rm -f $(MANDIR)/jxl-tool*.1
@if command -v mandb >/dev/null 2>&1; then \
mandb -q 2>/dev/null || true; \
fi
@echo "Uninstalled."
## Clean build artifacts
clean:
@echo "Cleaning build artifacts..."
@rm -rf .build
## Show help
help:
@echo "JXLSwift Makefile"
@echo ""
@echo "Available targets:"
@echo " make build - Build the project in release mode"
@echo " make test - Run all tests"
@echo " make coverage - Generate code coverage report"
@echo " make coverage-html - Generate HTML code coverage report"
@echo " make man - Generate man pages"
@echo " make docc - Generate API documentation with DocC"
@echo " make docc-html - Generate HTML API documentation"
@echo " make docc-preview - Preview API documentation in browser"
@echo " make install - Install jxl-tool binary (requires sudo)"
@echo " make install-man - Install man pages (requires sudo)"
@echo " make uninstall - Uninstall jxl-tool and man pages (requires sudo)"
@echo " make clean - Clean build artifacts"
@echo " make help - Show this help message"
@echo ""
@echo "Options:"
@echo " PREFIX=/path - Installation prefix (default: /usr/local)"
@echo ""
@echo "Examples:"
@echo " sudo make install"
@echo " sudo make install-man"
@echo " make PREFIX=~/.local install"
@echo " make docc-preview"
## Generate API documentation with DocC
docc:
@echo "Generating API documentation..."
swift package --allow-writing-to-package-directory \
generate-documentation --target JXLSwift \
--output-path ./Documentation/API
@echo "Documentation generated in Documentation/API/"
## Generate API documentation in HTML format
docc-html:
@echo "Generating HTML API documentation..."
swift package --allow-writing-to-package-directory \
generate-documentation --target JXLSwift \
--transform-for-static-hosting \
--hosting-base-path JXLSwift \
--output-path ./Documentation/API
@echo "HTML documentation generated in Documentation/API/"
## Preview API documentation
docc-preview:
@echo "Starting documentation preview server..."
swift package --disable-sandbox preview-documentation --target JXLSwift
## Generate code coverage report
coverage:
@echo "Generating code coverage report..."
@./scripts/generate-coverage-report.sh
## Generate code coverage report with HTML output
coverage-html:
@echo "Generating code coverage report with HTML..."
@./scripts/generate-coverage-report.sh --html