]> git.ipfire.org Git - thirdparty/util-linux.git/blob - Makefile.am
Merge branch 'meson-more-build-options' of https://github.com/jwillikers/util-linux
[thirdparty/util-linux.git] / Makefile.am
1 AM_CPPFLAGS = \
2 -include config.h \
3 -I$(top_srcdir)/include \
4 -DLOCALEDIR=\"$(localedir)\" \
5 -D_PATH_RUNSTATEDIR=\"${runstatedir}\" \
6 -D_PATH_LOCALSTATEDIR=\"${localstatedir}\" \
7 -D_PATH_SYSCONFSTATICDIR=\"${sysconfstaticdir}\"
8
9 if USE_VENDORDIR
10 AM_CPPFLAGS += \
11 -D_PATH_VENDORDIR=\"${vendordir}\"
12 endif
13
14 if FUZZING_ENGINE
15 if !OSS_FUZZ
16 AM_CPPFLAGS += \
17 -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
18 endif
19 endif
20
21 if WITH_COVERAGE
22 AM_CPPFLAGS += \
23 -include $(top_srcdir)/include/coverage.h
24 endif
25
26 AM_CFLAGS = -fsigned-char $(WARN_CFLAGS)
27 AM_CXXFLAGS = $(AM_CFLAGS)
28 AM_LDFLAGS = $(ASAN_LDFLAGS) $(UBSAN_LDFLAGS) $(FUZZING_ENGINE_LDFLAGS) $(COVERAGE_LDFLAGS)
29
30 # Add gettext stuff to the global LDADD for systems with separate libintl
31 # library. The LTLIBINTL is generated by AM_GNU_GETTEXT macro.
32 #
33 LDADD = $(LTLIBINTL)
34
35 LIB_FUZZING_ENGINE ?= -fsanitize=fuzzer
36
37 # Paths to in-tree libraries (use ul_ prefix to avoid possible collisions) Note
38 # that blkid.h, libmount.h, libfdisk.h and libsmartcols.h are generated and
39 # stored in build dirs.
40 #
41 ul_libblkid_incdir = $(top_builddir)/libblkid/src
42 ul_libmount_incdir = $(top_builddir)/libmount/src
43 ul_libsmartcols_incdir = $(top_builddir)/libsmartcols/src
44 ul_libfdisk_incdir = $(top_builddir)/libfdisk/src
45 ul_liblastlog2_incdir = $(top_srcdir)/liblastlog2/src
46 ul_libuuid_incdir = $(top_srcdir)/libuuid/src
47
48 bashcompletiondir = @bashcompletiondir@
49
50 dist_noinst_HEADERS =
51 dist_noinst_DATA =
52 noinst_PROGRAMS =
53 EXTRA_LTLIBRARIES =
54 usrbin_exec_PROGRAMS =
55 usrsbin_exec_PROGRAMS =
56 man_MANS =
57 pkgconfig_DATA =
58 usrlib_exec_LTLIBRARIES =
59 bin_PROGRAMS =
60 sbin_PROGRAMS =
61 dist_usrbin_exec_SCRIPTS =
62 systemdsystemunit_DATA =
63 tmpfiles_DATA =
64 dist_bashcompletion_DATA =
65 check_PROGRAMS =
66 dist_check_SCRIPTS =
67
68 BUILT_SOURCES =
69
70 PATHFILES =
71 ADOCFILES_COMMON =
72 MANPAGES =
73 MANLINKS =
74
75 INSTALL_EXEC_HOOKS =
76 UNINSTALL_HOOKS =
77 INSTALL_DATA_HOOKS =
78 CLEAN_LOCALS =
79 CHECK_LOCALS =
80
81 EXTRA_DIST =
82 CLEANFILES =
83
84 SUBDIRS = po
85
86 if ENABLE_ASCIIDOC
87 if ENABLE_POMAN
88 SUBDIRS += po-man
89 endif
90 endif
91
92 RCS_FIND_IGNORE = \( -name SCCS -o -name BitKeeper -o -name .svn -o \
93 -name CVS -o -name .pc -o -name .hg -o -name .git \) -prune -o
94
95 ACLOCAL_AMFLAGS = -I m4
96
97 EXTRA_DIST += \
98 .version \
99 autogen.sh \
100 Documentation \
101 po/update-potfiles \
102 README.licensing
103
104 include tools/Makemodule.am
105 include include/Makemodule.am
106 include lib/Makemodule.am
107 include libuuid/Makemodule.am
108 include liblastlog2/Makemodule.am
109 include libblkid/Makemodule.am
110 include libmount/Makemodule.am
111 include libsmartcols/Makemodule.am
112 include libfdisk/Makemodule.am
113
114 include schedutils/Makemodule.am
115 include text-utils/Makemodule.am
116 include term-utils/Makemodule.am
117 include login-utils/Makemodule.am
118 include sys-utils/Makemodule.am
119 include misc-utils/Makemodule.am
120 include disk-utils/Makemodule.am
121
122 include pam_lastlog2/Makemodule.am
123 include bash-completion/Makemodule.am
124 include man-common/Makemodule.am
125
126 include Documentation/Makemodule.am
127 include tests/Makemodule.am
128
129 # Meson files
130 EXTRA_DIST += \
131 meson.build \
132 meson_options.txt \
133 tools/meson-make-manpage-stub.sh \
134 tools/meson-make-symlink.sh \
135 \
136 include/meson.build \
137 libblkid/meson.build \
138 libmount/meson.build \
139 libmount/python/meson.build \
140 misc-utils/meson.build \
141 libsmartcols/meson.build \
142 text-utils/meson.build \
143 po/meson.build \
144 lib/meson.build \
145 libuuid/meson.build \
146 liblastlog2/meson.build \
147 sys-utils/meson.build \
148 libfdisk/meson.build \
149 term-utils/meson.build \
150 disk-utils/meson.build \
151 login-utils/meson.build
152
153 # pylibmountexec module must be installed after usrlib_exec libraries,
154 # otherwise the libtool relink step will fail to find libmount.la and
155 # will try -lmount which is possibly not available.
156 #
157 # So introduce this dependency rule:
158 # install-pylibmountexecLTLIBRARIES: install-usrlib_execLTLIBRARIES
159 @verbatim_pylibmount_dependency@
160
161 #
162 # Don't rely on configure.ac AC_CONFIG_FILES for install paths.
163 #
164 # The paths should be expanded at make time rather than configure:
165 # - to support 'make install prefix=/foo DESTDIR=/foo'
166 # - to recursively expands the paths (e.g. AC_CONFIG_FILES expands
167 # '@usrsbin_execdir@' to ${exec_prefix}/sbin')
168 #
169 edit_cmd = sed \
170 -e 's|@prefix[@]|$(prefix)|g' \
171 -e 's|@exec_prefix[@]|$(exec_prefix)|g' \
172 -e 's|@sysconfdir[@]|$(sysconfdir)|g' \
173 -e 's|@datadir[@]|$(datadir)|g' \
174 -e 's|@sbindir[@]|$(sbindir)|g' \
175 -e 's|@bindir[@]|$(bindir)|g' \
176 -e 's|@docdir[@]|$(docdir)|g' \
177 -e 's|@includedir[@]|$(includedir)|g' \
178 -e 's|@runstatedir[@]|$(runstatedir)|g' \
179 -e 's|@localstatedir[@]|$(localstatedir)|g' \
180 -e 's|@usrlib_execdir[@]|$(usrlib_execdir)|g' \
181 -e 's|@usrbin_execdir[@]|$(usrbin_execdir)|g' \
182 -e 's|@usrsbin_execdir[@]|$(usrsbin_execdir)|g' \
183 -e 's|@VERSION[@]|$(VERSION)|g' \
184 -e 's|@ADJTIME_PATH[@]|$(ADJTIME_PATH)|g' \
185 -e 's|@LIBUUID_VERSION[@]|$(LIBUUID_VERSION)|g' \
186 -e 's|@LIBLASTLOG2_VERSION[@]|$(LIBLASTLOG2_VERSION)|g' \
187 -e 's|@LIBMOUNT_VERSION[@]|$(LIBMOUNT_VERSION)|g' \
188 -e 's|@LIBMOUNT_MAJOR_VERSION[@]|$(LIBMOUNT_MAJOR_VERSION)|g' \
189 -e 's|@LIBMOUNT_MINOR_VERSION[@]|$(LIBMOUNT_MINOR_VERSION)|g' \
190 -e 's|@LIBMOUNT_PATCH_VERSION[@]|$(LIBMOUNT_PATCH_VERSION)|g' \
191 -e 's|@LIBSMARTCOLS_VERSION[@]|$(LIBSMARTCOLS_VERSION)|g' \
192 -e 's|@LIBFDISK_PC_REQUIRES[@]|$(LIBFDISK_PC_REQUIRES)|g' \
193 -e 's|@LIBFDISK_VERSION[@]|$(LIBFDISK_VERSION)|g' \
194 -e 's|@LIBFDISK_MAJOR_VERSION[@]|$(LIBFDISK_MAJOR_VERSION)|g' \
195 -e 's|@LIBFDISK_MINOR_VERSION[@]|$(LIBFDISK_MINOR_VERSION)|g' \
196 -e 's|@LIBFDISK_PATCH_VERSION[@]|$(LIBFDISK_PATCH_VERSION)|g' \
197 -e 's|@LIBBLKID_VERSION[@]|$(LIBBLKID_VERSION)|g'
198
199 if HAVE_SELINUX
200 edit_cmd += -e 's|@LIBSELINUX[@]|libselinux|g'
201 else
202 edit_cmd += -e 's|@LIBSELINUX[@]||g'
203 endif
204
205 if HAVE_CRYPTSETUP
206 if CRYPTSETUP_VIA_DLOPEN
207 edit_cmd += -e 's|@LIBCRYPTSETUP[@]||g'
208 edit_cmd += -e 's|@LIBDL[@]|-ldl|g'
209 else
210 edit_cmd += -e 's|@LIBCRYPTSETUP[@]|libcryptsetup|g'
211 edit_cmd += -e 's|@LIBDL[@]||g'
212 endif
213 else
214 edit_cmd += -e 's|@LIBCRYPTSETUP[@]||g'
215 edit_cmd += -e 's|@LIBDL[@]||g'
216 endif
217
218 if USE_VENDORDIR
219 edit_cmd += -e 's|@vendordir[@]|$(vendordir)|g'
220 else
221 edit_cmd += -e 's|@vendordir[@]||g'
222 endif
223
224 CLEANFILES += $(PATHFILES) $(EXTRA_LTLIBRARIES)
225 EXTRA_DIST += $(PATHFILES:=.in)
226
227 $(PATHFILES): Makefile
228 @ rm -f $@ $@.tmp
229 $(AM_V_at) $(MKDIR_P) $$(dirname $@)
230 $(AM_V_GEN) srcdir=''; \
231 test -f ./$@.in || srcdir=$(srcdir)/; \
232 $(edit_cmd) $${srcdir}$@.in >$@.tmp
233 @ mv $@.tmp $@
234
235
236 if ENABLE_ASCIIDOC
237 EXTRA_DIST += $(ADOCFILES_COMMON) $(MANPAGES) $(MANLINKS)
238 man_MANS += $(MANPAGES) $(MANLINKS)
239
240 $(MANPAGES): $(ADOCFILES_COMMON)
241
242 asciidoc_man_cmd = $(ASCIIDOCTOR) \
243 -b manpage \
244 -a 'release-version=$(VERSION)' \
245 -a 'package-docdir=$(docdir)' \
246 -a 'VERSION=$(VERSION)' \
247 -a 'ADJTIME_PATH=$(ADJTIME_PATH)' \
248 --load-path '$(abs_srcdir)/tools' \
249 --require asciidoctor-includetracker
250
251 if HAVE_ASCIIDOCTOR_FAILURE_LEVEL
252 asciidoc_man_cmd += --failure-level ERROR
253 endif
254
255 SUFFIXES = .1.adoc .3.adoc .5.adoc .8.adoc .1 .3 .5 .8
256 .1.adoc.1 .3.adoc.3 .5.adoc.5 .8.adoc.8:
257 $(AM_V_GEN) test -f ./$@ || \
258 $(MKDIR_P) $$(dirname $@) && \
259 $(asciidoc_man_cmd) --base-dir=$(abs_srcdir) \
260 --destination-dir $(abs_builddir)/$$(dirname $@) $<
261
262 -include \
263 $(abs_builddir)/**.1.deps \
264 $(abs_builddir)/**.3.deps \
265 $(abs_builddir)/**.5.deps \
266 $(abs_builddir)/**.8.deps
267
268 $(MANLINKS): $(MANPAGES)
269 gen-man: $(man_MANS)
270
271 # Standard "make" follows BUILD_* macros from ./configure, and in this case, it
272 # ignores man pages for disabled tools, but for distribution tarball, we need
273 # to generate all man-pages (to avoid dependence on asciidoc). [kzak Jan-2022]
274 gen-man-dist:
275 @list=`find -name *.adoc -not -path "*/man-common/*" -not -path "*/po-man/*" | sed -e 's/\.adoc//g'`; \
276 missing=`for p in $$list; do test -f $$p || echo $$p; done`; \
277 if test -n "$$missing"; then \
278 $(MAKE) $(AM_MAKEFLAGS) $$missing; \
279 fi;
280
281
282 # !ENABLE_ASCIIDOC
283 else
284
285 if HAVE_MANPAGES
286 EXTRA_DIST += $(ADOCFILES_COMMON) $(MANPAGES) $(MANLINKS)
287 man_MANS += $(MANPAGES) $(MANLINKS)
288 endif
289
290 gen-man:
291 gen-man-dist:
292 endif
293
294
295 # Arrange so that .tarball-version appears only in the distribution
296 # tarball, and never in a checked-out repository.
297 dist-hook: gen-man-dist
298 echo $(VERSION) > $(distdir)/.tarball-version
299 # Set ChangeLog tag reference.
300 sed -i "s!log!log?h=v$(VERSION)!" $(distdir)/ChangeLog
301
302 distclean-local:
303 -find . -name \*~ -o -name \*.orig -o -name \*.rej | xargs rm -f
304 rm -rf autom4te.cache
305
306
307 checkincludes:
308 @find * $(RCS_FIND_IGNORE) \
309 -name '*.[hcS]' -type f -print | sort -u \
310 | xargs $(top_srcdir)/tools/checkincludes.pl
311
312 checkconfig:
313 @find * $(RCS_FIND_IGNORE) \
314 -name '*.[hcS]' -type f -print | sort -u \
315 | xargs $(top_srcdir)/tools/checkconfig.sh $(top_srcdir)
316
317 checkmans:
318 @$(top_srcdir)/tools/checkadoc-missing.sh
319 @$(top_srcdir)/tools/checkadoc-repeat.sh
320
321 checkxalloc:
322 @ $(top_srcdir)/tools/checkxalloc.sh
323
324 checkdecl:
325 @ $(top_srcdir)/tools/checkdecl.sh
326
327 checkcompletion:
328 @ $(top_srcdir)/tools/checkcompletion.sh $(top_srcdir)
329
330 checkusage:
331 @ $(top_srcdir)/tools/checkusage.sh \
332 $(bin_PROGRAMS) $(sbin_PROGRAMS) \
333 $(usrbin_exec_PROGRAMS) $(usrsbin_exec_PROGRAMS)
334 checklibdoc:
335 @ $(top_srcdir)/tools/checklibdocs.sh \
336 $(top_srcdir)/libmount/src/libmount.sym \
337 $(top_srcdir)/libmount/docs/libmount-sections.txt
338 @ $(top_srcdir)/tools/checklibdocs.sh \
339 $(top_srcdir)/libfdisk/src/libfdisk.sym \
340 $(top_srcdir)/libfdisk/docs/libfdisk-sections.txt
341 @ $(top_srcdir)/tools/checklibdocs.sh \
342 $(top_srcdir)/libsmartcols/src/libsmartcols.sym \
343 $(top_srcdir)/libsmartcols/docs/libsmartcols-sections.txt
344 @ $(top_srcdir)/tools/checklibdocs.sh \
345 $(top_srcdir)/libblkid/src/libblkid.sym \
346 $(top_srcdir)/libblkid/docs/libblkid-sections.txt
347
348 DISTCHECK_CONFIGURE_FLAGS = \
349 --disable-makeinstall-chown \
350 --disable-use-tty-group \
351 --disable-silent-rules \
352 --disable-rpath \
353 --enable-all-programs \
354 --enable-gtk-doc \
355 --with-python \
356 --with-bashcompletiondir=$$dc_install_base/$(bashcompletiondir) \
357 --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) \
358 --with-tmpfilesdir=$$dc_install_base/$(tmpfilesdir)
359
360 BUILT_SOURCES += .version
361 .version:
362 echo $(VERSION) > $@-t && mv $@-t $@
363
364 CHANGELOG_FILE = v$(VERSION)-ChangeLog
365
366 $(CHANGELOG_FILE):
367 @ if test "x$$PREVIOUS_VERSION" == "x"; then \
368 echo "Usage make changelog PREVIOUS_VERSION=<version>"; \
369 exit 1; \
370 fi
371 @ echo "Changes between v$(PREVIOUS_VERSION) and v$(VERSION)" > $(CHANGELOG_FILE)
372 @ echo "--------------------------------------------" >> $(CHANGELOG_FILE)
373 @ echo >> $(CHANGELOG_FILE)
374 $(AM_V_GEN) git log --stat v$(PREVIOUS_VERSION)..HEAD >> $(CHANGELOG_FILE)
375 #
376 #
377 # smatch scan -- smatch and cgcc are expected in $PATH
378 #
379 checksmatch:
380 $(MAKE) CHECK="smatch --data=$(abs_top_srcdir)/tools/smatch-data" CC=cgcc
381
382 check-programs: $(check_PROGRAMS)
383
384 changelog: $(CHANGELOG_FILE)
385
386 install-exec-hook: $(INSTALL_EXEC_HOOKS)
387
388 uninstall-hook: $(UNINSTALL_HOOKS)
389
390 install-data-hook: $(INSTALL_DATA_HOOKS)
391
392 clean-local: $(CLEAN_LOCALS)
393
394 check-local: $(CHECK_LOCALS)