[libvirt] [PATCH v2] Makefile: Fix parallel build after Xen-xl parser introduction

Well, the parallel build doesn't work as there are not dependencies set correctly. When running 'make -j' I see this error: make[2]: Entering directory '/home/zippy/work/libvirt/libvirt.git/src' GEN util/virkeymaps.h GEN locking/lock_protocol.h make[2]: *** No rule to make target 'xenconfig/xen_xl_disk.h', needed by 'all'. Stop. make[2]: *** Waiting for unfinished jobs.... GEN lxc/lxc_controller_dispatch.h The fix is to correctly set dependencies by letting make know that .c and .h are to be generated from .l. Moreover, the section is moved closer to the other section which uses it. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- This is reworked version of my first patch. The difference is that I'm using a stamp this time. src/Makefile.am | 46 +++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index c6d736e..e00ff63 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1000,23 +1000,6 @@ CPU_SOURCES = \ VMX_SOURCES = \ vmx/vmx.c vmx/vmx.h -AM_LFLAGS = -Pxl_disk_ --header-file=../$*.h -LEX_OUTPUT_ROOT = lex.xl_disk_ -BUILT_SOURCES += xenconfig/xen_xl_disk.c xenconfig/xen_xl_disk.h -# Generated header file is not implicitly added to dist -EXTRA_DIST += xenconfig/xen_xl_disk.h -CLEANFILES += xenconfig/xen_xl_disk.h xenconfig/xen_xl_disk.c - -XENXLDISKPARSER_SOURCES = xenconfig/xen_xl_disk.l - -XENCONFIG_SOURCES = \ - xenconfig/xenxs_private.h \ - xenconfig/xen_common.c xenconfig/xen_common.h \ - xenconfig/xen_sxpr.c xenconfig/xen_sxpr.h \ - xenconfig/xen_xm.c xenconfig/xen_xm.h \ - xenconfig/xen_xl.c xenconfig/xen_xl.h \ - xenconfig/xen_xl_disk.h - pkgdata_DATA = cpu/cpu_map.xml EXTRA_DIST += $(pkgdata_DATA) @@ -1070,6 +1053,33 @@ libvirt_vmx_la_SOURCES = $(VMX_SOURCES) endif WITH_VMX if WITH_XENCONFIG + +XENXLDISKPARSER_GENERATED_STAMP = .xen_xl_disk.stamp + +$(XENXLDISKPARSER_GENERATED): $(XENXLDISKPARSER_GENERATED_STAMP) + +$(XENXLDISKPARSER_GENERATED_STAMP): $(XENXLDISKPARSER_SOURCES) + $(AM_V_GEN) $(SHELL) $(YLWRAP) $< lex.xl_disk_.c xenconfig/xen_xl_disk.c \ + -- $(LEXCOMPILE) && touch $@ + +AM_LFLAGS = -Pxl_disk_ --header-file=../$*.h +XENXLDISKPARSER_GENERATED = xenconfig/xen_xl_disk.c xenconfig/xen_xl_disk.h + +BUILT_SOURCES += $(XENXLDISKPARSER_GENERATED) +EXTRA_DIST += $(XENXLDISKPARSER_GENERATED) $(XENXLDISKPARSER_GENERATED_STAMP) +MAINTAINERCLEANFILES += $(XENXLDISKPARSER_GENERATED) \ + $(XENXLDISKPARSER_GENERATED_STAMP) + +XENXLDISKPARSER_SOURCES = xenconfig/xen_xl_disk.l + +XENCONFIG_SOURCES = \ + xenconfig/xenxs_private.h \ + xenconfig/xen_common.c xenconfig/xen_common.h \ + xenconfig/xen_sxpr.c xenconfig/xen_sxpr.h \ + xenconfig/xen_xm.c xenconfig/xen_xm.h \ + xenconfig/xen_xl.c xenconfig/xen_xl.h \ + xenconfig/xen_xl_disk_i.h + # Flex generated XL disk parser needs to be compiled without WARN_FLAGS # Add the generated object to its own library to control CFLAGS noinst_LTLIBRARIES += libvirt_xenxldiskparser.la @@ -1077,6 +1087,8 @@ libvirt_xenxldiskparser_la_CFLAGS = \ -I$(top_srcdir)/src/conf $(AM_CFLAGS) -Wno-unused-parameter libvirt_xenxldiskparser_la_SOURCES = \ $(XENXLDISKPARSER_SOURCES) +libvirt_xenxldiskparser_la_DEPENDENCIES = \ + $(XENXLDISKPARSER_GENERATED) noinst_LTLIBRARIES += libvirt_xenconfig.la libvirt_la_BUILT_LIBADD += libvirt_xenconfig.la -- 2.0.5

