summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy White <jwhite@codeweavers.com>2020-04-20 14:22:14 -0500
committerFrediano Ziglio <freddy77@gmail.com>2020-04-21 15:57:20 +0100
commit8aea0b4e7436f82fb8c4d6f6d6952bf3c23d48a0 (patch)
treea3cf34d338f27580c12e49808779157258c38c4c
parentc5cfc19f040fce6ef6ebe2dddb2cd05614c2532f (diff)
Add make style targets.
These use a refined version of the doc/spice_indent tool to make sure that all controlled sources follow the spice style guide. Acked-by: Frediano Ziglio <fziglio@redhat.com>
-rwxr-xr-xdoc/spice_indent19
-rw-r--r--spice-video-dummy/src/Makefile.am3
-rw-r--r--src/Makefile.am3
-rw-r--r--src/tests/Makefile.am3
4 files changed, 18 insertions, 10 deletions
diff --git a/doc/spice_indent b/doc/spice_indent
index ce5c82c..9fc0cec 100755
--- a/doc/spice_indent
+++ b/doc/spice_indent
@@ -13,22 +13,21 @@
# func()
# That requires calling indent with some thoughtfulness
# By default, it will break procedure types onto newlines
-# if you have a file that does not do that, you may want
-# to add
-# --dont-break-procedure-type
-# to your invocation.
+# which is not always the desired behavior
+# Add --dont-break-procedure-type to change that
-if [ ! -f "$1" ] ; then
- echo Error: specify a filename to process with indent
+if [ $# -lt 1 ] ; then
+ echo Error: specify at least one file to process with indent
echo Usage:
- echo 'spice_indent <filename> [ extra-options ]'
+ echo ' spice_indent [ extra-options ] <filename> [ filename... ]'
+ echo 'A useful option is --dont-break-procedure-type'
exit 1
fi
-fname="$1"
-shift
-indent "$fname" \
+# Run the indent command with no version control; we're using git after all...
+VERSION_CONTROL=none \
+indent \
--no-space-after-function-call-names \
--braces-after-func-def-line \
--braces-on-if-line \
diff --git a/spice-video-dummy/src/Makefile.am b/spice-video-dummy/src/Makefile.am
index 8c6e132..33b64af 100644
--- a/spice-video-dummy/src/Makefile.am
+++ b/spice-video-dummy/src/Makefile.am
@@ -39,3 +39,6 @@ spicedummy_drv_la_SOURCES = \
display.c \
dummy.h \
present.c
+
+style: $(spicedummy_drv_la_SOURCES)
+ $(top_srcdir)/../doc/spice_indent $^
diff --git a/src/Makefile.am b/src/Makefile.am
index a079d55..0853bae 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -48,3 +48,6 @@ EXTRA_DIST = \
if HAVE_GTEST
SUBDIRS = tests
endif
+
+style: $(x11spice_SOURCES)
+ $(top_srcdir)/doc/spice_indent --dont-break-procedure-type $^
diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am
index 8b0bb75..e340c72 100644
--- a/src/tests/Makefile.am
+++ b/src/tests/Makefile.am
@@ -39,3 +39,6 @@ callgrind.out.x:
clean-local:
rm -f callgrind.out.*
+
+style: $(x11spice_test_SOURCES)
+ $(top_srcdir)/doc/spice_indent --dont-break-procedure-type $^