]> git.ipfire.org Git - thirdparty/util-linux.git/blobdiff - Makefile.am
hwclock: reuse error message
[thirdparty/util-linux.git] / Makefile.am
index adf87804b699ea1b13f320fb3ace5bb35e395e0b..2df89ff6dfeee3bd9a7f48989a983fa018a6e241 100644 (file)
@@ -2,20 +2,36 @@ AM_CPPFLAGS = \
        -include config.h \
        -I$(top_srcdir)/include \
        -DLOCALEDIR=\"$(localedir)\" \
-       -D_PATH_RUNSTATEDIR=\"${runstatedir}\"
+       -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
+
+if WITH_COVERAGE
+AM_CPPFLAGS += \
+       -include $(top_srcdir)/include/coverage.h
+endif
+
 AM_CFLAGS = -fsigned-char $(WARN_CFLAGS)
-AM_LDFLAGS = $(ASAN_LDFLAGS)
+AM_CXXFLAGS = $(AM_CFLAGS)
+AM_LDFLAGS = $(ASAN_LDFLAGS) $(UBSAN_LDFLAGS) $(FUZZING_ENGINE_LDFLAGS) $(COVERAGE_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)
 
-# Automake (at least up to 1.10) mishandles dist_man_MANS inside conditionals.
-# Unlike with other dist primaries, the files are not distributed if the
-# conditional is false.
-# Work the bug around until it is fixed:
-dist_noinst_DATA = $(dist_man_MANS)
+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
@@ -28,16 +44,14 @@ ul_libfdisk_incdir  = $(top_builddir)/libfdisk/src
 
 ul_libuuid_incdir  = $(top_srcdir)/libuuid/src
 
-pkgconfigdir = $(usrlib_execdir)/pkgconfig
-
 bashcompletiondir = @bashcompletiondir@
 
 dist_noinst_HEADERS =
+dist_noinst_DATA =
 noinst_PROGRAMS =
-noinst_LTLIBRARIES =
+EXTRA_LTLIBRARIES =
 usrbin_exec_PROGRAMS =
 usrsbin_exec_PROGRAMS =
-dist_man_MANS =
 man_MANS =
 pkgconfig_DATA =
 usrlib_exec_LTLIBRARIES =
@@ -49,7 +63,12 @@ dist_bashcompletion_DATA =
 check_PROGRAMS =
 dist_check_SCRIPTS =
 
+BUILT_SOURCES =
+
 PATHFILES =
+ADOCFILES_COMMON =
+MANPAGES =
+MANLINKS =
 
 INSTALL_EXEC_HOOKS =
 UNINSTALL_HOOKS =
@@ -62,6 +81,12 @@ 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
 
@@ -92,9 +117,33 @@ include misc-utils/Makemodule.am
 include disk-utils/Makemodule.am
 
 include bash-completion/Makemodule.am
+include man-common/Makemodule.am
 
 include tests/Makemodule.am
 
+# Meson files
+EXTRA_DIST += \
+       meson.build \
+       meson_options.txt \
+       tools/meson-make-manpage-stub.sh \
+       tools/meson-make-symlink.sh \
+       \
+       include/meson.build \
+       libblkid/meson.build \
+       libmount/meson.build \
+       libmount/python/meson.build \
+       misc-utils/meson.build \
+       libsmartcols/meson.build \
+       text-utils/meson.build \
+       po/meson.build \
+       lib/meson.build \
+       libuuid/meson.build \
+       sys-utils/meson.build \
+       libfdisk/meson.build \
+       term-utils/meson.build \
+       disk-utils/meson.build \
+       login-utils/meson.build
+
 # 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.
@@ -118,6 +167,7 @@ edit_cmd = sed \
         -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' \
         -e 's|@runstatedir[@]|$(runstatedir)|g' \
         -e 's|@usrlib_execdir[@]|$(usrlib_execdir)|g' \
@@ -138,7 +188,32 @@ edit_cmd = sed \
         -e 's|@LIBFDISK_PATCH_VERSION[@]|$(LIBFDISK_PATCH_VERSION)|g' \
         -e 's|@LIBBLKID_VERSION[@]|$(LIBBLKID_VERSION)|g'
 
