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