-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
132 lines (108 loc) · 3.38 KB
/
Makefile
File metadata and controls
132 lines (108 loc) · 3.38 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
VIRTUAL_ENV := ./.venv
LANG := en
ifeq ($(OS),Windows_NT)
YOUR_OS := Windows
INSTALL_TARGET := install-windows
SYSTEM_PYTHON := python3
else
YOUR_OS := $(shell sh -c 'uname 2>/dev/null || echo Unknown')
ifeq ($(YOUR_OS), Linux)
INSTALL_TARGET := install-linux
MKDOCS := mkdocs
SYSTEM_PYTHON := python3
endif
ifeq ($(YOUR_OS), Darwin)
INSTALL_TARGET := install-macos
OPEN_EDITORS_VERSION_TARGET := open-editors-version-macos
OPEN_RELEASE_VERSION_TARGET := open-release-version-macos
MKDOCS := mkdocs
SYSTEM_PYTHON := python3
endif
endif
VENV_MKDOCS := $(VIRTUAL_ENV)/bin/mkdocs
VENV_PYTHON := $(VIRTUAL_ENV)/bin/python3
CURRENT_BRANCH := $(shell git branch --show-current)
.PHONY: all
all: docs-build
.PHONY: info
info: python-venv
@echo "Git Branch: ${CURRENT_BRANCH}"
@echo "Operating System: ${YOUR_OS}"
@echo "System Python: ${SYSTEM_PYTHON} version: $$($(SYSTEM_PYTHON) --version)"
@echo "Virtual Env Python: ${VENV_PYTHON} version: $$($(VENV_PYTHON) --version)"
@echo "install target: ${INSTALL_TARGET}"
.PHONY: clean
clean:
@echo Cleaning
@rm -rf site 2>/dev/null |true
@rm -rf .venv/lib/python3.10/site-packages 2>/dev/null || true
.PHONY: install
install: info install-brew install-brew-packages install-python-packages
.PHONY: install-github-actions
install-github-actions: info install-brew-packages install-python-packages
.PHONY: install-brew-packages
install-brew-packages:
@echo "Install packages via HomeBrew:"
brew upgrade cairo || brew install cairo
brew upgrade freetype || brew install freetype
brew upgrade libffi || brew install libffi
brew upgrade pango || brew install pango
brew upgrade libjpeg || brew install libjpeg
brew upgrade libpng || brew install libpng
brew upgrade zlib || brew install zlib
brew upgrade plantuml || brew install plantuml
brew upgrade graphviz || brew install graphviz
.PHONY: install-brew
ifeq ($(YOUR_OS), Linux)
install-brew: install-brew-linux
endif
ifeq ($(YOUR_OS), Windows)
install-brew: install-brew-windows
endif
ifeq ($(YOUR_OS), Darwin)
install-brew: install-brew-macos
endif
.PHONY: install-brew-linux
install-brew-linux:
@if ! command -v brew >/dev/null 2>&1 ; then echo "Install HomeBrew" ; exit 1 ; fi
brew --version
#
# not sure if HomeBrew can be installed on Windows, this part has not been tested yet!
#
.PHONY: install-brew-windows
install-brew-windows:
@if ! command -v brew >/dev/null 2>&1 ; then echo "Install HomeBrew" ; exit 1 ; fi
brew --version
.PHONY: install-brew-macos
install-brew-macos:
@if ! command -v brew >/dev/null 2>&1 ; then echo "Install HomeBrew" ; exit 1 ; fi
brew --version
.PHONY: install-python-packages
install-python-packages: install-standard-python-packages install-special-python-packages
.PHONY: install-standard-python-packages
install-standard-python-packages:
@echo "Install dependencies using uv (uv will create .venv automatically if needed):"
uv sync
.PHONY: install-special-python-packages
install-special-python-packages:
$(VENV_MKDOCS): install-python-packages
.PHONY: python-venv
python-venv:
@echo "Note: uv automatically creates .venv when running 'uv sync' or 'uv run'"
@if [ ! -d "$(VIRTUAL_ENV)" ] ; then \
uv sync ; \
fi
.PHONY: format
format:
uv run ruff format .
.PHONY: format-check
format-check:
uv run ruff format --check .
.PHONY: lint
lint:
uv run ruff check .
.PHONY: lint-fix
lint-fix:
uv run ruff check --fix .
.PHONY: check
check: format-check lint