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.
2014-01-29 23:37:44 +04:00
bin_PROGRAMS += rpm-ostree
2013-12-22 04:41:30 +04:00
2020-12-21 17:15:28 +03:00
rpm_ostree_SOURCES = src/app/main.cxx
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 \
src/app/rpmostree-builtin-countme.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)\" \
2020-12-21 17:15:28 +03:00
$(PKGDEP_RPMOSTREE_CFLAGS) $(PKGDEP_RPMOSTREE_RS_CFLAGS)
rpmostree_bin_common_cflags = $(rpmostree_common_cflags)
2021-01-23 18:32:05 +03:00
rpmostree_common_libs = $(PKGDEP_RPMOSTREE_LIBS) $(CAP_LIBS) libglnx.la librpmostree-1.la librpmostreecxxrs.la $(PKGDEP_RPMOSTREE_RS_LIBS) -lstdc++ -lrt
rpmostree_bin_common_libs = librpmostreeinternals.la $(librpmostree_rust_path) $(rpmostree_common_libs)
2020-12-21 17:15:28 +03:00
rpm_ostree_CFLAGS = $(AM_CFLAGS) $(rpmostree_bin_common_cflags)
rpm_ostree_CXXFLAGS = $(AM_CXXFLAGS) $(rpmostree_bin_common_cflags)
rpm_ostree_LDADD = librpmostreeinternals.la $(rpmostree_bin_common_libs)
2020-12-17 01:17:49 +03:00
EXTRA_rpm_ostree_DEPENDENCIES = libdnf.so.2
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)
2020-12-21 17:15:28 +03:00
EXTRA_librpmostreeinternals_la_DEPENDENCIES = libdnf.so.2
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
2020-12-21 17:15:28 +03:00
librpmostree_rust_path = $(top_srcdir)/target/@RUST_TARGET_SUBDIR@/librpmostree_rust.a
2018-10-12 20:40:56 +03:00
# If the target directory exists, and isn't owned by our uid, then
# we exit with a fatal error, since someone probably did `make && sudo make install`,
# and in this case cargo will download into ~/.root which we don't want.
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
$(librpmostree_rust_path): Makefile $(LIBRPMOSTREE_RUST_SRCS) librpmostreeinternals.la
2020-12-08 21:29:05 +03:00
$(cargo_build) $(CARGO_RELEASE_ARGS)
EXTRA_DIST += $(LIBRPMOSTREE_RUST_SRCS)
2018-05-31 23:31:22 +03:00
2020-12-31 19:55:19 +03:00
# cbindgen + cxx.rs
binding_generated_sources = rpmostree-rust.h rpmostree-cxxrs.h rpmostree-cxxrs.cxx
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 $@
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
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