Blame Makefile-switchroot.am

Packit Service 2a3f3d
# Copyright (C) 2011 Colin Walters <walters@verbum.org>
Packit Service 2a3f3d
#
Packit Service 2a3f3d
# SPDX-License-Identifier: LGPL-2.0+
Packit Service 2a3f3d
#
Packit Service 2a3f3d
# This library is free software; you can redistribute it and/or
Packit Service 2a3f3d
# modify it under the terms of the GNU Lesser General Public
Packit Service 2a3f3d
# License as published by the Free Software Foundation; either
Packit Service 2a3f3d
# version 2 of the License, or (at your option) any later version.
Packit Service 2a3f3d
#
Packit Service 2a3f3d
# This library is distributed in the hope that it will be useful,
Packit Service 2a3f3d
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 2a3f3d
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 2a3f3d
# Lesser General Public License for more details.
Packit Service 2a3f3d
#
Packit Service 2a3f3d
# You should have received a copy of the GNU Lesser General Public
Packit Service 2a3f3d
# License along with this library; if not, write to the
Packit Service 2a3f3d
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Packit Service 2a3f3d
# Boston, MA 02111-1307, USA.
Packit Service 2a3f3d
Packit Service 2a3f3d
if BUILDOPT_SYSTEMD
Packit Service 2a3f3d
ostree_boot_PROGRAMS += ostree-remount
Packit Service 2a3f3d
else
Packit Service 2a3f3d
# It is built anyway as a side-effect of having the symlink in tests/,
Packit Service 2a3f3d
# and if we declare it here, it gets cleaned up properly
Packit Service 2a3f3d
check_PROGRAMS += ostree-remount
Packit Service 2a3f3d
endif
Packit Service 2a3f3d
Packit Service 2a3f3d
ostree_prepare_root_SOURCES = \
Packit Service 2a3f3d
    src/switchroot/ostree-mount-util.h \
Packit Service 2a3f3d
    src/switchroot/ostree-prepare-root.c \
Packit Service 2a3f3d
    $(NULL)
Packit Service 2a3f3d
ostree_prepare_root_CPPFLAGS = $(AM_CPPFLAGS)
Packit Service 2a3f3d
Packit Service 2a3f3d
if BUILDOPT_USE_STATIC_COMPILER
Packit Service 2a3f3d
# ostree-prepare-root can be used as init in a system without a populated /lib.
Packit Service 2a3f3d
# To support this use case we need to link statically as we will be unable to
Packit Service 2a3f3d
# locate libc.so at run time if it's not installed in /lib.
Packit Service 2a3f3d
#
Packit Service 2a3f3d
# We support building ostree-prepare-root with a different compiler to the rest
Packit Service 2a3f3d
# of ostree so we can use musl rather than glibc.  This reduces the size of the
Packit Service 2a3f3d
# executable significantly: from ~700K -> ~30K.  We have to use _SCRIPTS here
Packit Service 2a3f3d
# to get autotools to install this as an executable but without generating rules
Packit Service 2a3f3d
# to make it itself which we have specified manually.  See
Packit Service 2a3f3d
# https://lists.gnu.org/archive/html/help-gnu-utils/2007-01/msg00007.html
Packit Service 2a3f3d
ostree_boot_SCRIPTS += ostree-prepare-root
Packit Service 2a3f3d
Packit Service 2a3f3d
ostree-prepare-root : $(ostree_prepare_root_SOURCES)
Packit Service 2a3f3d
	$(STATIC_COMPILER) -o $@ -static $(top_srcdir)/src/switchroot/ostree-prepare-root.c $(ostree_prepare_root_CPPFLAGS) $(AM_CFLAGS) $(DEFAULT_INCLUDES) -DOSTREE_PREPARE_ROOT_STATIC=1
Packit Service 2a3f3d
else
Packit Service 2a3f3d
ostree_boot_PROGRAMS += ostree-prepare-root
Packit Service 2a3f3d
ostree_prepare_root_CFLAGS = $(AM_CFLAGS) -Isrc/switchroot
Packit Service 2a3f3d
endif
Packit Service 2a3f3d
Packit Service 2a3f3d
ostree_remount_SOURCES = \
Packit Service 2a3f3d
    src/switchroot/ostree-mount-util.h \
Packit Service 2a3f3d
    src/switchroot/ostree-remount.c \
Packit Service 2a3f3d
    $(NULL)
Packit Service 2a3f3d
ostree_remount_CPPFLAGS = $(AM_CPPFLAGS) $(OT_INTERNAL_GIO_UNIX_CFLAGS) -Isrc/switchroot -I$(srcdir)/libglnx
Packit Service 2a3f3d
ostree_remount_LDADD = $(AM_LDFLAGS) $(OT_INTERNAL_GIO_UNIX_LIBS) libglnx.la
Packit Service 2a3f3d
Packit Service 2a3f3d
if BUILDOPT_SYSTEMD
Packit Service 2a3f3d
ostree_prepare_root_CPPFLAGS += -DHAVE_SYSTEMD=1
Packit Service 2a3f3d
ostree_prepare_root_LDADD = $(AM_LDFLAGS) $(LIBSYSTEMD_LIBS)
Packit Service 2a3f3d
endif
Packit Service 2a3f3d
Packit Service 2a3f3d
# This is the "new mode" of using a generator for /var; see
Packit Service 2a3f3d
# https://github.com/ostreedev/ostree/issues/855
Packit Service 2a3f3d
if BUILDOPT_SYSTEMD_AND_LIBMOUNT
Packit Service 2a3f3d
ostree_prepare_root_CPPFLAGS += -DHAVE_SYSTEMD_AND_LIBMOUNT=1
Packit Service 2a3f3d
ostree_remount_CPPFLAGS += -DHAVE_SYSTEMD_AND_LIBMOUNT=1
Packit Service 2a3f3d
Packit Service 2a3f3d
systemdsystemgenerator_PROGRAMS = ostree-system-generator
Packit Service 2a3f3d
GITIGNOREFILES += $(systemdsystemgenerator_PROGRAMS)
Packit Service 2a3f3d
ostree_system_generator_SOURCES = src/switchroot/ostree-mount-util.h \
Packit Service 2a3f3d
                                  src/switchroot/ostree-system-generator.c
Packit Service 2a3f3d
ostree_system_generator_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/libglnx -I$(srcdir)/src/libostree
Packit Service 2a3f3d
ostree_system_generator_CFLAGS = $(AM_CFLAGS) $(OT_INTERNAL_GIO_UNIX_CFLAGS)
Packit Service 2a3f3d
ostree_system_generator_LDADD = $(AM_LDFLAGS) libglnx.la libostree-1.la $(OT_INTERNAL_GIO_UNIX_LIBS)
Packit Service 2a3f3d
Packit Service 2a3f3d
# Allow the distcheck install under $prefix test to pass
Packit Service 2a3f3d
AM_DISTCHECK_CONFIGURE_FLAGS += --with-systemdsystemgeneratordir='$${libdir}/systemd/system-generators'
Packit Service 2a3f3d
endif