From 54b8236625d75a4047a61a70e5357e1dee668c74 Mon Sep 17 00:00:00 2001 From: damien DELPY Date: Fri, 21 Mar 2025 15:16:57 +0100 Subject: [PATCH] feat(Makefile): adding rules to format the code with clang. --- .clang-format | 1 + Makefile | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..f18bbda --- /dev/null +++ b/.clang-format @@ -0,0 +1 @@ +BasedOnStyle: webkit diff --git a/Makefile b/Makefile index 2bb6f59..642f58a 100644 --- a/Makefile +++ b/Makefile @@ -54,6 +54,7 @@ else endif srcs+=$(wildcard ${src_dir}/*.c ${src_dir}/**/*.c) +headers+=$(wildcard ${src_dir}/*.h ${src_dir}/**/*.h) objs+=$(patsubst %.c,${build_dir}/%.o,${srcs}) .PHONY: all @@ -122,6 +123,14 @@ ${build_dir}/%.o: %.c compile_flags.txt: (echo "${CFLAGS} ${LDFLAGS}" | sed 's/ /\n/g') > compile_flags.txt +.PHONY: format +format: + clang-format -i ${srcs} ${headers} + +.PHONY: check_format +check_format: + clang-format --dry-run --Werror ${srcs} ${headers} + .PHONY: clean clean: ${RM} -r build install