-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
70 lines (48 loc) · 2 KB
/
makefile
File metadata and controls
70 lines (48 loc) · 2 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
################################################################################
include tools/makefiles/functions/makefile
include tools/makefiles/subdir/makefile
################################################################################
CXX_FORMATTER = clang-format-20
CXX_FORMATTER_FLAGS += --style='{BasedOnStyle: Chromium, ColumnLimit: 100, SortIncludes: true}'
CXX_FORMATTER_FLAGS += --Werror
CXX_FORMATTER_FLAGS += -i
PYTHON_FORMATTER = python3 -m black
PYTHON_FORMATTER_FLAGS +=
ifneq ($(findstring lint, $(MAKECMDGOALS)),)
CXX_FORMATTER_FLAGS += --dry-run
PYTHON_FORMATTER_FLAGS += --check
endif
################################################################################
OS := $(shell lsb_release -is | tr A-Z a-z)
################################################################################
year ?=
day ?=
ifeq ($(MAKECMDGOALS),setup-day)
ifeq ($(year),)
$(error $(MAKECMDGOALS): year is required)
endif
ifeq ($(day),)
$(error $(MAKECMDGOALS): day is required)
endif
endif
setup-day:
$(Q) tools/scripts/aoc_setup_day.py --year $(year) --day $(day) --repo-root-path $(shell git rev-parse --show-toplevel)
################################################################################
install-deps:
$(Q) tools/deps/os/$(OS).sh
$(Q) python3 -m pip install -r tools/deps/python/requirements.txt
ci:
$(Q) $(MAKE) versions verbose=true
$(Q) $(MAKE) lint verbose=true
$(Q) $(MAKE) run verbose=true
lint: _lint_cxx _lint_python
format: _format_cxx _format_python
_lint_cxx _format_cxx:
$(Q) find . -type f \( -iname '*.h' -o -iname '*.cpp' \) -exec $(CXX_FORMATTER) $(CXX_FORMATTER_FLAGS) \{\} \+
_lint_python _format_python:
$(Q) find . -type f -name '*.py' -exec $(PYTHON_FORMATTER) $(PYTHON_FORMATTER_FLAGS) \{\} \+
versions:
$(call print_tool_version,CXX_FORMATTER,$(CXX_FORMATTER))
$(call print_tool_version,PYTHON_FORMATTER,$(PYTHON_FORMATTER))
$(Q) $(MAKE) -C tools/makefiles/compile versions verbose=true
################################################################################