Add formatting option for verilog files.
Make this a separate format-verilog target for now,
as not everyone has verible installed and there are a few
files that it can't format (the \$_BUF_ stuff in particular).
Simplify double-line format call with single line
for c++ formatting.
Set editorconfig to the standard indentation
according to styleguide.
Signed-off-by: Henner Zeller <h.zeller@acm.org>
diff --git a/.editorconfig b/.editorconfig
index 3d5437b..01caaf8 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -10,3 +10,7 @@
[*.{h,cc,tcl}]
indent_style = space
indent_size = 4
+
+[*.{v,sv}]
+indent_style = space
+indent_size = 2
diff --git a/Makefile b/Makefile
index 41d358a..6cd041d 100644
--- a/Makefile
+++ b/Makefile
@@ -31,6 +31,10 @@
clean: $(PLUGINS_CLEAN)
CLANG_FORMAT ?= clang-format-5.0
+
format:
- find . -name \*.cc -and -not -path './third_party/*' -print0 | xargs -0 -P $$(nproc) ${CLANG_FORMAT} -style=file -i
- find . -name \*.h -and -not -path './third_party/*' -print0 | xargs -0 -P $$(nproc) ${CLANG_FORMAT} -style=file -i
+ find . \( -name "*.h" -o -name "*.cc" \) -and -not -path './third_party/*' -print0 | xargs -0 -P $$(nproc) ${CLANG_FORMAT} -style=file -i
+
+VERIBLE_FORMAT ?=verible-verilog-format
+format-verilog:
+ find */tests \( -name "*.v" -o -name "*.sv" \) -and -not -path './third_party/*' -print0 | xargs -0 $(VERIBLE_FORMAT) --inplace