]> git.ipfire.org Git - thirdparty/util-linux.git/blob - Makefile.am
build-sys: make man pages location independent
[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 # Automake (at least up to 1.10) mishandles dist_man_MANS inside conditionals.
32 # Unlike with other dist primaries, the files are not distributed if the
33 # conditional is false.
34 # Work the bug around until it is fixed:
35 dist_noinst_DATA = $(dist_man_MANS)
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
46 ul_libuuid_incdir = $(top_srcdir)/libuuid/src
47
48 bashcompletiondir = @bashcompletiondir@
49
50 dist_noinst_HEADERS =
51 noinst_PROGRAMS =
52 EXTRA_LTLIBRARIES =
53 usrbin_exec_PROGRAMS =
54 usrsbin_exec_PROGRAMS =
55 dist_man_MANS =
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 dist_bashcompletion_DATA =
64 check_PROGRAMS =
65 dist_check_SCRIPTS =
66
67 PATHFILES =
68
69 INSTALL_EXEC_HOOKS =
70 UNINSTALL_HOOKS =
71 INSTALL_DATA_HOOKS =
72 CLEAN_LOCALS =
73 CHECK_LOCALS =
74 MANPAGES =
75 MANLINKS =
76 MANPAGES_EXTRA =
77
78 EXTRA_DIST =
79 CLEANFILES =
80
81 SUBDIRS = po
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
118 # pylibmountexec module must be installed after usrlib_exec libraries,
119 # otherwise the libtool relink step will fail to find libmount.la and
120 # will try -lmount which is possibly not available.
121 #
122 # So introduce this dependency rule:
123 # install-pylibmountexecLTLIBRARIES: install-usrlib_execLTLIBRARIES
124 @verbatim_pylibmount_dependency@
125
126 #
127 # Don't rely on configure.ac AC_CONFIG_FILES for install paths.
128 #
129 # The paths should be expanded at make time rather than configure:
130 # - to support 'make install prefix=/foo DESTDIR=/foo'
131 # - to recursively expands the paths (e.g. AC_CONFIG_FILES expands
132 # '@usrsbin_execdir@' to ${exec_prefix}/sbin')
133 #
134 edit_cmd = sed \
135 -e 's|@prefix[@]|$(prefix)|g' \
136 -e 's|@exec_prefix[@]|$(exec_prefix)|g' \
137 -e 's|@sysconfdir[@]|$(sysconfdir)|g' \
138 -e 's|@datadir[@]|$(datadir)|g' \
139 -e 's|@sbindir[@]|$(sbindir)|g' \
140 -e 's|@bindir[@]|$(bindir)|g' \
141 -e 's|@docdir[@]|$(docdir)|g' \
142 -e 's|@includedir[@]|$(includedir)|g' \
143 -e 's|@runstatedir[@]|$(runstatedir)|g' \
144 -e 's|@usrlib_execdir[@]|$(usrlib_execdir)|g' \
145 -e 's|@usrbin_execdir[@]|$(usrbin_execdir)|g' \
146 -e 's|@usrsbin_execdir[@]|$(usrsbin_execdir)|g' \
147 -e 's|@VERSION[@]|$(VERSION)|g' \
148 -e 's|@ADJTIME_PATH[@]|$(ADJTIME_PATH)|g' \
149 -e 's|@LIBUUID_VERSION[@]|$(LIBUUID_VERSION)|g' \
150 -e 's|@LIBMOUNT_VERSION[@]|$(LIBMOUNT_VERSION)|g' \
151 -e 's|@LIBMOUNT_MAJOR_VERSION[@]|$(LIBMOUNT_MAJOR_VERSION)|g' \
152 -e 's|@LIBMOUNT_MINOR_VERSION[@]|$(LIBMOUNT_MINOR_VERSION)|g' \
153 -e 's|@LIBMOUNT_PATCH_VERSION[@]|$(LIBMOUNT_PATCH_VERSION)|g' \
154 -e 's|@LIBSMARTCOLS_VERSION[@]|$(LIBSMARTCOLS_VERSION)|g' \
155 -e 's|@LIBFDISK_PC_REQUIRES[@]|$(LIBFDISK_PC_REQUIRES)|g' \
156 -e 's|@LIBFDISK_VERSION[@]|$(LIBFDISK_VERSION)|g' \
157 -e 's|@LIBFDISK_MAJOR_VERSION[@]|$(LIBFDISK_MAJOR_VERSION)|g' \
158 -e 's|@LIBFDISK_MINOR_VERSION[@]|$(LIBFDISK_MINOR_VERSION)|g' \
159 -e 's|@LIBFDISK_PATCH_VERSION[@]|$(LIBFDISK_PATCH_VERSION)|g' \
160 -e 's|@LIBBLKID_VERSION[@]|$(LIBBLKID_VERSION)|g'
161
162 if HAVE_SELINUX
163 edit_cmd += -e 's|@LIBSELINUX[@]|libselinux|g'
164 else
165 edit_cmd += -e 's|@LIBSELINUX[@]||g'
166 endif
167
168 if HAVE_CRYPTSETUP
169 if CRYPTSETUP_VIA_DLOPEN
170 edit_cmd += -e 's|@LIBCRYPTSETUP[@]||g'
171 edit_cmd += -e 's|@LIBDL[@]|-ldl|g'
172 else
173 edit_cmd += -e 's|@LIBCRYPTSETUP[@]|libcryptsetup|g'
174 edit_cmd += -e 's|@LIBDL[@]||g'
175 endif
176 else
177 edit_cmd += -e 's|@LIBCRYPTSETUP[@]||g'
178 edit_cmd += -e 's|@LIBDL[@]||g'
179 endif
180
181 if USE_VENDORDIR
182 edit_cmd += -e 's|@vendordir[@]|$(vendordir)|g'
183 else
184 edit_cmd += -e 's|@vendordir[@]||g'
185 endif
186
187 CLEANFILES += $(PATHFILES) $(EXTRA_LTLIBRARIES)
188 EXTRA_DIST += $(PATHFILES:=.in)
189
190 $(PATHFILES): Makefile
191 @ rm -f $@ $@.tmp
192 $(AM_V_at) $(MKDIR_P) $$(dirname $@)
193 $(AM_V_GEN) srcdir=''; \
194 test -f ./$@.in || srcdir=$(srcdir)/; \
195 $(edit_cmd) $${srcdir}$@.in >$@.tmp
196 @ mv $@.tmp $@
197
198
199 asciidoc_man_cmd = $(ASCIIDOCTOR) \
200 -b manpage \
201 -a 'VERSION=$(VERSION)' \
202 -a 'ADJTIME_PATH=$(ADJTIME_PATH)'
203
204 dist_man_MANS += $(MANPAGES) $(MANLINKS)
205
206 CLEANFILES += $(dist_man_MANS)
207 EXTRA_DIST += $(MANPAGES:=.adoc) $(MANPAGES_EXTRA)
208
209 $(MANPAGES): $(MANPAGES:=.adoc) $(MANPAGES_EXTRA) Makefile
210 @ rm -f $@
211 $(AM_V_at) $(MKDIR_P) $$(dirname $@)
212 $(AM_V_GEN) srcdir=''; \
213 test -f ./$@.adoc || srcdir=$(srcdir)/; \
214 $(asciidoc_man_cmd) --base-dir=$${srcdir} $${srcdir}$@.adoc --destination-dir $$(dirname $@)
215
216 gen-man: $(dist_man_MANS)
217
218
219 # Arrange so that .tarball-version appears only in the distribution
220 # tarball, and never in a checked-out repository.
221 dist-hook:
222 echo $(VERSION) > $(distdir)/.tarball-version
223 # Set ChangeLog tag reference.
224 sed -i "s!log!log?h=v$(VERSION)!" $(distdir)/ChangeLog
225
226 distclean-local:
227 -find . -name \*~ -o -name \*.orig -o -name \*.rej | xargs rm -f
228 rm -rf autom4te.cache
229
230
231 checkincludes:
232 @find * $(RCS_FIND_IGNORE) \
233 -name '*.[hcS]' -type f -print | sort -u \
234 | xargs $(top_srcdir)/tools/checkincludes.pl
235
236 checkconfig:
237 @find * $(RCS_FIND_IGNORE) \
238 -name '*.[hcS]' -type f -print | sort -u \
239 | xargs $(top_srcdir)/tools/checkconfig.sh $(top_srcdir)
240
241 checkmans:
242 @$(top_srcdir)/tools/checkmans.sh
243
244 checkxalloc:
245 @ $(top_srcdir)/tools/checkxalloc.sh
246
247 checkdecl:
248 @ $(top_srcdir)/tools/checkdecl.sh
249
250 checkcompletion:
251 @ $(top_srcdir)/tools/checkcompletion.sh $(top_srcdir)
252
253 checkusage:
254 @ $(top_srcdir)/tools/checkusage.sh \
255 $(bin_PROGRAMS) $(sbin_PROGRAMS) \
256 $(usrbin_exec_PROGRAMS) $(usrsbin_exec_PROGRAMS)
257 checklibdoc:
258 @ $(top_srcdir)/tools/checklibdocs.sh \
259 $(top_srcdir)/libmount/src/libmount.sym \
260 $(top_srcdir)/libmount/docs/libmount-sections.txt
261 @ $(top_srcdir)/tools/checklibdocs.sh \
262 $(top_srcdir)/libfdisk/src/libfdisk.sym \
263 $(top_srcdir)/libfdisk/docs/libfdisk-sections.txt
264 @ $(top_srcdir)/tools/checklibdocs.sh \
265 $(top_srcdir)/libsmartcols/src/libsmartcols.sym \
266 $(top_srcdir)/libsmartcols/docs/libsmartcols-sections.txt
267 @ $(top_srcdir)/tools/checklibdocs.sh \
268 $(top_srcdir)/libblkid/src/libblkid.sym \
269 $(top_srcdir)/libblkid/docs/libblkid-sections.txt
270
271 DISTCHECK_CONFIGURE_FLAGS = \
272 --disable-use-tty-group \
273 --disable-silent-rules \
274 --enable-all-programs \
275 --disable-makeinstall-chown \
276 --enable-static-programs \
277 --enable-gtk-doc \
278 --with-python \
279 --with-bashcompletiondir=$$dc_install_base/$(bashcompletiondir) \
280 --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
281
282 BUILT_SOURCES = .version
283 .version:
284 echo $(VERSION) > $@-t && mv $@-t $@
285
286 CHANGELOG_FILE = v$(VERSION)-ChangeLog
287
288 $(CHANGELOG_FILE):
289 @ if test "x$$PREVIOUS_VERSION" == "x"; then \
290 echo "Usage make changelog PREVIOUS_VERSION=<version>"; \
291 exit 1; \
292 fi
293 @ echo "Changes between v$(PREVIOUS_VERSION) and v$(VERSION)" > $(CHANGELOG_FILE)
294 @ echo "--------------------------------------------" >> $(CHANGELOG_FILE)
295 @ echo >> $(CHANGELOG_FILE)
296 $(AM_V_GEN) git log --stat v$(PREVIOUS_VERSION)..HEAD >> $(CHANGELOG_FILE)
297 #
298 #
299 # smatch scan -- smatch and cgcc are expected in $PATH
300 #
301 checksmatch:
302 $(MAKE) CHECK="smatch --data=$(abs_top_srcdir)/tools/smatch-data" CC=cgcc
303
304 check-programs: $(check_PROGRAMS)
305
306 changelog: $(CHANGELOG_FILE)
307
308 install-exec-hook: $(INSTALL_EXEC_HOOKS)
309
310 uninstall-hook: $(UNINSTALL_HOOKS)
311
312 install-data-hook: $(INSTALL_DATA_HOOKS)
313
314 clean-local: $(CLEAN_LOCALS)
315
316 check-local: $(CHECK_LOCALS)