According to the automake manual, CPPFLAGS (aka INCLUDES, as spelled
in automake 1.9.6) should only include -I, -D, and -U directives; more
generic directives like -Wall belong in CFLAGS since they affect more
phases of the build process.  Therefore, we should be sticking CFLAGS
additions into a CFLAGS container, not a CPPFLAGS container.

* src/Makefile.am (INCLUDES): Move CFLAGS items...
(AM_CFLAGS): ...to their proper location.
* python/Makefile.am (INCLUDES, AM_CFLAGS): Likewise.
* tests/Makefile.am (INCLUDES, AM_CFLAGS): Likewise.
---

v1 had no review:
https://www.redhat.com/archives/libvir-list/2011-May/msg01934.html
changes from v1: rebase to latest

I tested it on top of these two patches, hopefully they'll be ack'd first:
 https://www.redhat.com/archives/libvir-list/2011-June/msg01537.html
 https://www.redhat.com/archives/libvir-list/2011-June/msg01486.html

 python/Makefile.am |    5 +++--
 src/Makefile.am    |   15 +++++++--------
 tests/Makefile.am  |    8 +++++---
 3 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/python/Makefile.am b/python/Makefile.am
index 432ad70..0edb3e4 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -3,12 +3,13 @@
 SUBDIRS= . tests

 INCLUDES = \
-        $(WARN_CFLAGS) \
-        $(PYTHON_INCLUDES) \
+       $(PYTHON_INCLUDES) \
        -I$(top_srcdir)/include \
        -I$(top_builddir)/include \
        -I$(top_builddir)/$(subdir)

+AM_CFLAGS = $(WARN_CFLAGS)
+
 DOCS_DIR = $(datadir)/doc/libvirt-python-$(LIBVIRT_VERSION)

 DOCS = ${srcdir}/TODO
diff --git a/src/Makefile.am b/src/Makefile.am
index 4ba3ea7..10ee20a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,20 +3,19 @@
 # No libraries with the exception of LIBXML should be listed
 # here. List them against the individual XXX_la_CFLAGS targets
 # that actually use them
-INCLUDES =                                                     \
-               -I$(top_srcdir)/gnulib/lib                      \
+INCLUDES =     -I$(top_srcdir)/gnulib/lib                      \
                -I../gnulib/lib                                 \
                -I../include                                    \
                -I@top_srcdir@/src/util                         \
                -I@top_srcdir@/include                          \
-               $(DRIVER_MODULE_CFLAGS)                         \
+               -DIN_LIBVIRT
+
+AM_CFLAGS =    $(DRIVER_MODULE_CFLAGS)                         \
                $(LIBXML_CFLAGS)                                \
                $(WARN_CFLAGS)                                  \
-               $(LOCK_CHECKING_CFLAGS)                 \
-               -DIN_LIBVIRT                            \
-               $(WIN32_EXTRA_CFLAGS)
-
-AM_CFLAGS = $(COVERAGE_CFLAGS)
+               $(LOCK_CHECKING_CFLAGS)                         \
+               $(WIN32_EXTRA_CFLAGS)                           \
+               $(COVERAGE_CFLAGS)
 AM_LDFLAGS = $(COVERAGE_LDFLAGS)

 EXTRA_DIST = $(conf_DATA)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 38a353f..984d8fd 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -8,15 +8,17 @@ INCLUDES = \
        -I$(top_srcdir)/include \
        -I$(top_srcdir)/src \
        -I$(top_srcdir)/src/util \
-       -I$(top_srcdir)/src/conf \
+       -I$(top_srcdir)/src/conf
+
+AM_CFLAGS = \
        $(LIBXML_CFLAGS) \
        $(GNUTLS_CFLAGS) \
        $(SASL_CFLAGS) \
        $(SELINUX_CFLAGS) \
        $(APPARMOR_CFLAGS) \
        $(YAJL_CFLAGS) \
-         $(COVERAGE_CFLAGS) \
-         $(WARN_CFLAGS)
+       $(COVERAGE_CFLAGS) \
+       $(WARN_CFLAGS)

 if WITH_DRIVER_MODULES
 INCLUDES += \
-- 
1.7.4.4

--
libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to