On Tue, Jan 06, 2015 at 02:47:17PM +0100, Michal Privoznik wrote:
Well, the parallel build doesn't work as there are not dependencies set correctly. When running 'make -j' I see this error:
make[2]: Entering directory '/home/zippy/work/libvirt/libvirt.git/src' GEN util/virkeymaps.h GEN locking/lock_protocol.h make[2]: *** No rule to make target 'xenconfig/xen_xl_disk.h', needed by 'all'. Stop. make[2]: *** Waiting for unfinished jobs.... GEN lxc/lxc_controller_dispatch.h
The fix is to correctly set dependencies by letting make know that .c and .h are to be generated from .l. Moreover, the section is moved closer to the other section which uses it.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> ---
This is reworked version of my first patch. The difference is that I'm using a stamp this time.
src/Makefile.am | 46 +++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 17 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am index c6d736e..e00ff63 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1000,23 +1000,6 @@ CPU_SOURCES = \ VMX_SOURCES = \ vmx/vmx.c vmx/vmx.h
-AM_LFLAGS = -Pxl_disk_ --header-file=../$*.h -LEX_OUTPUT_ROOT = lex.xl_disk_ -BUILT_SOURCES += xenconfig/xen_xl_disk.c xenconfig/xen_xl_disk.h -# Generated header file is not implicitly added to dist -EXTRA_DIST += xenconfig/xen_xl_disk.h -CLEANFILES += xenconfig/xen_xl_disk.h xenconfig/xen_xl_disk.c - -XENXLDISKPARSER_SOURCES = xenconfig/xen_xl_disk.l - -XENCONFIG_SOURCES = \ - xenconfig/xenxs_private.h \ - xenconfig/xen_common.c xenconfig/xen_common.h \ - xenconfig/xen_sxpr.c xenconfig/xen_sxpr.h \ - xenconfig/xen_xm.c xenconfig/xen_xm.h \ - xenconfig/xen_xl.c xenconfig/xen_xl.h \ - xenconfig/xen_xl_disk.h - pkgdata_DATA = cpu/cpu_map.xml
EXTRA_DIST += $(pkgdata_DATA) @@ -1070,6 +1053,33 @@ libvirt_vmx_la_SOURCES = $(VMX_SOURCES) endif WITH_VMX
if WITH_XENCONFIG + +XENXLDISKPARSER_GENERATED_STAMP = .xen_xl_disk.stamp + +$(XENXLDISKPARSER_GENERATED): $(XENXLDISKPARSER_GENERATED_STAMP) + +$(XENXLDISKPARSER_GENERATED_STAMP): $(XENXLDISKPARSER_SOURCES) + $(AM_V_GEN) $(SHELL) $(YLWRAP) $< lex.xl_disk_.c xenconfig/xen_xl_disk.c \ + -- $(LEXCOMPILE) && touch $@ + +AM_LFLAGS = -Pxl_disk_ --header-file=../$*.h +XENXLDISKPARSER_GENERATED = xenconfig/xen_xl_disk.c xenconfig/xen_xl_disk.h + +BUILT_SOURCES += $(XENXLDISKPARSER_GENERATED) +EXTRA_DIST += $(XENXLDISKPARSER_GENERATED) $(XENXLDISKPARSER_GENERATED_STAMP) +MAINTAINERCLEANFILES += $(XENXLDISKPARSER_GENERATED) \ + $(XENXLDISKPARSER_GENERATED_STAMP)
I think MAINTAINERCLEANFILES should include these files even if configured without xen, maybe that's why it was outside th WITH_XENCONFIG if? ACK with that changed. Martin
+ +XENXLDISKPARSER_SOURCES = xenconfig/xen_xl_disk.l + +XENCONFIG_SOURCES = \ + xenconfig/xenxs_private.h \ + xenconfig/xen_common.c xenconfig/xen_common.h \ + xenconfig/xen_sxpr.c xenconfig/xen_sxpr.h \ + xenconfig/xen_xm.c xenconfig/xen_xm.h \ + xenconfig/xen_xl.c xenconfig/xen_xl.h \ + xenconfig/xen_xl_disk_i.h + # Flex generated XL disk parser needs to be compiled without WARN_FLAGS # Add the generated object to its own library to control CFLAGS noinst_LTLIBRARIES += libvirt_xenxldiskparser.la @@ -1077,6 +1087,8 @@ libvirt_xenxldiskparser_la_CFLAGS = \ -I$(top_srcdir)/src/conf $(AM_CFLAGS) -Wno-unused-parameter libvirt_xenxldiskparser_la_SOURCES = \ $(XENXLDISKPARSER_SOURCES) +libvirt_xenxldiskparser_la_DEPENDENCIES = \ + $(XENXLDISKPARSER_GENERATED)
noinst_LTLIBRARIES += libvirt_xenconfig.la libvirt_la_BUILT_LIBADD += libvirt_xenconfig.la -- 2.0.5
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On 01/06/2015 02:47 PM, Michal Privoznik wrote:
Well, the parallel build doesn't work as there are not dependencies set correctly. When running 'make -j' I see this error:
make[2]: Entering directory '/home/zippy/work/libvirt/libvirt.git/src' GEN util/virkeymaps.h GEN locking/lock_protocol.h make[2]: *** No rule to make target 'xenconfig/xen_xl_disk.h', needed by 'all'. Stop. make[2]: *** Waiting for unfinished jobs.... GEN lxc/lxc_controller_dispatch.h
The fix is to correctly set dependencies by letting make know that .c and .h are to be generated from .l. Moreover, the section is moved closer to the other section which uses it.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> ---
This is reworked version of my first patch. The difference is that I'm using a stamp this time.
src/Makefile.am | 46 +++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 17 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am index c6d736e..e00ff63 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1000,23 +1000,6 @@ CPU_SOURCES = \ VMX_SOURCES = \ vmx/vmx.c vmx/vmx.h
-AM_LFLAGS = -Pxl_disk_ --header-file=../$*.h -LEX_OUTPUT_ROOT = lex.xl_disk_ -BUILT_SOURCES += xenconfig/xen_xl_disk.c xenconfig/xen_xl_disk.h -# Generated header file is not implicitly added to dist -EXTRA_DIST += xenconfig/xen_xl_disk.h -CLEANFILES += xenconfig/xen_xl_disk.h xenconfig/xen_xl_disk.c - -XENXLDISKPARSER_SOURCES = xenconfig/xen_xl_disk.l - -XENCONFIG_SOURCES = \ - xenconfig/xenxs_private.h \ - xenconfig/xen_common.c xenconfig/xen_common.h \ - xenconfig/xen_sxpr.c xenconfig/xen_sxpr.h \ - xenconfig/xen_xm.c xenconfig/xen_xm.h \ - xenconfig/xen_xl.c xenconfig/xen_xl.h \ - xenconfig/xen_xl_disk.h - pkgdata_DATA = cpu/cpu_map.xml
EXTRA_DIST += $(pkgdata_DATA) @@ -1070,6 +1053,33 @@ libvirt_vmx_la_SOURCES = $(VMX_SOURCES) endif WITH_VMX
if WITH_XENCONFIG + +XENXLDISKPARSER_GENERATED_STAMP = .xen_xl_disk.stamp + +$(XENXLDISKPARSER_GENERATED): $(XENXLDISKPARSER_GENERATED_STAMP) + +$(XENXLDISKPARSER_GENERATED_STAMP): $(XENXLDISKPARSER_SOURCES) + $(AM_V_GEN) $(SHELL) $(YLWRAP) $< lex.xl_disk_.c xenconfig/xen_xl_disk.c \ + -- $(LEXCOMPILE) && touch $@ + +AM_LFLAGS = -Pxl_disk_ --header-file=../$*.h +XENXLDISKPARSER_GENERATED = xenconfig/xen_xl_disk.c xenconfig/xen_xl_disk.h + +BUILT_SOURCES += $(XENXLDISKPARSER_GENERATED) +EXTRA_DIST += $(XENXLDISKPARSER_GENERATED) $(XENXLDISKPARSER_GENERATED_STAMP) +MAINTAINERCLEANFILES += $(XENXLDISKPARSER_GENERATED) \ + $(XENXLDISKPARSER_GENERATED_STAMP) + +XENXLDISKPARSER_SOURCES = xenconfig/xen_xl_disk.l + +XENCONFIG_SOURCES = \ + xenconfig/xenxs_private.h \ + xenconfig/xen_common.c xenconfig/xen_common.h \ + xenconfig/xen_sxpr.c xenconfig/xen_sxpr.h \ + xenconfig/xen_xm.c xenconfig/xen_xm.h \ + xenconfig/xen_xl.c xenconfig/xen_xl.h \ + xenconfig/xen_xl_disk_i.h + # Flex generated XL disk parser needs to be compiled without WARN_FLAGS # Add the generated object to its own library to control CFLAGS noinst_LTLIBRARIES += libvirt_xenxldiskparser.la @@ -1077,6 +1087,8 @@ libvirt_xenxldiskparser_la_CFLAGS = \ -I$(top_srcdir)/src/conf $(AM_CFLAGS) -Wno-unused-parameter libvirt_xenxldiskparser_la_SOURCES = \ $(XENXLDISKPARSER_SOURCES) +libvirt_xenxldiskparser_la_DEPENDENCIES = \ + $(XENXLDISKPARSER_GENERATED)
noinst_LTLIBRARIES += libvirt_xenconfig.la libvirt_la_BUILT_LIBADD += libvirt_xenconfig.la
The build works with this patch, however there is still mysterious src/.h and src/lex.xl_disk_.c files which are copies of src/xenconfig/xen_xl_disk.h and src/xenconfig/xen_xl_disk.c only with different file names inside. Pavel

