]> git.ipfire.org Git - thirdparty/util-linux.git/blob - Makefile.am
build-sys: add support for --enable-fuzzing-engine
[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 noinst_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
75 EXTRA_DIST =
76 CLEANFILES =
77
78 SUBDIRS = po
79
80 RCS_FIND_IGNORE = \( -name SCCS -o -name BitKeeper -o -name .svn -o \
81 -name CVS -o -name .pc -o -name .hg -o -name .git \) -prune -o
82
83 ACLOCAL_AMFLAGS = -I m4
84
85 EXTRA_DIST += \
86 .version \
87 autogen.sh \
88 Documentation \
89 po/update-potfiles \
90 README.licensing
91
92 include tools/Makemodule.am
93 include include/Makemodule.am
94 include lib/Makemodule.am
95 include libuuid/Makemodule.am
96 include libblkid/Makemodule.am
97 include libmount/Makemodule.am
98 include libsmartcols/Makemodule.am
99 include libfdisk/Makemodule.am
100
101 include schedutils/Makemodule.am
102 include text-utils/Makemodule.am
103 include term-utils/Makemodule.am
104 include login-utils/Makemodule.am
105 include sys-utils/Makemodule.am
106 include misc-utils/Makemodule.am
107 include disk-utils/Makemodule.am
108
109 include bash-completion/Makemodule.am
110
111 include tests/Makemodule.am
112
113 # pylibmountexec module must be installed after usrlib_exec libraries,
114 # otherwise the libtool relink step will fail to find libmount.la and
115 # will try -lmount which is possibly not available.
116 #
117 # So introduce this dependency rule:
118 # install-pylibmountexecLTLIBRARIES: install-usrlib_execLTLIBRARIES
119 @verbatim_pylibmount_dependency@
120
121 #
122 # Don't rely on configure.ac AC_CONFIG_FILES for install paths.
123 #
124 # The paths should be expanded at make time rather than configure:
125 # - to support 'make install prefix=/foo DESTDIR=/foo'
126 # - to recursively expands the paths (e.g. AC_CONFIG_FILES expands
127 # '@usrsbin_execdir@' to ${exec_prefix}/sbin')
128 #
129 edit_cmd = sed \
130 -e 's|@prefix[@]|$(prefix)|g' \
131 -e 's|@exec_prefix[@]|$(exec_prefix)|g' \
132 -e 's|@sysconfdir[@]|$(sysconfdir)|g' \
133 -e 's|@datadir[@]|$(datadir)|g' \
134 -e 's|@sbindir[@]|$(sbindir)|g' \
135 -e 's|@bindir[@]|$(bindir)|g' \
136 -e 's|@docdir[@]|$(docdir)|g' \
137 -e 's|@includedir[@]|$(includedir)|g' \
138 -e 's|@runstatedir[@]|$(runstatedir)|g' \
139 -e 's|@usrlib_execdir[@]|$(usrlib_execdir)|g' \
140 -e 's|@usrbin_execdir[@]|$(usrbin_execdir)|g' \
141 -e 's|@usrsbin_execdir[@]|$(usrsbin_execdir)|g' \
142 -e 's|@VERSION[@]|$(VERSION)|g' \
143 -e 's|@ADJTIME_PATH[@]|$(ADJTIME_PATH)|g' \
144 -e 's|@LIBUUID_VERSION[@]|$(LIBUUID_VERSION)|g' \
145 -e 's|@LIBMOUNT_VERSION[@]|$(LIBMOUNT_VERSION)|g' \
146 -e 's|@LIBMOUNT_MAJOR_VERSION[@]|$(LIBMOUNT_MAJOR_VERSION)|g' \
147 -e 's|@LIBMOUNT_MINOR_VERSION[@]|$(LIBMOUNT_MINOR_VERSION)|g' \
148 -e 's|@LIBMOUNT_PATCH_VERSION[@]|$(LIBMOUNT_PATCH_VERSION)|g' \
149 -e 's|@LIBSMARTCOLS_VERSION[@]|$(LIBSMARTCOLS_VERSION)|g' \
150 -e 's|@LIBFDISK_PC_REQUIRES[@]|$(LIBFDISK_PC_REQUIRES)|g' \
151 -e 's|@LIBFDISK_VERSION[@]|$(LIBFDISK_VERSION)|g' \
152 -e 's|@LIBFDISK_MAJOR_VERSION[@]|$(LIBFDISK_MAJOR_VERSION)|g' \
153 -e 's|@LIBFDISK_MINOR_VERSION[@]|$(LIBFDISK_MINOR_VERSION)|g' \
154 -e 's|@LIBFDISK_PATCH_VERSION[@]|$(LIBFDISK_PATCH_VERSION)|g' \
155 -e 's|@LIBBLKID_VERSION[@]|$(LIBBLKID_VERSION)|g'
156
157 if HAVE_SELINUX
158 edit_cmd += -e 's|@LIBSELINUX[@]|libselinux|g'
159 else
160 edit_cmd += -e 's|@LIBSELINUX[@]||g'
161 endif
162
163 if HAVE_CRYPTSETUP
164 if CRYPTSETUP_VIA_DLOPEN
165 edit_cmd += -e 's|@LIBCRYPTSETUP[@]||g'
166 edit_cmd += -e 's|@LIBDL[@]|-ldl|g'
167 else
168 edit_cmd += -e 's|@LIBCRYPTSETUP[@]|libcryptsetup|g'
169 edit_cmd += -e 's|@LIBDL[@]||g'
170 endif
171 else
172 edit_cmd += -e 's|@LIBCRYPTSETUP[@]||g'
173 edit_cmd += -e 's|@LIBDL[@]||g'
174 endif
175
176 if USE_VENDORDIR
177 edit_cmd += -e 's|@vendordir[@]|$(vendordir)|g'
178 else
179 edit_cmd += -e 's|@vendordir[@]||g'
180 endif
181
182 CLEANFILES += $(PATHFILES)
183 EXTRA_DIST += $(PATHFILES:=.in)
184
185 $(PATHFILES): Makefile
186 @ rm -f $@ $@.tmp
187 $(AM_V_at) $(MKDIR_P) $$(dirname $@)
188 $(AM_V_GEN) srcdir=''; \
189 test -f ./$@.in || srcdir=$(srcdir)/; \
190 $(edit_cmd) $${srcdir}$@.in >$@.tmp
191 @ mv $@.tmp $@
192
193 # Arrange so that .tarball-version appears only in the distribution
194 # tarball, and never in a checked-out repository.
195 dist-hook:
196 echo $(VERSION) > $(distdir)/.tarball-version
197 # Set ChangeLog tag reference.
198 sed -i "s!log!log?h=v$(VERSION)!" $(distdir)/ChangeLog
199
200 distclean-local:
201 -find . -name \*~ -o -name \*.orig -o -name \*.rej | xargs rm -f
202 rm -rf autom4te.cache
203
204
205 checkincludes:
206 @find * $(RCS_FIND_IGNORE) \
207 -name '*.[hcS]' -type f -print | sort -u \
208 | xargs $(top_srcdir)/tools/checkincludes.pl
209
210 checkconfig:
211 @find * $(RCS_FIND_IGNORE) \
212 -name '*.[hcS]' -type f -print | sort -u \
213 | xargs $(top_srcdir)/tools/checkconfig.sh $(top_srcdir)
214
215 checkmans:
216 @$(top_srcdir)/tools/checkmans.sh
217
218 checkxalloc:
219 @ $(top_srcdir)/tools/checkxalloc.sh
220
221 checkdecl:
222 @ $(top_srcdir)/tools/checkdecl.sh
223
224 checkcompletion:
225 @ $(top_srcdir)/tools/checkcompletion.sh $(top_srcdir)
226
227 checkusage:
228 @ $(top_srcdir)/tools/checkusage.sh \
229 $(bin_PROGRAMS) $(sbin_PROGRAMS) \
230 $(usrbin_exec_PROGRAMS) $(usrsbin_exec_PROGRAMS)
231 checklibdoc:
232 @ $(top_srcdir)/tools/checklibdocs.sh \
233 $(top_srcdir)/libmount/src/libmount.sym \
234 $(top_srcdir)/libmount/docs/libmount-sections.txt
235 @ $(top_srcdir)/tools/checklibdocs.sh \
236 $(top_srcdir)/libfdisk/src/libfdisk.sym \
237 $(top_srcdir)/libfdisk/docs/libfdisk-sections.txt
238 @ $(top_srcdir)/tools/checklibdocs.sh \
239 $(top_srcdir)/libsmartcols/src/libsmartcols.sym \
240 $(top_srcdir)/libsmartcols/docs/libsmartcols-sections.txt
241 @ $(top_srcdir)/tools/checklibdocs.sh \
242 $(top_srcdir)/libblkid/src/libblkid.sym \
243 $(top_srcdir)/libblkid/docs/libblkid-sections.txt
244
245 DISTCHECK_CONFIGURE_FLAGS = \
246 --disable-use-tty-group \
247 --disable-silent-rules \
248 --enable-all-programs \
249 --disable-makeinstall-chown \
250 --enable-static-programs \
251 --enable-gtk-doc \
252 --with-python \
253 --with-bashcompletiondir=$$dc_install_base/$(bashcompletiondir) \
254 --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
255
256 BUILT_SOURCES = .version
257 .version:
258 echo $(VERSION) > $@-t && mv $@-t $@
259
260 CHANGELOG_FILE = v$(VERSION)-ChangeLog
261
262 $(CHANGELOG_FILE):
263 @ if test "x$$PREVIOUS_VERSION" == "x"; then \
264 echo "Usage make changelog PREVIOUS_VERSION=<version>"; \
265 exit 1; \
266 fi
267 @ echo "Changes between v$(PREVIOUS_VERSION) and v$(VERSION)" > $(CHANGELOG_FILE)
268 @ echo "--------------------------------------------" >> $(CHANGELOG_FILE)
269 @ echo >> $(CHANGELOG_FILE)
270 $(AM_V_GEN) git log --stat v$(PREVIOUS_VERSION)..HEAD >> $(CHANGELOG_FILE)
271 #
272 #
273 # smatch scan -- smatch and cgcc are expected in $PATH
274 #
275 checksmatch:
276 $(MAKE) CHECK="smatch --data=$(abs_top_srcdir)/tools/smatch-data" CC=cgcc
277
278 check-programs: $(check_PROGRAMS)
279
280 changelog: $(CHANGELOG_FILE)
281
282 install-exec-hook: $(INSTALL_EXEC_HOOKS)
283
284 uninstall-hook: $(UNINSTALL_HOOKS)
285
286 install-data-hook: $(INSTALL_DATA_HOOKS)
287
288 clean-local: $(CLEAN_LOCALS)
289
290 check-local: $(CHECK_LOCALS)