2013-12-22 04:41:30 +04:00
# Copyright (C) 2013 Colin Walters <walters@verbum.org>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
2020-12-21 17:15:28 +03:00
noinst_LTLIBRARIES += librpmostreeinternals.la
librpmostreeinternals_la_SOURCES = \
src/app/libmain.cxx \
2015-04-07 03:18:50 +03:00
src/app/rpmostree-builtins.h \
src/app/rpmostree-db-builtins.h \
src/app/rpmostree-compose-builtins.h \
2020-12-21 19:08:51 +03:00
src/app/rpmostree-builtin-upgrade.cxx \
2020-12-21 19:08:51 +03:00
src/app/rpmostree-builtin-rollback.cxx \
2020-12-21 19:08:51 +03:00
src/app/rpmostree-builtin-deploy.cxx \
2020-12-21 19:08:51 +03:00
src/app/rpmostree-builtin-reload.cxx \
2020-12-21 19:08:51 +03:00
src/app/rpmostree-builtin-rebase.cxx \
2020-12-21 19:08:51 +03:00
src/app/rpmostree-builtin-cancel.cxx \
2020-12-21 19:08:51 +03:00
src/app/rpmostree-builtin-cleanup.cxx \
2020-10-13 18:46:00 +03:00
src/app/rpmostree-builtin-cliwrap.cxx \
2020-12-21 19:08:51 +03:00
src/app/rpmostree-builtin-initramfs.cxx \
2020-12-21 19:08:51 +03:00
src/app/rpmostree-builtin-initramfs-etc.cxx \
2020-12-21 19:08:51 +03:00
src/app/rpmostree-builtin-livefs.cxx \
2020-12-21 19:08:51 +03:00
src/app/rpmostree-builtin-usroverlay.cxx \
2020-12-21 19:08:51 +03:00
src/app/rpmostree-builtin-override.cxx \
2020-12-21 19:08:51 +03:00
src/app/rpmostree-builtin-refresh-md.cxx \
2020-12-21 19:08:51 +03:00
src/app/rpmostree-builtin-reset.cxx \
2020-12-21 19:08:51 +03:00
src/app/rpmostree-pkg-builtins.cxx \
2020-12-21 19:08:51 +03:00
src/app/rpmostree-builtin-status.cxx \
2020-12-21 19:08:51 +03:00
src/app/rpmostree-builtin-ex.cxx \
2020-12-21 19:08:51 +03:00
src/app/rpmostree-builtin-testutils.cxx \
2020-12-21 19:08:51 +03:00
src/app/rpmostree-builtin-shlib-backend.cxx \
2020-12-21 19:08:51 +03:00
src/app/rpmostree-builtin-db.cxx \
2020-12-21 19:08:51 +03:00
src/app/rpmostree-builtin-start-daemon.cxx \
2020-12-21 19:08:51 +03:00
src/app/rpmostree-builtin-finalize-deployment.cxx \
2020-12-21 19:08:51 +03:00
src/app/rpmostree-db-builtin-diff.cxx \
2020-12-21 19:08:51 +03:00
src/app/rpmostree-db-builtin-list.cxx \
2020-12-21 19:08:51 +03:00
src/app/rpmostree-db-builtin-version.cxx \
2020-12-06 22:38:13 +03:00
src/app/rpmostree-dbus-helpers.cxx \
2015-06-13 03:19:16 +03:00
src/app/rpmostree-dbus-helpers.h \
2017-06-05 19:37:56 +03:00
src/app/rpmostree-override-builtins.h \
2020-12-21 19:08:51 +03:00
src/app/rpmostree-override-builtins.cxx \
2020-12-19 21:14:18 +03:00
src/app/rpmostree-libbuiltin.cxx \
2015-04-19 16:36:53 +03:00
src/app/rpmostree-libbuiltin.h \
2020-12-21 19:08:51 +03:00
src/app/rpmostree-polkit-agent.cxx \
2017-07-25 19:59:56 +03:00
src/app/rpmostree-polkit-agent.h \
2020-12-21 19:08:51 +03:00
src/app/rpmostree-builtin-kargs.cxx \
2020-11-22 22:55:06 +03:00
src/app/rpmostree-compose-builtin-tree.cxx \
2020-12-19 00:42:28 +03:00
src/app/rpmostree-composeutil.cxx \
2018-09-19 16:48:04 +03:00
src/app/rpmostree-composeutil.h \
2020-12-21 19:08:51 +03:00
src/app/rpmostree-builtin-compose.cxx \
2020-12-17 01:17:49 +03:00
$(librpmostreed_sources) \
2020-12-17 01:04:40 +03:00
$(librpmostreepriv_sources) \
2014-01-29 23:37:44 +04:00
$(NULL)
2014-09-17 05:45:30 +04:00
2020-10-22 20:33:45 +03:00
if BUILDOPT_ROJIG
2020-12-21 17:15:28 +03:00
librpmostreeinternals_la_SOURCES += \
2020-12-19 18:29:13 +03:00
src/app/rpmostree-ex-builtin-commit2rojig.cxx \
2020-12-19 18:48:44 +03:00
src/app/rpmostree-ex-builtin-rojig2commit.cxx \
2020-12-19 19:03:32 +03:00
src/app/rpmostree-compose-builtin-rojig.cxx \
2020-10-22 20:33:45 +03:00
$(NULL)
endif
2020-12-21 17:15:28 +03:00
nodist_librpmostreeinternals_la_SOURCES = $(dbus_built_sources) $(nodist_librpmostreepriv_sources)
2020-12-17 01:17:49 +03:00
2020-11-22 22:55:06 +03:00
rpmostree_common_cflags = -I$(srcdir)/src/app -I$(srcdir)/src/daemon \
2016-05-27 21:46:46 +03:00
-I$(srcdir)/src/lib -I$(srcdir)/src/libpriv -I$(libglnx_srcpath) \
2020-12-17 01:17:49 +03:00
-DG_LOG_DOMAIN=\"rpm-ostreed\" \
-DLIBDIR=\"$(libdir)\" -DPKGLIBDIR=\"$(pkglibdir)\" \
2021-01-29 22:47:48 +03:00
-I $(top_srcdir)/libdnf \
2021-01-30 00:56:02 +03:00
$(PKGDEP_LIBRPMOSTREE_CFLAGS) $(PKGDEP_RPMOSTREE_CFLAGS)
2020-12-21 17:15:28 +03:00
rpmostree_bin_common_cflags = $(rpmostree_common_cflags)
2021-01-30 00:56:02 +03:00
rpmostree_common_libs = libglnx.la librpmostree-1.la librpmostreecxxrs.la
2021-01-27 21:57:44 +03:00
2021-01-26 14:34:59 +03:00
rpmostree_bin_common_libs = librpmostreeinternals.la $(rpmostree_common_libs)
2020-12-21 17:15:28 +03:00
librpmostreeinternals_la_CFLAGS = $(AM_CFLAGS) $(rpmostree_common_cflags)
librpmostreeinternals_la_CXXFLAGS = $(AM_CXXFLAGS) $(rpmostree_common_cflags)
2021-01-23 18:32:05 +03:00
librpmostreeinternals_la_LIBADD = $(rpmostree_common_libs)
2014-01-16 16:26:54 +04:00
2013-12-22 04:41:30 +04:00
privdatadir=$(pkglibdir)
2016-06-15 23:30:11 +03:00
privdata_DATA = src/app/rpm-ostree-0-integration.conf
2016-10-19 21:24:40 +03:00
2018-09-26 17:23:48 +03:00
# Propagate automake verbose mode
cargo_build = $(cargo) build $(if $(subst 0,,$(V)),--verbose,)
2021-01-11 21:25:51 +03:00
if BUILDOPT_PREBUILT_BINDINGS
cargo_build += "--offline"
endif
2018-09-26 17:23:48 +03:00
2020-12-22 01:27:52 +03:00
if BUILDOPT_ENABLE_SQLITE_RPMDB_DEFAULT
cargo_build += --features sqlite-rpmdb-default
endif
2021-01-26 14:34:59 +03:00
if RUST_DEBUG
cargo_target_dir=debug
else
cargo_target_dir=release
endif
2020-12-08 21:29:05 +03:00
LIBRPMOSTREE_RUST_SRCS = $(shell find rust/src/ -name '*.rs') Cargo.toml Cargo.lock cbindgen.toml
2021-01-23 18:32:05 +03:00
# FIXME - build all this code in a rpmostree-sys crate, or just move all the C/C++ build
# to Rust. Currently this forces build system serialization
2021-01-26 14:34:59 +03:00
rpm-ostree: Makefile $(LIBRPMOSTREE_RUST_SRCS) librpmostreeinternals.la
2020-12-08 21:29:05 +03:00
$(cargo_build) $(CARGO_RELEASE_ARGS)
2021-01-26 14:34:59 +03:00
ln -sfr target/$(cargo_target_dir)/rpm-ostree $@
2020-12-08 21:29:05 +03:00
EXTRA_DIST += $(LIBRPMOSTREE_RUST_SRCS)
2021-01-26 14:34:59 +03:00
ALL_LOCAL_HOOKS += rpm-ostree
CLEANFILES += rpm-ostree
2018-05-31 23:31:22 +03:00
2020-12-31 19:55:19 +03:00
# cbindgen + cxx.rs
2021-01-27 04:35:37 +03:00
binding_generated_sources = rpmostree-rust.h rpmostree-cxxrs.h rpmostree-cxxrs.cxx rust/cxx.h
2020-12-11 18:09:57 +03:00
if BUILDOPT_PREBUILT_BINDINGS
2020-12-31 19:55:19 +03:00
# In this case we shipped prebuilt versions in the source tarball
2020-12-11 18:09:57 +03:00
rpmostree-rust.h:
ln -sfr rpmostree-rust-prebuilt.h $@
2020-12-31 19:55:19 +03:00
rpmostree-cxxrs.h:
ln -sfr rpmostree-cxxrs-prebuilt.h $@
rpmostree-cxxrs.cxx:
ln -sfr rpmostree-cxxrs-prebuilt.cxx $@
2021-01-27 04:35:37 +03:00
rust/cxx.h:
ln -sfr rust/cxx-prebuilt.h $@
2020-12-11 18:09:57 +03:00
else
2020-12-31 19:55:19 +03:00
include Makefile.bindings
2020-12-11 18:09:57 +03:00
endif
2020-12-22 17:56:15 +03:00
noinst_LTLIBRARIES += librpmostreecxxrs.la
librpmostreecxxrs_la_SOURCES = rpmostree-cxxrs.h rpmostree-cxxrs.cxx
# Suppress missing-declarations because https://github.com/dtolnay/cxx/issues/590
librpmostreecxxrs_la_CXXFLAGS = $(AM_CXXFLAGS) $(rpmostree_common_cflags) -Wno-missing-declarations
librpmostreecxxrs_la_LIBADD = -lstdc++
2020-12-31 19:55:19 +03:00
GITIGNOREFILES += $(binding_generated_sources)
BUILT_SOURCES += $(binding_generated_sources)
2018-08-24 17:42:31 +03:00
2021-01-26 14:34:59 +03:00
# And install our binary
install-rpmostree-hook:
install -d -m 0755 $(DESTDIR)$(bindir)
install -m 0755 -t $(DESTDIR)$(bindir) target/release/rpm-ostree
INSTALL_EXEC_HOOKS += install-rpmostree-hook
2018-09-26 17:43:18 +03:00
# Wraps `cargo test`. This is always a debug non-release build;
# the main thing here is we still drop the `target` dir in our build
# directory, since we nominally support srcdir != builddir.
rust-test:
cd $(top_srcdir)/rust && CARGO_TARGET_DIR=@abs_top_builddir@/target cargo test
.PHONY: rust-test