-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
62 lines (47 loc) · 2.03 KB
/
Makefile
File metadata and controls
62 lines (47 loc) · 2.03 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
.DEFAULT_GOAL := all
.PHONY: all tidy tidy-tests tidy-sdl-ibmf tidy-sdl-ttf format format-check test examples-sdl-ibmf run-examples-sdl-ibmf examples-sdl-ttf run-examples-sdl-ttf
all: test examples-sdl-ibmf examples-sdl-ttf
# Convenience delegations to sub-makefiles
test:
@$(MAKE) -C tests test
examples-sdl-ibmf:
@$(MAKE) -C examples/SDL/IBMF build
run-examples-sdl-ibmf:
@$(MAKE) -C examples/SDL/IBMF run
examples-sdl-ttf:
@$(MAKE) -C examples/SDL/TTF build
run-examples-sdl-ttf:
@$(MAKE) -C examples/SDL/TTF run
clean:
@$(MAKE) -C tests clean
@$(MAKE) -C examples/SDL/IBMF clean
@$(MAKE) -C examples/SDL/TTF clean
@$(MAKE) -C examples/esp-idf clean
# Override to your local installation if needed
CLANG_TIDY_RUN ?= run-clang-tidy
CMAKE_FLAGS ?= -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
# Exclude vendored freetype and Catch2 amalgamation from analysis
TIDY_FILES ?= '^(?!.*(/freetype/|/Catch2/catch_amalgamated\\.cpp|/Catch2/catch_amalgamated\\.hpp)).*$$'
tidy: tidy-tests tidy-sdl-ibmf tidy-sdl-ttf
tidy-tests:
@mkdir -p tests/build
@cmake -S tests -B tests/build $(CMAKE_FLAGS)
@$(CLANG_TIDY_RUN) -p tests/build $(TIDY_FILES)
tidy-sdl-ibmf:
@mkdir -p examples/SDL/IBMF/build
@cmake -S examples/SDL/IBMF -B examples/SDL/IBMF/build $(CMAKE_FLAGS)
@$(CLANG_TIDY_RUN) -p examples/SDL/IBMF/build $(TIDY_FILES)
tidy-sdl-ttf:
@mkdir -p examples/SDL/TTF/build
@cmake -S examples/SDL/TTF -B examples/SDL/TTF/build $(CMAKE_FLAGS)
@$(CLANG_TIDY_RUN) -p examples/SDL/TTF/build $(TIDY_FILES)
# Currently formatted with clang-format 19
CLANG_FORMAT ?= clang-format
# Format all tracked C/C++ sources via git, excluding freetype and Catch2 amalgamation
FORMAT_FILES := $(shell git ls-files '*.c' '*.cc' '*.cxx' '*.cpp' '*.h' '*.hpp' | grep -Ev '^(freetype/|tests/Catch2/)')
format:
@echo Formatting $$((`echo "$(FORMAT_FILES)" | wc -w`)) files...
@echo "$(FORMAT_FILES)" | xargs -n 50 $(CLANG_FORMAT) -i
format-check:
@echo Checking format on $$((`echo "$(FORMAT_FILES)" | wc -w`)) files...
@echo "$(FORMAT_FILES)" | xargs -n 50 $(CLANG_FORMAT) -n --Werror