[script] now top-level makefile can do ``make format`` for C/C++ files

This commit is contained in:
tangxifan 2022-10-06 16:59:15 -07:00
parent 6230196c21
commit 110b27b3fc
1 changed files with 6 additions and 1 deletions

View File

@ -39,8 +39,9 @@ else
CMAKE_COMMAND := ${CMAKE_COMMAND}
endif
# Define python executable
# Define executables
PYTHON_EXEC ?= python3
CLANG_FORMAT_EXEC ?= clang-format-10
# Put it first so that "make" without argument is like "make help".
export COMMENT_EXTRACT
@ -67,6 +68,10 @@ compile:
all: checkout compile
# A shortcut command to run checkout and compile in serial
format-cpp:
# Format all the C/C++ files under this project, excluding submodules
find libs openfpga -iname *.cpp -iname *.hpp -iname *.c -iname *.h | xargs ${CLANG_FORMAT_EXEC} --style=file -i
clean:
# Remove current build results
rm -rf ${BUILD_DIR} yosys/install