File tree Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ if(BUILD_TESTING)
3030 include (cmake/include /unittest.cmake)
3131endif ()
3232
33+ include (cmake/include /clang-format.cmake)
3334include (cmake/include /doxygen.cmake)
3435
3536# ##############################################################################
Original file line number Diff line number Diff line change 1+ # SPDX-FileCopyrightText: Silicon Laboratories Inc. <https://www.silabs.com/>
2+ # SPDX-License-Identifier: ZLIB
3+
4+ file (GLOB_RECURSE sources_list *.c *.cpp *.h *.hpp)
5+ list (FILTER sources_list EXCLUDE REGEX ".git/.*" )
6+ list (FILTER sources_list EXCLUDE REGEX "${CMAKE_BINARY_DIR} /.*" )
7+ list (FILTER sources_list EXCLUDE REGEX ".*/ZW_classcmd.h" )
8+ if (NOT ENV{uncrustify_args})
9+ set (uncrustify_args --replace)
10+ endif ()
11+
12+ string (REPLACE ";" "\n " sources_list_text "${sources_list} " )
13+ file (WRITE "${CMAKE_BINARY_DIR} /sources.lst" ${sources_list_text} )
14+
15+ add_custom_target (lint
16+ COMMAND clang-format -i --files ="${CMAKE_BINARY_DIR} /sources.lst"
17+ WORKING_DIRECTORY "${CMAKE_SOURCE_DIR} "
18+ DEPENDS "${CMAKE_BINARY_DIR} /sources.lst"
19+ )
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ export CMAKE_GENERATOR
3030
3131build_dir? =build
3232sudo? =sudo
33+ cmake? =cmake
3334
3435debian_codename? =bookworm
3536
@@ -231,6 +232,10 @@ all: ${build_dir}/CMakeCache.txt
231232# cmake --build ${<D} \
232233# || cat ${build_dir}/CMakeFiles/CMakeOutput.log
233234 cmake --build ${<D}
235+
236+ cmake/% : ${build_dir}/CMakeCache.txt
237+ ${cmake} --build ${<D} --target=${@ F}
238+
234239.PHONY : all
235240
236241${build_dir}/% : all
306311 file -E ${run_file}
307312 ${run_file} ${run_args}
308313
314+ lint : .clang-format cmake/lint
315+ git status
316+
309317# ## @rootfs is faster than docker for env check
310318
311319rootfs_dir? =/var/tmp/var/lib/machines/${project}
You can’t perform that action at this time.
0 commit comments