On 01/06/2015 06:47 AM, Michal Privoznik wrote:
Well, the parallel build doesn't work as there are not dependencies set correctly. When running 'make -j' I see this error:
make[2]: Entering directory '/home/zippy/work/libvirt/libvirt.git/src' GEN util/virkeymaps.h GEN locking/lock_protocol.h make[2]: *** No rule to make target 'xenconfig/xen_xl_disk.h', needed by 'all'. Stop. make[2]: *** Waiting for unfinished jobs.... GEN lxc/lxc_controller_dispatch.h
The fix is to correctly set dependencies by letting make know that .c and .h are to be generated from .l. Moreover, the section is moved closer to the other section which uses it.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> ---
This is reworked version of my first patch. The difference is that I'm using a stamp this time.
Still fails in a VPATH build :( make[2]: Entering directory '/home/eblake/libvirt-tmp/build4/src' /bin/sh ../../build-aux/ylwrap ../../src/xenconfig/xen_xl_disk.l lex.yy.c xenconfig/xen_xl_disk.c -- flex -Pxl_disk_ --header-file=../xenconfig/xen_xl_disk.h lex.xl_disk_.c is unchanged make all-am Note that the rule tried to reference --header-file=../xenconfig/xen_xl_disk.h, but that is not a file under version control. Generated files should (normally) be placed into builddir, not srcdir, unless we plan on making those generated files be part of the tarball (which in turn implies the generated file can be built identically regardless of configure options, for a maintainer with sufficient tools). I'm still playing with it, to see if I can fix the issues. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (4)
-
Eric Blake
-
Martin Kletzander
-
Michal Privoznik
-
Pavel Hrdina