[libvirt] [PATCH] makefile: Move include/Makefile.am to include/libvirt/Makefile.am

Erik Skultety eskultet at redhat.com
Wed Apr 6 07:54:31 UTC 2016


The reason for this is to fix the automatic rebuild of libvirt-common.h.in.
All *.in files should be automatically rebuilt each time they're modified.
It works well for makefiles and pkgconfig files, since they do have a valid
dependency in the top-level Makefile. However, with libvirt-common.h.in
there is no dependency in the top-level Makefile and there's no need for it
either, so this rule

include/libvirt/libvirt-common.h: $(top_builddir)/config.status \
        $(top_srcdir)/include/libvirt/libvirt-common.h.in
    cd $(top_builddir) && $(SHELL) ./config.status $@

is never hit and should be moved to include/Makefile, but that's automake's
job. According to GNU automake docs:

"Files created by AC_CONFIG_FILES, be they
Automake Makefiles or not, are all removed by ‘make distclean’. Their inputs
are automatically distributed, unless they are the output of prior
AC_CONFIG_FILES commands. Finally, rebuild rules are generated in the Automake
Makefile existing in the subdirectory of the output file, if there is one, or
in the top-level Makefile otherwise."

Which means that if we want to have the rule for libvirt-common.h automatically
generated by automake, the include/Makefile.am needs to be moved into libvirt/
subdirectory and $SUBDIRS in the top-level Makefile need to be adjusted as
well. This patch moves Makefile.am from include/ to include/libvirt, adjusting
the prefixes accordingly as well as updates the top-level Makefile $SUBDIRS to
properly hint automake to generate all rules at proper places.

Best way to see the changes, use -M with 'git show'.

Signed-off-by: Erik Skultety <eskultet at redhat.com>
---
 Makefile.am                       |  2 +-
 configure.ac                      |  2 +-
 include/{ => libvirt}/Makefile.am | 12 ++++++------
 3 files changed, 8 insertions(+), 8 deletions(-)
 rename include/{ => libvirt}/Makefile.am (76%)

diff --git a/Makefile.am b/Makefile.am
index ffe0517..9298082 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,7 +19,7 @@
 LCOV = lcov
 GENHTML = genhtml
 
-SUBDIRS = . gnulib/lib include src daemon tools docs gnulib/tests \
+SUBDIRS = . gnulib/lib include/libvirt src daemon tools docs gnulib/tests \
   tests po examples
 
 ACLOCAL_AMFLAGS = -I m4
diff --git a/configure.ac b/configure.ac
index 85fc6e1..1e83b8f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2744,7 +2744,7 @@ AC_DEFINE_UNQUOTED([base64_encode_alloc],[libvirt_gl_base64_encode_alloc],[Hack
 AC_CONFIG_FILES([run],
                 [chmod +x,-w run])
 AC_CONFIG_FILES([\
-        Makefile src/Makefile include/Makefile docs/Makefile \
+        Makefile src/Makefile include/libvirt/Makefile docs/Makefile \
         gnulib/lib/Makefile \
         gnulib/tests/Makefile \
         libvirt.pc \
diff --git a/include/Makefile.am b/include/libvirt/Makefile.am
similarity index 76%
rename from include/Makefile.am
rename to include/libvirt/Makefile.am
index dde955e..a59b8ab 100644
--- a/include/Makefile.am
+++ b/include/libvirt/Makefile.am
@@ -18,15 +18,15 @@
 
 virincdir = $(includedir)/libvirt
 
-allheaders = $(wildcard $(srcdir)/libvirt/*.h)
-virinc_HEADERS = $(filter-out $(srcdir)/libvirt/libvirt-admin.h \
-				 $(srcdir)/libvirt/libvirt-common.h, $(allheaders))
-virinc_HEADERS += libvirt/libvirt-common.h
+allheaders = $(wildcard $(srcdir)/*.h)
+virinc_HEADERS = $(filter-out $(srcdir)/libvirt-admin.h \
+				 $(srcdir)/libvirt-common.h, $(allheaders))
+virinc_HEADERS += libvirt-common.h
 
-EXTRA_DIST = libvirt/libvirt-common.h.in
+EXTRA_DIST = libvirt-common.h.in
 
 # Temporarily disabled, but we need it for building
-EXTRA_DIST += libvirt/libvirt-admin.h
+EXTRA_DIST += libvirt-admin.h
 
 install-exec-hook:
 	$(mkinstalldirs) $(DESTDIR)$(virincdir)
-- 
2.4.11




More information about the libvir-list mailing list