]> git.ipfire.org Git - thirdparty/libvirt.git/commit
build: enforce makefile conditional style
authorEric Blake <eblake@redhat.com>
Wed, 4 Sep 2013 02:39:16 +0000 (20:39 -0600)
committerEric Blake <eblake@redhat.com>
Wed, 4 Sep 2013 15:40:20 +0000 (09:40 -0600)
commitec81852f4622eac397bfdc5fc2dd3d5933804209
tree3b566c8cc4409ad1d6b5eac260b1c8a81bf6fb93
parentd7d8fef4b91daca1be22e2e312b29ce4916e1cff
build: enforce makefile conditional style

Automake has builtin support to prevent botched conditional nesting,
but only if you use:
if FOO
else !FOO
endif !FOO

An example error message when using the wrong name:

daemon/Makefile.am:378: error: else reminder (LIBVIRT_INIT_SCRIPT_SYSTEMD_TRUE) incompatible with current conditional: LIBVIRT_INIT_SCRIPT_SYSTEMD_FALSE
daemon/Makefile.am:381: error: endif reminder (LIBVIRT_INIT_SCRIPT_SYSTEMD_TRUE) incompatible with current conditional: LIBVIRT_INIT_SCRIPT_SYSTEMD_FALSE

As our makefiles tend to have quite a bit of nested conditionals,
it's better to take advantage of the benefits of the build system
double-checking that our conditionals are well-nested, but that
requires a syntax check to enforce our usage style.

Alas, unlike C preprocessor and spec files, we can't use indentation
to make it easier to see how deeply nesting goes.

* cfg.mk (sc_makefile_conditionals): New rule.
* daemon/Makefile.am: Enforce the style.
* gnulib/tests/Makefile.am: Likewise.
* python/Makefile.am: Likewise.
* src/Makefile.am: Likewise.
* tests/Makefile.am: Likewise.
* tools/Makefile.am: Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
cfg.mk
daemon/Makefile.am
gnulib/tests/Makefile.am
python/Makefile.am
src/Makefile.am
tests/Makefile.am
tools/Makefile.am