On Wed, Jul 19, 2023 at 03:28:59PM +0100, Richard W.M. Jones wrote:
On Wed, Jul 19, 2023 at 09:09:46AM +0000, Tage Johansson wrote:
> diff --git a/rust/Makefile.am b/rust/Makefile.am
> new file mode 100644
> index 0000000..cb8d7c9
> --- /dev/null
> +++ b/rust/Makefile.am
...
> +all-local: $(source_files)
> + rm -f libnbd-sys/libnbd_version.t
> + $(abs_top_builddir)/run echo $(VERSION) > libnbd-sys/libnbd_version.t
> + mv libnbd-sys/libnbd_version.t libnbd-sys/libnbd_version
> + $(abs_top_builddir)/run $(CARGO) build
> + $(abs_top_builddir)/run $(CARGO) doc
You could split this rule to avoid all the commands being run every
time, and to allow parallel builds, something like ...
all-local: libnbd-sys/libnbd_version SOME_BUILT_FILE SOME_DOC_FILE
libnbd-sys/libnbd_version: Makefile
rm -f libnbd-sys/libnbd_version.t
$(abs_top_builddir)/run echo $(VERSION) > libnbd-sys/libnbd_version.t
mv libnbd-sys/libnbd_version.t $@
SOME_BUILT_FILE: $(source_files) libnbd-sys/libnbd_version
$(abs_top_builddir)/run $(CARGO) build
SOME_DOC_FILE: $(source_files) libnbd-sys/libnbd_version
$(abs_top_builddir)/run $(CARGO) doc
where SOME_BUILT_FILE and SOME_DOC_FILE are single files which are
built by cargo build / cargo doc and can act as a canary that the
build was successful last time. (Don't put multiple files here, make
won't do what you expect.)
Notice also that I made the version file depend on Makefile so that it
will get properly updated when the version is changed by a source file
... BUT a source file ...
is not touched.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v
_______________________________________________
Libguestfs mailing list
Libguestfs(a)redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top