-CLEANFILES += $(PATHFILES)
+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
@@ -149,12 +224,72 @@ $(PATHFILES): Makefile
                $(edit_cmd) $${srcdir}$@.in >$@.tmp
        @ mv $@.tmp $@
 
+
+if ENABLE_ASCIIDOC
+EXTRA_DIST += $(ADOCFILES_COMMON) $(MANPAGES) $(MANLINKS)
+man_MANS += $(MANPAGES) $(MANLINKS)
+
+$(MANPAGES): $(ADOCFILES_COMMON)
+
+asciidoc_man_cmd = $(ASCIIDOCTOR) \
+       -b manpage \
+       -a 'release-version=$(VERSION)' \
+       -a 'package-docdir=$(docdir)' \
+       -a 'VERSION=$(VERSION)' \
+       -a 'ADJTIME_PATH=$(ADJTIME_PATH)' \
+       --load-path '$(abs_srcdir)/tools' \
+       --require asciidoctor-includetracker
+
+if HAVE_ASCIIDOCTOR_FAILURE_LEVEL
+asciidoc_man_cmd += --failure-level ERROR
+endif
+
+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 $@) $<
+
+-include \
+       $(abs_builddir)/**.1.deps \
+       $(abs_builddir)/**.3.deps \
+       $(abs_builddir)/**.5.deps \
+       $(abs_builddir)/**.8.deps
+
+$(MANLINKS): $(MANPAGES)
+gen-man: $(man_MANS)
+
+# Standard "make" follows BUILD_* macros from ./configure, and in this case, it
+# ignores man pages for disabled tools, but for distribution tarball, we need
+# to generate all man-pages (to avoid dependence on asciidoc). [kzak Jan-2022]
+gen-man-dist:
+       @list=`find -name *.adoc -not -path "*/man-common/*" -not -path "*/po-man/*" | sed -e 's/\.adoc//g'`; \
+       missing=`for p in $$list; do test -f $$p || echo $$p; done`; \
+       if test -n "$$missing"; then \
+               $(MAKE) $(AM_MAKEFLAGS) $$missing; \
+       fi;
+
+
+# !ENABLE_ASCIIDOC
+else
+
+if HAVE_MANPAGES
+EXTRA_DIST += $(ADOCFILES_COMMON) $(MANPAGES) $(MANLINKS)
+man_MANS += $(MANPAGES) $(MANLINKS)
+endif
+
+gen-man:
+gen-man-dist:
+endif
+
+
 # Arrange so that .tarball-version appears only in the distribution
 # tarball, and never in a checked-out repository.
-dist-hook:
+dist-hook: gen-man-dist
        echo $(VERSION) > $(distdir)/.tarball-version
 # Set ChangeLog tag reference.
-       sed -i "s/log/log;h=$(VERSION)/" $(distdir)/ChangeLog
+       sed -i "s!log!log?h=v$(VERSION)!" $(distdir)/ChangeLog
 
 distclean-local:
        -find . -name \*~ -o -name \*.orig -o -name \*.rej | xargs rm -f
@@ -172,7 +307,8 @@ checkconfig:
                | xargs $(top_srcdir)/tools/checkconfig.sh $(top_srcdir)
 
 checkmans:
-       @$(top_srcdir)/tools/checkmans.sh
+       @$(top_srcdir)/tools/checkadoc-missing.sh
+       @$(top_srcdir)/tools/checkadoc-repeat.sh
 
 checkxalloc:
        @ $(top_srcdir)/tools/checkxalloc.sh
@@ -202,17 +338,18 @@ checklibdoc:
                $(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 \
-       --disable-makeinstall-chown \
-       --enable-static-programs \
        --enable-gtk-doc \
        --with-python \
        --with-bashcompletiondir=$$dc_install_base/$(bashcompletiondir) \
        --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
 
-BUILT_SOURCES = .version
+
+BUILT_SOURCES += .version
 .version:
        echo $(VERSION) > $@-t && mv $@-t $@