diff --git a/Makefile b/Makefile index 201bb3e1f..9651008e4 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,7 @@ endif PYTHON_EXEC ?= python3 CLANG_FORMAT_EXEC ?= clang-format-10 XML_FORMAT_EXEC ?= xmllint +PYTHON_FORMAT_EXEC ?= black # Put it first so that "make" without argument is like "make help". export COMMENT_EXTRACT @@ -83,6 +84,13 @@ format-xml: XMLLINT_INDENT=" " && ${XML_FORMAT_EXEC} --format $${f} --output $${f} || exit 1; \ done +format-py: +# Format all the python scripts under this project, excluding submodules + for f in `find openfpga_flow/scripts -iname *.py`; \ + do \ + ${PYTHON_FORMAT_EXEC} $${f} --line-length 100 || exit 1; \ + done + clean: # Remove current build results rm -rf ${BUILD_DIR} yosys/install