• E
    build: avoid $(srcdir) in *_SOURCES · 073e1575
    Eric Blake 提交于
    Trying to enable automake's subdir-objects option resulted in
    the creation of literal directories such as src/$(srcdir)/remote/.
    I traced this to the fact that we had used a literal $(srcdir)
    in a location that later fed an automake *_SOURCES variable.
    This has also been reported as an automake bug:
    http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13928
    but it's better to fix our code than to wait for an automake fix.
    
    Some things to remember that affect VPATH builds, and where an
    in-tree build is blissfully unaware of the issues: if a VPATH
    build fails to find a file that was used as a prereq of any
    other target, then the rule for that file will expand $@ to
    prefer the current build dir (bad because a VPATH build on a
    fresh checkout will then stick $@ in the current directory
    instead of the desired srcdir); conversely, if a VPATH build
    finds the file in srcdir but decides it needs to be rebuilt,
    then the rule for that file will expand $@ to include the
    directory where it was found out-of-date (bad for an explicit
    listing of $(srcdir)/$@ because an incremental VPATH build will
    then expand srcdir twice).  As we want these files to go into
    srcdir unconditionally, we have to massage or avoid $@ for any
    recipe that involves one of these files.
    
    Therefore, this patch removes all uses of $(srcdir) from any
    generated file name that later feeds a *_SOURCES variable, and
    then rewrites all the recipes to generate those files to
    hard-code their creation into srcdir without the use of $@.
    
    * src/Makefile.am (REMOTE_DRIVER_GENERATED): Drop $(srcdir); VPATH
    builds know how to find the files, and automake subdir-objects
    fails with it in place.
    (LXC_MONITOR_PROTOCOL_GENERATED, (LXC_MONITOR_GENERATED)
    (ACCESS_DRIVER_GENERATED, LOCK_PROTOCOL_GENERATED): Likewise.
    (*_client_bodies.h): Hard-code rules to write into srcdir, as
    VPATH tries to build $@ locally if missing.
    (util/virkeymaps.h): Likewise.
    (lxc/lxc_monitor_dispatch.h): Likewise.
    (access/viraccessapi*): Likewise.
    (locking/lock_daemon_dispatch_stubs.h): Likewise.
    * daemon/Makeflie.am (DAEMON_GENERATED, remote_dispatch.h):
    Likewise.
    Signed-off-by: NEric Blake <eblake@redhat.com>
    
    fixup DAEMON_GENERATED
    073e1575
Makefile.am 13.0 KB