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