[Libguestfs] [libnbd PATCH v2 02/23] bash: Generate completion files during build

Martin Kletzander mkletzan at redhat.com
Fri Jun 11 12:15:02 UTC 2021


On Fri, Jun 11, 2021 at 09:27:22AM +0100, Richard W.M. Jones wrote:
>On Fri, Jun 11, 2021 at 01:12:06AM +0200, Martin Kletzander wrote:
>>  nbdcopy: nbdsh
>> -	rm -f $@
>> -	$(LN_S) $(srcdir)/nbdsh $@
>> +	$(LN_S) nbdsh $@
>>
>>  nbdfuse: nbdsh
>> -	rm -f $@
>> -	$(LN_S) $(srcdir)/nbdsh $@
>> +	$(LN_S) nbdsh $@
>>
>>  nbdinfo: nbdsh
>> -	rm -f $@
>> -	$(LN_S) $(srcdir)/nbdsh $@
>> -
>> -CLEANFILES += nbdcopy nbdfuse nbdinfo
>> +	$(LN_S) nbdsh $@
>
>I don't understand this part of the change.
>
>I'm pretty sure you need to keep the rm -f $@ part because $(LN_S)
>expands to "ln -s" which won't overwrite the target if it already
>exists.  I imagine this will break if nbdsh is edited and make
>attempts to rebuild these targets.
>

OK, that makes sense.  I was thinking about this purely from the
installation point of view.  But I guess if I keep $(srcdir)/nbdsh there
it will pick the file up as this does not install symlinks anyway.  I
tested this approach, but forgot to actually test the original one,
which I should've kept.

>Also nbdsh will still be in $(srcdir) so removing that seems like it
>could break srcdir != builddir (although that is probably broken in
>other places too).
>
>And CLEANFILES is needed (or perhaps DISCLEANFILES) so that generated
>files like the symlinks get removed on "make clean".
>

This whole thing behaves differently to my expectations.  Editing nbdsh
does not trigger the "rebuild" (relinking) of the needed files, but make
clean does not pick up what it built.  Is automake so clever to know
that it is just a symlink that does not need updating, but not clever
enough to realize a file it has built needs to be cleaned?

Anyway, you're right, I'll leave it as it is, just remove the dist_
prefix.  Sorry for the confusion.

>Rich.
>
>-- 
>Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
>Read my programming and virtualization blog: http://rwmj.wordpress.com
>Fedora Windows cross-compiler. Compile Windows programs, test, and
>build Windows installers. Over 100 libraries supported.
>http://fedoraproject.org/wiki/MinGW
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20210611/cbc44ed2/attachment.sig>


More information about the Libguestfs mailing list