-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
67 lines (56 loc) · 1.84 KB
/
Makefile
File metadata and controls
67 lines (56 loc) · 1.84 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
# Makefile for trace2fio
PYTHON := python3
BLACK := black
BLACK_ARGS := --line-length 100 --target-version py38
SCRIPTS := trace2fio.py
WHITESPACE_FIX := scripts/fix_whitespace_issues.py
.PHONY: help style check-style fix-style install-dev clean test
help:
@echo "trace2fio Makefile"
@echo ""
@echo "Targets:"
@echo " style - Fix code style (whitespace + black formatting)"
@echo " check-style - Check code style without modifying files"
@echo " fix-style - Fix whitespace issues and apply black formatting"
@echo " install-dev - Install development dependencies (black)"
@echo " test - Run basic sanity tests"
@echo " clean - Remove generated files"
install-dev:
@echo "Installing development dependencies..."
@$(PYTHON) -m pip install --user black || { \
echo "Error: Failed to install black"; \
echo "Try: python3 -m pip install --user black"; \
exit 1; \
}
@echo "Development dependencies installed successfully"
check-black:
@which $(BLACK) > /dev/null 2>&1 || { \
echo "Error: black is not installed"; \
echo "Run 'make install-dev' to install it"; \
exit 1; \
}
check-style: check-black
@echo "Checking code style..."
@$(PYTHON) $(WHITESPACE_FIX) $(SCRIPTS) || true
@$(BLACK) $(BLACK_ARGS) --check --diff $(SCRIPTS)
@echo "Style check complete"
fix-style: check-black
@echo "Fixing whitespace issues..."
@$(PYTHON) $(WHITESPACE_FIX) $(SCRIPTS)
@echo "Applying black formatting..."
@$(BLACK) $(BLACK_ARGS) $(SCRIPTS)
@echo "Style fixes applied"
style: fix-style
@echo "Code style is now compliant"
test:
@echo "Running basic sanity tests..."
@$(PYTHON) -m py_compile $(SCRIPTS)
@$(PYTHON) trace2fio.py --help > /dev/null
@echo "Basic tests passed"
clean:
@echo "Cleaning up..."
@rm -rf __pycache__
@rm -f *.pyc *.pyo
@rm -f *.fio *.dat
@echo "Clean complete"
.DEFAULT_GOAL := help