makefile: Move include/Makefile.am to include/libvirt/Makefile.am

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@redhat.com>
This commit is contained in:
Erik Skultety 2016-04-05 21:04:06 +02:00
parent 9e783db282
commit ab517a5ccb
3 changed files with 8 additions and 8 deletions

View File

@ -19,7 +19,7 @@
LCOV = lcov LCOV = lcov
GENHTML = genhtml 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 tests po examples
ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4

View File

@ -2757,7 +2757,7 @@ AC_DEFINE_UNQUOTED([base64_encode_alloc],[libvirt_gl_base64_encode_alloc],[Hack
AC_CONFIG_FILES([run], AC_CONFIG_FILES([run],
[chmod +x,-w run]) [chmod +x,-w run])
AC_CONFIG_FILES([\ AC_CONFIG_FILES([\
Makefile src/Makefile include/Makefile docs/Makefile \ Makefile src/Makefile include/libvirt/Makefile docs/Makefile \
gnulib/lib/Makefile \ gnulib/lib/Makefile \
gnulib/tests/Makefile \ gnulib/tests/Makefile \
libvirt.pc \ libvirt.pc \

View File

@ -18,15 +18,15 @@
virincdir = $(includedir)/libvirt virincdir = $(includedir)/libvirt
allheaders = $(wildcard $(srcdir)/libvirt/*.h) allheaders = $(wildcard $(srcdir)/*.h)
virinc_HEADERS = $(filter-out $(srcdir)/libvirt/libvirt-admin.h \ virinc_HEADERS = $(filter-out $(srcdir)/libvirt-admin.h \
$(srcdir)/libvirt/libvirt-common.h, $(allheaders)) $(srcdir)/libvirt-common.h, $(allheaders))
virinc_HEADERS += libvirt/libvirt-common.h 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 # Temporarily disabled, but we need it for building
EXTRA_DIST += libvirt/libvirt-admin.h EXTRA_DIST += libvirt-admin.h
install-exec-hook: install-exec-hook:
$(mkinstalldirs) $(DESTDIR)$(virincdir) $(mkinstalldirs) $(DESTDIR)$(virincdir)