rpm-ostree/Makefile.bindings
Colin Walters 2ed1e73c06 build-sys: Avoid re-building + re-linking cxx-rs C++ bits each build
We need to do the same `cmp` dance for the generated `.cxx` file
as for the source, because `make` only works on timestamps.

Currently every time one edits the rust code and types `make`
we end up re-building that object, which also forces a re-link
of the `librpmostreeinternals.la` library.
2021-04-16 10:54:04 -04:00

28 lines
891 B
Makefile

# This is duplicated with LIBRPMOSTREE_RUST_SRCS because this
# Makefile needs to be independent
binding_rust_sources = $(shell find rust/src/ -name '*.rs') Cargo.toml Cargo.lock
rust/cxx.h: Makefile.bindings
cxxbridge --header >$@
rpmostree-cxxrs.h: $(binding_rust_sources)
$(AM_V_GEN) if cxxbridge rust/src/lib.rs --header > $@.tmp; then \
if test -f $@ && cmp $@.tmp $@ 2>/dev/null; then rm -f $@.tmp; else \
mv $@.tmp $@; \
fi; \
else \
echo cxxbridge failed; exit 1; \
fi
rpmostree-cxxrs.cxx: $(binding_rust_sources) rpmostree-cxxrs.h
$(AM_V_GEN) if cxxbridge --include rpmostree-cxxrs.h rust/src/lib.rs > $@.tmp; then \
if test -f $@ && cmp $@.tmp $@ 2>/dev/null; then rm -f $@.tmp; else \
mv $@.tmp $@; \
fi; \
else \
echo cxxbridge failed; exit 1; \
fi
# Invoked in CI
bindings: rpmostree-cxxrs.h rpmostree-cxxrs.cxx rust/cxx.h
.PHONY: bindings