From: Geert Stappers <stapp...@stappers.nl>

For keeping the source code in shape, you do:
    make format
or just
    make fmt

File CodingStyle has `make fmt` documented
for being closer to the "Go-lang" and/or the "Rust" world.
---
 CodingStyle | 7 +++++++
 Makefile    | 9 +++++++++
 2 files changed, 16 insertions(+)

diff --git a/CodingStyle b/CodingStyle
index fb8c5b9..58d83e6 100644
--- a/CodingStyle
+++ b/CodingStyle
@@ -13,3 +13,10 @@ Further
 
 In file .clang-format is the machine readable version
 of the Dnsmasq coding style.
+
+
+Format
+------
+
+To format the code execute:
+    make fmt
diff --git a/Makefile b/Makefile
index 48e8d3b..b5be2ba 100644
--- a/Makefile
+++ b/Makefile
@@ -134,6 +134,15 @@ merge :
                echo -n msgmerge $(PO)/$$f && $(MSGMERGE) --no-wrap -U 
$(PO)/$$f $(BUILDDIR)/dnsmasq.pot; \
        done
 
+# enforce Coding Style
+format:
+       clang-format \
+               --style=file \
+               -i src/*.c src/*.h
+
+# alias inspired by `go fmt` and `cargo fmt`
+fmt: format
+
 # Canonicalise .po file.
 %.po : 
        @cd $(BUILDDIR) && $(MAKE) -f $(top)/Makefile dnsmasq.pot
-- 
2.37.2


_______________________________________________
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss

Reply via email to