util-linux/Makefile.am

332 lines
8.9 KiB
Makefile
Raw Permalink Normal View History

AM_CPPFLAGS = \
-include config.h \
-I$(top_srcdir)/include \
-DLOCALEDIR=\"$(localedir)\" \
-D_PATH_RUNSTATEDIR=\"${runstatedir}\" \
-D_PATH_SYSCONFSTATICDIR=\"${sysconfstaticdir}\"
if USE_VENDORDIR
AM_CPPFLAGS += \
-D_PATH_VENDORDIR=\"${vendordir}\"
endif
if FUZZING_ENGINE
if !OSS_FUZZ
AM_CPPFLAGS += \
-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
endif
endif
AM_CFLAGS = -fsigned-char $(WARN_CFLAGS)
AM_CXXFLAGS = $(AM_CFLAGS)
AM_LDFLAGS = $(ASAN_LDFLAGS) $(UBSAN_LDFLAGS) $(FUZZING_ENGINE_LDFLAGS)
# Add gettext stuff to the global LDADD for systems with separate libintl
# library. The LTLIBINTL is generated by AM_GNU_GETTEXT macro.
#
LDADD = $(LTLIBINTL)
LIB_FUZZING_ENGINE ?= -fsanitize=fuzzer
# Paths to in-tree libraries (use ul_ prefix to avoid possible collisions) Note
# that blkid.h, libmount.h, libfdisk.h and libsmartcols.h are generated and
# stored in build dirs.
#
ul_libblkid_incdir = $(top_builddir)/libblkid/src
ul_libmount_incdir = $(top_builddir)/libmount/src
ul_libsmartcols_incdir = $(top_builddir)/libsmartcols/src
ul_libfdisk_incdir = $(top_builddir)/libfdisk/src
ul_libuuid_incdir = $(top_srcdir)/libuuid/src
bashcompletiondir = @bashcompletiondir@
dist_noinst_HEADERS =
dist_noinst_DATA =
noinst_PROGRAMS =
EXTRA_LTLIBRARIES =
usrbin_exec_PROGRAMS =
usrsbin_exec_PROGRAMS =
man_MANS =
pkgconfig_DATA =
usrlib_exec_LTLIBRARIES =
bin_PROGRAMS =
sbin_PROGRAMS =
dist_usrbin_exec_SCRIPTS =
systemdsystemunit_DATA =
dist_bashcompletion_DATA =
check_PROGRAMS =
dist_check_SCRIPTS =
PATHFILES =
ADOCFILES_COMMON =
MANPAGES =
MANLINKS =
INSTALL_EXEC_HOOKS =
UNINSTALL_HOOKS =
INSTALL_DATA_HOOKS =
CLEAN_LOCALS =
CHECK_LOCALS =
EXTRA_DIST =
CLEANFILES =
SUBDIRS = po
if ENABLE_ASCIIDOC
if ENABLE_POMAN
SUBDIRS += po-man
endif
endif
RCS_FIND_IGNORE = \( -name SCCS -o -name BitKeeper -o -name .svn -o \
-name CVS -o -name .pc -o -name .hg -o -name .git \) -prune -o
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST += \
.version \
autogen.sh \
Documentation \
po/update-potfiles \
README.licensing
include tools/Makemodule.am
include include/Makemodule.am
include lib/Makemodule.am
include libuuid/Makemodule.am
include libblkid/Makemodule.am
include libmount/Makemodule.am
include libsmartcols/Makemodule.am
include libfdisk/Makemodule.am
include schedutils/Makemodule.am
include text-utils/Makemodule.am
include term-utils/Makemodule.am
include login-utils/Makemodule.am
include sys-utils/Makemodule.am
include misc-utils/Makemodule.am
include disk-utils/Makemodule.am
include bash-completion/Makemodule.am
include man-common/Makemodule.am
include tests/Makemodule.am
build-sys: Properly order install dependencies of pylibmount Introduce a dependency so that libmount.so is installed before pylibmount.so, so that when libtool tries to relink it, it can find libmount.so in the destdir. We introduce this additional make rule through an AC_SUBST variable, to prevent automake from trying to interpret that. This trick has been suggested in http://stackoverflow.com/a/8643550. This fixes a failure of `make install DESTDIR=...` when trying to relink pylibmount against libmount.la. libtool will look for libmount.so under ${DESTDIR}/${libdir} in that case, but if it is not yet present there, libtool assumes it is a system installed library and use -lmount instead, which causes the following failure if libmount is not installed on the base system yet: libtool: install: warning: relinking `pylibmount.la' libtool: install: (... libtool --mode=relink gcc -o pylibmount.la \ -rpath /usr/lib/python2.7/dist-packages/libmount \ libmount/python/*.lo libmount.la ... -lpython2.7 \ -inst-prefix-dir /path/to/destdir) /usr/bin/ld: cannot find -lmount collect2: error: ld returned 1 exit status libtool: install: error: relink `pylibmount.la' ... make[3]: *** [install-pylibmountexecLTLIBRARIES] Error 1 This seems to be a previously encountered issue, since automake includes a hack to insert such a dependency rule to install all libLTLIBRARIES before attempting to install binPROGRAMS, initially introduced in the commit below: http://git.savannah.gnu.org/cgit/automake.git/commit/?id=bd4a1d5ad1a72fa780a8b7fd6c365a5dad2e6220 Also related bug from Ubuntu tracker: https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/1442076 Tested that `make install` starts working again after this commit, even when libmount-dev is not installed on the system. Also confirmed that `make distcheck` is now functional. Confirmed that the all the files expected in the Python directory (both __init__.py and pylibmount.so) are present after an install. Tested that parallel install works, the dependency is always respected since it's explicit. Inspected the generated Makefile and confirmed that the definition of install-pylibmountexecLTLIBRARIES (generated by automake) and the explicit dependency we introduced are both present. Signed-off-by: Filipe Brandenburger <filbranden@google.com>
2016-02-05 12:13:40 -06:00
# pylibmountexec module must be installed after usrlib_exec libraries,
# otherwise the libtool relink step will fail to find libmount.la and
# will try -lmount which is possibly not available.
#
# So introduce this dependency rule:
# install-pylibmountexecLTLIBRARIES: install-usrlib_execLTLIBRARIES
@verbatim_pylibmount_dependency@
#
# Don't rely on configure.ac AC_CONFIG_FILES for install paths.
#
# The paths should be expanded at make time rather than configure:
# - to support 'make install prefix=/foo DESTDIR=/foo'
# - to recursively expands the paths (e.g. AC_CONFIG_FILES expands
# '@usrsbin_execdir@' to ${exec_prefix}/sbin')
#
edit_cmd = sed \
-e 's|@prefix[@]|$(prefix)|g' \
-e 's|@exec_prefix[@]|$(exec_prefix)|g' \
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
-e 's|@datadir[@]|$(datadir)|g' \
-e 's|@sbindir[@]|$(sbindir)|g' \
-e 's|@bindir[@]|$(bindir)|g' \
-e 's|@docdir[@]|$(docdir)|g' \
-e 's|@includedir[@]|$(includedir)|g' \
build: use --runstatedir instead of --localstatedir The util-linux code was previously aligned to use @localstatedir@ and the util-linux build system was set to override the default to use /run. Current GNU Coding Standards introduced the @runstatedir@ variable for this purpose. Lets use that instead. The GNU default for @runstatedir@ is ${localstatedir}/run so util-linux still override the default to be /run to preserve the status quo from before. The only difference is that you'll now pass --runstatedir to override the location on the command line instead of --localstatedir. (FWIW, Debhelper in compat 11 will automatically start passing --runstatedir=/run to all autotools configured builds. It already passes --localstatedir=/var (to avoid it ending up with the GNU default /usr/local/var) which breaks the util-linux build system code that tries to default it to /run. This change will thus allow util-linux and debhelper to work better together and avoid the need for a package-specific override.) Relevant historic commits: * commit 07a16b9d1e5a48550a0d19abb9a900853433ffa2 "build-sys: change --localstatedir to /run" * commit 80c51185d50f00a2701f9379f10fc48a0f885dfc "uuidd: use run configured state directory" * commit 01c5b787947aeaffc7e56000827e3edefa357c59 "agetty: use configured run state directory" [kzak@redhat.com: - add $runstatedir fallback for autoconf < 2.70 - check for unmodified $localstatedir] CC: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Andreas Henriksson <andreas@fatal.se> Signed-off-by: Karel Zak <kzak@redhat.com>
2017-07-27 09:00:42 -05:00
-e 's|@runstatedir[@]|$(runstatedir)|g' \
-e 's|@usrlib_execdir[@]|$(usrlib_execdir)|g' \
-e 's|@usrbin_execdir[@]|$(usrbin_execdir)|g' \
-e 's|@usrsbin_execdir[@]|$(usrsbin_execdir)|g' \
-e 's|@VERSION[@]|$(VERSION)|g' \
-e 's|@ADJTIME_PATH[@]|$(ADJTIME_PATH)|g' \
-e 's|@LIBUUID_VERSION[@]|$(LIBUUID_VERSION)|g' \
-e 's|@LIBMOUNT_VERSION[@]|$(LIBMOUNT_VERSION)|g' \
-e 's|@LIBMOUNT_MAJOR_VERSION[@]|$(LIBMOUNT_MAJOR_VERSION)|g' \
-e 's|@LIBMOUNT_MINOR_VERSION[@]|$(LIBMOUNT_MINOR_VERSION)|g' \
-e 's|@LIBMOUNT_PATCH_VERSION[@]|$(LIBMOUNT_PATCH_VERSION)|g' \
-e 's|@LIBSMARTCOLS_VERSION[@]|$(LIBSMARTCOLS_VERSION)|g' \
-e 's|@LIBFDISK_PC_REQUIRES[@]|$(LIBFDISK_PC_REQUIRES)|g' \
-e 's|@LIBFDISK_VERSION[@]|$(LIBFDISK_VERSION)|g' \
-e 's|@LIBFDISK_MAJOR_VERSION[@]|$(LIBFDISK_MAJOR_VERSION)|g' \
-e 's|@LIBFDISK_MINOR_VERSION[@]|$(LIBFDISK_MINOR_VERSION)|g' \
-e 's|@LIBFDISK_PATCH_VERSION[@]|$(LIBFDISK_PATCH_VERSION)|g' \
-e 's|@LIBBLKID_VERSION[@]|$(LIBBLKID_VERSION)|g'
if HAVE_SELINUX
edit_cmd += -e 's|@LIBSELINUX[@]|libselinux|g'
else
edit_cmd += -e 's|@LIBSELINUX[@]||g'
endif
if HAVE_CRYPTSETUP
if CRYPTSETUP_VIA_DLOPEN
edit_cmd += -e 's|@LIBCRYPTSETUP[@]||g'
edit_cmd += -e 's|@LIBDL[@]|-ldl|g'
else
edit_cmd += -e 's|@LIBCRYPTSETUP[@]|libcryptsetup|g'
edit_cmd += -e 's|@LIBDL[@]||g'
endif
else
edit_cmd += -e 's|@LIBCRYPTSETUP[@]||g'
edit_cmd += -e 's|@LIBDL[@]||g'
endif
if USE_VENDORDIR
edit_cmd += -e 's|@vendordir[@]|$(vendordir)|g'
else
edit_cmd += -e 's|@vendordir[@]||g'
endif
CLEANFILES += $(PATHFILES) $(EXTRA_LTLIBRARIES)
EXTRA_DIST += $(PATHFILES:=.in)
$(PATHFILES): Makefile
@ rm -f $@ $@.tmp
$(AM_V_at) $(MKDIR_P) $$(dirname $@)
$(AM_V_GEN) srcdir=''; \
test -f ./$@.in || srcdir=$(srcdir)/; \
$(edit_cmd) $${srcdir}$@.in >$@.tmp
@ mv $@.tmp $@
if ENABLE_ASCIIDOC
EXTRA_DIST += $(ADOCFILES_COMMON) $(MANPAGES) $(MANLINKS)
man_MANS += $(MANPAGES) $(MANLINKS)
$(MANPAGES): $(ADOCFILES_COMMON)
2021-03-24 14:28:08 -05:00
asciidoc_man_cmd = $(ASCIIDOCTOR) \
-b manpage \
-a 'release-version=$(VERSION)' \
-a 'package-docdir=$(docdir)' \
-a 'VERSION=$(VERSION)' \
-a 'ADJTIME_PATH=$(ADJTIME_PATH)'
SUFFIXES = .1.adoc .3.adoc .5.adoc .8.adoc .1 .3 .5 .8
.1.adoc.1 .3.adoc.3 .5.adoc.5 .8.adoc.8:
$(AM_V_GEN) test -f ./$@ || \
$(MKDIR_P) $$(dirname $@) && \
$(asciidoc_man_cmd) --base-dir=$(abs_srcdir) \
--destination-dir $(abs_builddir)/$$(dirname $@) $<
$(MANLINKS): $(MANPAGES)
gen-man: $(man_MANS)
else
if HAVE_MANPAGES
EXTRA_DIST += $(ADOCFILES_COMMON) $(MANPAGES) $(MANLINKS)
man_MANS += $(MANPAGES) $(MANLINKS)
endif
gen-man:
endif
# Arrange so that .tarball-version appears only in the distribution
# tarball, and never in a checked-out repository.
dist-hook:
echo $(VERSION) > $(distdir)/.tarball-version
# Set ChangeLog tag reference.
sed -i "s!log!log?h=v$(VERSION)!" $(distdir)/ChangeLog
distclean-local:
-find . -name \*~ -o -name \*.orig -o -name \*.rej | xargs rm -f
rm -rf autom4te.cache
checkincludes:
@find * $(RCS_FIND_IGNORE) \
-name '*.[hcS]' -type f -print | sort -u \
| xargs $(top_srcdir)/tools/checkincludes.pl
checkconfig:
@find * $(RCS_FIND_IGNORE) \
-name '*.[hcS]' -type f -print | sort -u \
| xargs $(top_srcdir)/tools/checkconfig.sh $(top_srcdir)
checkmans:
@$(top_srcdir)/tools/checkadoc-missing.sh
@$(top_srcdir)/tools/checkadoc-repeat.sh
checkxalloc:
@ $(top_srcdir)/tools/checkxalloc.sh
checkdecl:
@ $(top_srcdir)/tools/checkdecl.sh
checkcompletion:
@ $(top_srcdir)/tools/checkcompletion.sh $(top_srcdir)
checkusage:
@ $(top_srcdir)/tools/checkusage.sh \
$(bin_PROGRAMS) $(sbin_PROGRAMS) \
$(usrbin_exec_PROGRAMS) $(usrsbin_exec_PROGRAMS)
checklibdoc:
@ $(top_srcdir)/tools/checklibdocs.sh \
$(top_srcdir)/libmount/src/libmount.sym \
$(top_srcdir)/libmount/docs/libmount-sections.txt
@ $(top_srcdir)/tools/checklibdocs.sh \
$(top_srcdir)/libfdisk/src/libfdisk.sym \
$(top_srcdir)/libfdisk/docs/libfdisk-sections.txt
@ $(top_srcdir)/tools/checklibdocs.sh \
$(top_srcdir)/libsmartcols/src/libsmartcols.sym \
$(top_srcdir)/libsmartcols/docs/libsmartcols-sections.txt
@ $(top_srcdir)/tools/checklibdocs.sh \
$(top_srcdir)/libblkid/src/libblkid.sym \
$(top_srcdir)/libblkid/docs/libblkid-sections.txt
DISTCHECK_CONFIGURE_FLAGS = \
--disable-makeinstall-chown \
--disable-use-tty-group \
--disable-silent-rules \
--disable-rpath \
--enable-all-programs \
--enable-gtk-doc \
--with-python \
--with-bashcompletiondir=$$dc_install_base/$(bashcompletiondir) \
--with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
BUILT_SOURCES = .version
.version:
echo $(VERSION) > $@-t && mv $@-t $@
CHANGELOG_FILE = v$(VERSION)-ChangeLog
$(CHANGELOG_FILE):
@ if test "x$$PREVIOUS_VERSION" == "x"; then \
echo "Usage make changelog PREVIOUS_VERSION=<version>"; \
exit 1; \
fi
@ echo "Changes between v$(PREVIOUS_VERSION) and v$(VERSION)" > $(CHANGELOG_FILE)
@ echo "--------------------------------------------" >> $(CHANGELOG_FILE)
@ echo >> $(CHANGELOG_FILE)
$(AM_V_GEN) git log --stat v$(PREVIOUS_VERSION)..HEAD >> $(CHANGELOG_FILE)
#
#
# smatch scan -- smatch and cgcc are expected in $PATH
#
checksmatch:
$(MAKE) CHECK="smatch --data=$(abs_top_srcdir)/tools/smatch-data" CC=cgcc
check-programs: $(check_PROGRAMS)
changelog: $(CHANGELOG_FILE)
install-exec-hook: $(INSTALL_EXEC_HOOKS)
uninstall-hook: $(UNINSTALL_HOOKS)
install-data-hook: $(INSTALL_DATA_HOOKS)
clean-local: $(CLEAN_LOCALS)
check-local: $(CHECK_LOCALS)