maint: add doc/coverage to .gitignore
[coreutils.git] / src / local.mk
blob38b4bd44992c1a0aace3c4c03fa33a557f8b8b91
1 # Make coreutils programs. -*-Makefile-*-
2 # This is included by the top-level Makefile.am.
4 ## Copyright (C) 1990-2017 Free Software Foundation, Inc.
6 ## This program is free software: you can redistribute it and/or modify
7 ## it under the terms of the GNU General Public License as published by
8 ## the Free Software Foundation, either version 3 of the License, or
9 ## (at your option) any later version.
11 ## This program is distributed in the hope that it will be useful,
12 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ## GNU General Public License for more details.
16 ## You should have received a copy of the GNU General Public License
17 ## along with this program. If not, see <https://www.gnu.org/licenses/>.
19 # FIXME: once lib/ and gnulib-tests/ are also converted, hoist to Makefile.am
20 AM_CFLAGS = $(WERROR_CFLAGS)
22 # The list of all programs (separated in different variables to express
23 # the how and when they should be installed) is defined in this makefile
24 # fragment, autogenerated by the 'gen-lists-of-programs.sh' auxiliary
25 # script.
26 include $(srcdir)/src/cu-progs.mk
28 EXTRA_PROGRAMS = \
29 $(no_install__progs) \
30 $(build_if_possible__progs) \
31 $(default__progs)
33 # The user can tweak these lists at configure time.
34 bin_PROGRAMS = @bin_PROGRAMS@
35 pkglibexec_PROGRAMS = @pkglibexec_PROGRAMS@
37 # Needed by the testsuite.
38 noinst_PROGRAMS = \
39 src/getlimits \
40 src/make-prime-list
42 noinst_HEADERS = \
43 src/chown-core.h \
44 src/copy.h \
45 src/cp-hash.h \
46 src/die.h \
47 src/dircolors.h \
48 src/expand-common.h \
49 src/fiemap.h \
50 src/find-mount-point.h \
51 src/fs.h \
52 src/fs-is-local.h \
53 src/group-list.h \
54 src/ioblksize.h \
55 src/longlong.h \
56 src/ls.h \
57 src/operand2sig.h \
58 src/prog-fprintf.h \
59 src/remove.h \
60 src/set-fields.h \
61 src/system.h \
62 src/uname.h
64 EXTRA_DIST += \
65 src/dcgen \
66 src/dircolors.hin \
67 src/primes.h \
68 src/tac-pipe.c \
69 src/extract-magic
71 CLEANFILES += $(SCRIPTS)
73 # Also remove these sometimes-built programs.
74 # For example, even when excluded, they're built via 'sc_check-AUTHORS'
75 # or 'dist'.
76 CLEANFILES += $(no_install__progs)
78 noinst_LIBRARIES += src/libver.a
79 nodist_src_libver_a_SOURCES = src/version.c src/version.h
81 # Tell the linker to omit references to unused shared libraries.
82 AM_LDFLAGS = $(IGNORE_UNUSED_LIBRARIES_CFLAGS)
84 # Extra libraries needed by more than one program. Will be updated later.
85 copy_ldadd =
86 remove_ldadd =
88 # Sometimes, the expansion of $(LIBINTL) includes -lc which may
89 # include modules defining variables like 'optind', so libcoreutils.a
90 # must precede $(LIBINTL) in order to ensure we use GNU getopt.
91 # But libcoreutils.a must also follow $(LIBINTL), since libintl uses
92 # replacement functions defined in libcoreutils.a.
93 LDADD = src/libver.a lib/libcoreutils.a $(LIBINTL) lib/libcoreutils.a
95 # First, list all programs, to make listing per-program libraries easier.
96 # See [ below.
97 src_arch_LDADD = $(LDADD)
98 src_base64_LDADD = $(LDADD)
99 src_base32_LDADD = $(LDADD)
100 src_basename_LDADD = $(LDADD)
101 src_cat_LDADD = $(LDADD)
102 src_chcon_LDADD = $(LDADD)
103 src_chgrp_LDADD = $(LDADD)
104 src_chmod_LDADD = $(LDADD)
105 src_chown_LDADD = $(LDADD)
106 src_chroot_LDADD = $(LDADD)
107 src_cksum_LDADD = $(LDADD)
108 src_comm_LDADD = $(LDADD)
109 src_nproc_LDADD = $(LDADD)
110 src_cp_LDADD = $(LDADD)
111 if !SINGLE_BINARY
112 src_coreutils_LDADD = $(LDADD)
113 endif
114 src_csplit_LDADD = $(LDADD)
115 src_cut_LDADD = $(LDADD)
116 src_date_LDADD = $(LDADD)
117 src_dd_LDADD = $(LDADD)
118 src_df_LDADD = $(LDADD)
119 # See dir_LDADD below
120 src_dircolors_LDADD = $(LDADD)
121 src_dirname_LDADD = $(LDADD)
122 src_du_LDADD = $(LDADD)
123 src_echo_LDADD = $(LDADD)
124 src_env_LDADD = $(LDADD)
125 src_expand_LDADD = $(LDADD)
126 src_expr_LDADD = $(LDADD)
127 src_factor_LDADD = $(LDADD)
128 src_false_LDADD = $(LDADD)
129 src_fmt_LDADD = $(LDADD)
130 src_fold_LDADD = $(LDADD)
131 src_getlimits_LDADD = $(LDADD)
132 src_ginstall_LDADD = $(LDADD)
133 src_groups_LDADD = $(LDADD)
134 src_head_LDADD = $(LDADD)
135 src_hostid_LDADD = $(LDADD)
136 src_hostname_LDADD = $(LDADD)
137 src_id_LDADD = $(LDADD)
138 src_join_LDADD = $(LDADD)
139 src_kill_LDADD = $(LDADD)
140 src_link_LDADD = $(LDADD)
141 src_ln_LDADD = $(LDADD)
142 src_logname_LDADD = $(LDADD)
143 src_ls_LDADD = $(LDADD)
145 # This must *not* depend on anything in lib/, since it is used to generate
146 # src/primes.h. If it depended on libcoreutils.a, that would pull all lib/*.c
147 # into BUILT_SOURCES.
148 src_make_prime_list_LDADD =
150 src_md5sum_LDADD = $(LDADD)
151 src_mkdir_LDADD = $(LDADD)
152 src_mkfifo_LDADD = $(LDADD)
153 src_mknod_LDADD = $(LDADD)
154 src_mktemp_LDADD = $(LDADD)
155 src_mv_LDADD = $(LDADD)
156 src_nice_LDADD = $(LDADD)
157 src_nl_LDADD = $(LDADD)
158 src_nohup_LDADD = $(LDADD)
159 src_numfmt_LDADD = $(LDADD)
160 src_od_LDADD = $(LDADD)
161 src_paste_LDADD = $(LDADD)
162 src_pathchk_LDADD = $(LDADD)
163 src_pinky_LDADD = $(LDADD)
164 src_pr_LDADD = $(LDADD)
165 src_printenv_LDADD = $(LDADD)
166 src_printf_LDADD = $(LDADD)
167 src_ptx_LDADD = $(LDADD)
168 src_pwd_LDADD = $(LDADD)
169 src_readlink_LDADD = $(LDADD)
170 src_realpath_LDADD = $(LDADD)
171 src_rm_LDADD = $(LDADD)
172 src_rmdir_LDADD = $(LDADD)
173 src_runcon_LDADD = $(LDADD)
174 src_seq_LDADD = $(LDADD)
175 src_sha1sum_LDADD = $(LDADD)
176 src_sha224sum_LDADD = $(LDADD)
177 src_sha256sum_LDADD = $(LDADD)
178 src_sha384sum_LDADD = $(LDADD)
179 src_sha512sum_LDADD = $(LDADD)
180 src_shred_LDADD = $(LDADD)
181 src_shuf_LDADD = $(LDADD)
182 src_sleep_LDADD = $(LDADD)
183 src_sort_LDADD = $(LDADD)
184 src_split_LDADD = $(LDADD)
185 src_stat_LDADD = $(LDADD)
186 src_stdbuf_LDADD = $(LDADD)
187 src_stty_LDADD = $(LDADD)
188 src_sum_LDADD = $(LDADD)
189 src_sync_LDADD = $(LDADD)
190 src_tac_LDADD = $(LDADD)
191 src_tail_LDADD = $(LDADD)
192 src_tee_LDADD = $(LDADD)
193 src_test_LDADD = $(LDADD)
194 src_timeout_LDADD = $(LDADD)
195 src_touch_LDADD = $(LDADD)
196 src_tr_LDADD = $(LDADD)
197 src_true_LDADD = $(LDADD)
198 src_truncate_LDADD = $(LDADD)
199 src_tsort_LDADD = $(LDADD)
200 src_tty_LDADD = $(LDADD)
201 src_uname_LDADD = $(LDADD)
202 src_unexpand_LDADD = $(LDADD)
203 src_uniq_LDADD = $(LDADD)
204 src_unlink_LDADD = $(LDADD)
205 src_uptime_LDADD = $(LDADD)
206 src_users_LDADD = $(LDADD)
207 # See vdir_LDADD below
208 src_wc_LDADD = $(LDADD)
209 src_who_LDADD = $(LDADD)
210 src_whoami_LDADD = $(LDADD)
211 src_yes_LDADD = $(LDADD)
213 # Synonyms. Recall that Automake transliterates '[' and '/' to '_'.
214 src___LDADD = $(src_test_LDADD)
215 src_dir_LDADD = $(src_ls_LDADD)
216 src_vdir_LDADD = $(src_ls_LDADD)
218 src_cp_LDADD += $(copy_ldadd)
219 src_ginstall_LDADD += $(copy_ldadd)
220 src_mv_LDADD += $(copy_ldadd)
222 src_mv_LDADD += $(remove_ldadd)
223 src_rm_LDADD += $(remove_ldadd)
225 # for eaccess, euidaccess
226 copy_ldadd += $(LIB_EACCESS)
227 remove_ldadd += $(LIB_EACCESS)
228 src_sort_LDADD += $(LIB_EACCESS)
229 src_test_LDADD += $(LIB_EACCESS)
231 # for selinux use
232 copy_ldadd += $(LIB_SELINUX)
233 src_chcon_LDADD += $(LIB_SELINUX)
234 src_ginstall_LDADD += $(LIB_SELINUX)
235 src_id_LDADD += $(LIB_SELINUX)
236 src_id_LDADD += $(LIB_SMACK)
237 src_ls_LDADD += $(LIB_SELINUX)
238 src_ls_LDADD += $(LIB_SMACK)
239 src_mkdir_LDADD += $(LIB_SELINUX)
240 src_mkdir_LDADD += $(LIB_SMACK)
241 src_mkfifo_LDADD += $(LIB_SELINUX)
242 src_mkfifo_LDADD += $(LIB_SMACK)
243 src_mknod_LDADD += $(LIB_SELINUX)
244 src_mknod_LDADD += $(LIB_SMACK)
245 src_runcon_LDADD += $(LIB_SELINUX)
246 src_stat_LDADD += $(LIB_SELINUX)
248 # for nvlist_lookup_uint64_array
249 src_stat_LDADD += $(LIB_NVPAIR)
251 # for gettime, settime, utimecmp, utimens
252 copy_ldadd += $(LIB_CLOCK_GETTIME)
253 src_date_LDADD += $(LIB_CLOCK_GETTIME)
254 src_ginstall_LDADD += $(LIB_CLOCK_GETTIME)
255 src_ls_LDADD += $(LIB_CLOCK_GETTIME)
256 src_pr_LDADD += $(LIB_CLOCK_GETTIME)
257 src_timeout_LDADD += $(LIB_TIMER_TIME)
258 src_touch_LDADD += $(LIB_CLOCK_GETTIME)
260 # for gethrxtime
261 src_dd_LDADD += $(LIB_GETHRXTIME)
263 # for cap_get_file
264 src_ls_LDADD += $(LIB_CAP)
266 # for fdatasync
267 src_dd_LDADD += $(LIB_FDATASYNC)
268 src_shred_LDADD += $(LIB_FDATASYNC)
269 src_sync_LDADD += $(LIB_FDATASYNC)
271 # for xnanosleep
272 src_sleep_LDADD += $(LIB_NANOSLEEP)
273 src_sort_LDADD += $(LIB_NANOSLEEP)
274 src_tail_LDADD += $(LIB_NANOSLEEP)
276 # for various GMP functions
277 src_expr_LDADD += $(LIB_GMP)
278 src_factor_LDADD += $(LIB_GMP)
280 # for getloadavg
281 src_uptime_LDADD += $(GETLOADAVG_LIBS)
283 # for various ACL functions
284 copy_ldadd += $(LIB_ACL)
285 src_ls_LDADD += $(LIB_HAS_ACL)
287 # for various xattr functions
288 copy_ldadd += $(LIB_XATTR)
290 # for print_unicode_char, proper_name_utf8
291 src_factor_LDADD += $(LIBICONV)
292 src_printf_LDADD += $(LIBICONV)
293 src_ptx_LDADD += $(LIBICONV)
295 # for libcrypto hash routines
296 src_md5sum_LDADD += $(LIB_CRYPTO)
297 src_sort_LDADD += $(LIB_CRYPTO)
298 src_sha1sum_LDADD += $(LIB_CRYPTO)
299 src_sha224sum_LDADD += $(LIB_CRYPTO)
300 src_sha256sum_LDADD += $(LIB_CRYPTO)
301 src_sha384sum_LDADD += $(LIB_CRYPTO)
302 src_sha512sum_LDADD += $(LIB_CRYPTO)
304 # for canon_host
305 src_pinky_LDADD += $(GETADDRINFO_LIB)
306 src_who_LDADD += $(GETADDRINFO_LIB)
308 # for gethostname, uname
309 src_hostname_LDADD += $(GETHOSTNAME_LIB)
310 src_uname_LDADD += $(GETHOSTNAME_LIB)
312 # for strsignal
313 src_kill_LDADD += $(LIBTHREAD)
315 # for pthread
316 src_sort_LDADD += $(LIB_PTHREAD)
318 # Get the release year from lib/version-etc.c.
319 RELEASE_YEAR = \
320 `sed -n '/.*COPYRIGHT_YEAR = \([0-9][0-9][0-9][0-9]\) };/s//\1/p' \
321 $(top_srcdir)/lib/version-etc.c`
323 selinux_sources = \
324 src/selinux.c \
325 src/selinux.h
327 copy_sources = \
328 src/copy.c \
329 src/cp-hash.c \
330 src/extent-scan.c \
331 src/extent-scan.h \
332 src/force-link.c \
333 src/force-link.h
335 # Use 'ginstall' in the definition of PROGRAMS and in dependencies to avoid
336 # confusion with the 'install' target. The install rule transforms 'ginstall'
337 # to install before applying any user-specified name transformations.
339 # Don't apply prefix transformations to libstdbuf shared lib
340 # as that's not generally needed, and we need to reference the
341 # name directly in LD_PRELOAD etc. In general it's surprising
342 # that $(transform) is applied to libexec at all given that is
343 # for internal package naming, not privy to $(transform).
345 transform = s/ginstall/install/;/libstdbuf/!$(program_transform_name)
347 src_ginstall_SOURCES = src/install.c src/prog-fprintf.c $(copy_sources) \
348 $(selinux_sources)
350 # This is for the '[' program. Automake transliterates '[' and '/' to '_'.
351 src___SOURCES = src/lbracket.c
353 nodist_src_coreutils_SOURCES = src/coreutils.h
354 src_coreutils_SOURCES = src/coreutils.c
356 src_cp_SOURCES = src/cp.c $(copy_sources) $(selinux_sources)
357 src_dir_SOURCES = src/ls.c src/ls-dir.c
358 src_vdir_SOURCES = src/ls.c src/ls-vdir.c
359 src_id_SOURCES = src/id.c src/group-list.c
360 src_groups_SOURCES = src/groups.c src/group-list.c
361 src_ls_SOURCES = src/ls.c src/ls-ls.c
362 src_ln_SOURCES = src/ln.c \
363 src/force-link.c src/force-link.h \
364 src/relpath.c src/relpath.h
365 src_chown_SOURCES = src/chown.c src/chown-core.c
366 src_chgrp_SOURCES = src/chgrp.c src/chown-core.c
367 src_kill_SOURCES = src/kill.c src/operand2sig.c
368 src_realpath_SOURCES = src/realpath.c src/relpath.c src/relpath.h
369 src_timeout_SOURCES = src/timeout.c src/operand2sig.c
371 src_mv_SOURCES = src/mv.c src/remove.c $(copy_sources) $(selinux_sources)
372 src_rm_SOURCES = src/rm.c src/remove.c
374 src_mkdir_SOURCES = src/mkdir.c src/prog-fprintf.c $(selinux_sources)
375 src_rmdir_SOURCES = src/rmdir.c src/prog-fprintf.c
377 src_mkfifo_SOURCES = src/mkfifo.c $(selinux_sources)
378 src_mknod_SOURCES = src/mknod.c $(selinux_sources)
380 src_df_SOURCES = src/df.c src/find-mount-point.c
381 src_stat_SOURCES = src/stat.c src/find-mount-point.c
383 src_uname_SOURCES = src/uname.c src/uname-uname.c
384 src_arch_SOURCES = src/uname.c src/uname-arch.c
386 src_cut_SOURCES = src/cut.c src/set-fields.c
387 src_numfmt_SOURCES = src/numfmt.c src/set-fields.c
389 src_md5sum_CPPFLAGS = -DHASH_ALGO_MD5=1 $(AM_CPPFLAGS)
390 src_sha1sum_SOURCES = src/md5sum.c
391 src_sha1sum_CPPFLAGS = -DHASH_ALGO_SHA1=1 $(AM_CPPFLAGS)
392 src_sha224sum_SOURCES = src/md5sum.c
393 src_sha224sum_CPPFLAGS = -DHASH_ALGO_SHA224=1 $(AM_CPPFLAGS)
394 src_sha256sum_SOURCES = src/md5sum.c
395 src_sha256sum_CPPFLAGS = -DHASH_ALGO_SHA256=1 $(AM_CPPFLAGS)
396 src_sha384sum_SOURCES = src/md5sum.c
397 src_sha384sum_CPPFLAGS = -DHASH_ALGO_SHA384=1 $(AM_CPPFLAGS)
398 src_sha512sum_SOURCES = src/md5sum.c
399 src_sha512sum_CPPFLAGS = -DHASH_ALGO_SHA512=1 $(AM_CPPFLAGS)
400 # Include the file on the command line to avoid modifying
401 # the blake2 upstream source
402 if USE_XLC_INCLUDE
403 src_b2sum_CPPFLAGS = -qinclude=config.h
404 else
405 src_b2sum_CPPFLAGS = -include config.h
406 endif
407 src_b2sum_CPPFLAGS += -DHASH_ALGO_BLAKE2=1 $(AM_CPPFLAGS)
408 src_b2sum_SOURCES = src/md5sum.c \
409 src/blake2/blake2.h src/blake2/blake2-impl.h \
410 src/blake2/blake2b-ref.c \
411 src/blake2/b2sum.c src/blake2/b2sum.h
413 src_base64_CPPFLAGS = -DBASE_TYPE=64 $(AM_CPPFLAGS)
414 src_base32_SOURCES = src/base64.c
415 src_base32_CPPFLAGS = -DBASE_TYPE=32 $(AM_CPPFLAGS)
417 src_ginstall_CPPFLAGS = -DENABLE_MATCHPATHCON=1 $(AM_CPPFLAGS)
419 src_expand_SOURCES = src/expand.c src/expand-common.c
420 src_unexpand_SOURCES = src/unexpand.c src/expand-common.c
422 # Ensure we don't link against libcoreutils.a as that lib is
423 # not compiled with -fPIC which causes issues on 64 bit at least
424 src_libstdbuf_so_LDADD = $(LIBINTL)
426 # Note libstdbuf is only compiled if GCC is available
427 # (as per the check in configure.ac), so these flags should be available.
428 # libtool is probably required to relax this dependency.
429 src_libstdbuf_so_LDFLAGS = -shared
430 src_libstdbuf_so_CFLAGS = -fPIC $(AM_CFLAGS)
432 BUILT_SOURCES += src/coreutils.h
433 if SINGLE_BINARY
434 # Single binary dependencies
435 src_coreutils_CFLAGS = -DSINGLE_BINARY $(AM_CFLAGS)
436 #src_coreutils_LDFLAGS = $(AM_LDFLAGS)
437 src_coreutils_LDADD = $(single_binary_deps) $(LDADD) $(single_binary_libs)
438 src_coreutils_DEPENDENCIES = $(LDADD) $(single_binary_deps)
440 include $(top_srcdir)/src/single-binary.mk
442 # Creates symlinks or shebangs to the installed programs when building
443 # coreutils single binary.
444 EXTRA_src_coreutils_DEPENDENCIES = src/coreutils_$(single_binary_install_type)
445 endif SINGLE_BINARY
447 CLEANFILES += src/coreutils_symlinks
448 src/coreutils_symlinks: Makefile
449 $(AM_V_GEN)touch $@
450 $(AM_V_at)${MKDIR_P} src
451 $(AM_V_at)for i in x $(single_binary_progs); do \
452 test $$i = x && continue; \
453 rm -f src/$$i$(EXEEXT) || exit $$?; \
454 $(LN_S) -s coreutils$(EXEEXT) src/$$i$(EXEEXT) || exit $$?; \
455 done
457 CLEANFILES += src/coreutils_shebangs
458 src/coreutils_shebangs: Makefile
459 $(AM_V_GEN)touch $@
460 $(AM_V_at)${MKDIR_P} src
461 $(AM_V_at)for i in x $(single_binary_progs); do \
462 test $$i = x && continue; \
463 rm -f src/$$i$(EXEEXT) || exit $$?; \
464 printf '#!%s --coreutils-prog-shebang=%s\n' \
465 $(abs_top_builddir)/src/coreutils$(EXEEXT) $$i \
466 >src/$$i$(EXEEXT) || exit $$?; \
467 chmod a+x,a-w src/$$i$(EXEEXT) || exit $$?; \
468 done
470 clean-local:
471 $(AM_V_at)for i in x $(single_binary_progs); do \
472 test $$i = x && continue; \
473 rm -f src/$$i$(EXEEXT) || exit $$?; \
474 done
477 BUILT_SOURCES += src/dircolors.h
478 src/dircolors.h: src/dcgen src/dircolors.hin
479 $(AM_V_GEN)rm -f $@ $@-t
480 $(AM_V_at)${MKDIR_P} src
481 $(AM_V_at)$(PERL) -w -- $(srcdir)/src/dcgen \
482 $(srcdir)/src/dircolors.hin > $@-t
483 $(AM_V_at)chmod a-w $@-t
484 $(AM_V_at)mv $@-t $@
486 # This file is built by maintainers. It's architecture-independent,
487 # and it needs to be built on a widest-known-int architecture, so it's
488 # built only if absent. It is not cleaned because we don't want to
489 # insist that maintainers must build on hosts that support the widest
490 # known ints (currently 128-bit).
491 BUILT_SOURCES += $(top_srcdir)/src/primes.h
492 $(top_srcdir)/src/primes.h:
493 $(AM_V_at)${MKDIR_P} src
494 $(MAKE) src/make-prime-list$(EXEEXT)
495 $(AM_V_GEN)rm -f $@ $@-t
496 $(AM_V_at)src/make-prime-list$(EXEEXT) 5000 > $@-t
497 $(AM_V_at)chmod a-w $@-t
498 $(AM_V_at)mv $@-t $@
500 # false exits nonzero even with --help or --version.
501 # test doesn't support --help or --version.
502 # Tell automake to exempt then from that installcheck test.
503 AM_INSTALLCHECK_STD_OPTIONS_EXEMPT = src/false src/test
505 # Compare fs.h with the list of file system names/magic-numbers in the
506 # Linux statfs man page. This target prints any new name/number pairs.
507 # Also compare against /usr/include/linux/magic.h
508 .PHONY: src/fs-magic-compare
509 src/fs-magic-compare: src/fs-magic src/fs-kernel-magic src/fs-def
510 @join -v1 -t@ src/fs-magic src/fs-def
511 @join -v1 -t@ src/fs-kernel-magic src/fs-def
513 CLEANFILES += src/fs-def
514 src/fs-def: src/fs.h
515 grep '^# *define ' src/fs.h | $(ASSORT) > $@-t && mv $@-t $@
517 # Massage bits of the statfs man page and definitions from
518 # /usr/include/linux/magic.h to be in a form consistent with what's in fs.h.
519 fs_normalize_perl_subst = \
520 -e 's/MINIX_SUPER_MAGIC\b/MINIX/;' \
521 -e 's/MINIX_SUPER_MAGIC2\b/MINIX_30/;' \
522 -e 's/MINIX2_SUPER_MAGIC\b/MINIX_V2/;' \
523 -e 's/MINIX2_SUPER_MAGIC2\b/MINIX_V2_30/;' \
524 -e 's/MINIX3_SUPER_MAGIC\b/MINIX_V3/;' \
525 -e 's/CIFS_MAGIC_NUMBER/CIFS/;' \
526 -e 's/(_SUPER)?_MAGIC//;' \
527 -e 's/\s+0x(\S+)/" 0x" . uc $$1/e;' \
528 -e 's/(\s+0x)(\X{3})\b/$${1}0$$2/;' \
529 -e 's/(\s+0x)(\X{6})\b/$${1}00$$2/;' \
530 -e 's/(\s+0x)(\X{7})\b/$${1}0$$2/;' \
531 -e 's/^\s+//;' \
532 -e 's/^\043define\s+//;' \
533 -e 's/^_(XIAFS)/$$1/;' \
534 -e 's/^USBDEVICE/USBDEVFS/;' \
535 -e 's/NTFS_SB/NTFS/;' \
536 -e 's/^/\043 define S_MAGIC_/;' \
537 -e 's,\s*/\* .*? \*/,,;'
539 CLEANFILES += src/fs-magic
540 src/fs-magic: Makefile
541 @MANPAGER= man statfs \
542 |perl -ne '/File system types:/.../Nobody kno/ and print' \
543 |grep 0x | perl -p \
544 $(fs_normalize_perl_subst) \
545 | grep -Ev 'S_MAGIC_EXT[34]|STACK_END' \
546 | $(ASSORT) \
547 > $@-t && mv $@-t $@
549 DISTCLEANFILES += src/fs-latest-magic.h
550 # This rule currently gets the latest header, but probably isn't general
551 # enough to enable by default.
552 # @kgit='https://git.kernel.org/cgit/linux/kernel/git'; \
553 # wget -q $$kgit/torvalds/linux.git/plain/include/uapi/linux/magic.h \
554 # -O $@
555 src/fs-latest-magic.h:
556 @touch $@
558 CLEANFILES += src/fs-kernel-magic
559 src/fs-kernel-magic: Makefile src/fs-latest-magic.h
560 @perl -ne '/^#define.*0x/ and print' \
561 /usr/include/linux/magic.h src/fs-latest-magic.h \
562 | perl -p \
563 $(fs_normalize_perl_subst) \
564 | grep -Ev 'S_MAGIC_EXT[34]|STACK_END' \
565 | $(ASSORT) -u \
566 > $@-t && mv $@-t $@
568 BUILT_SOURCES += src/fs-is-local.h
569 src/fs-is-local.h: src/stat.c src/extract-magic
570 $(AM_V_GEN)rm -f $@
571 $(AM_V_at)${MKDIR_P} src
572 $(AM_V_at)$(PERL) $(srcdir)/src/extract-magic \
573 --local $(srcdir)/src/stat.c > $@t
574 $(AM_V_at)chmod a-w $@t
575 $(AM_V_at)mv $@t $@
577 BUILT_SOURCES += src/fs.h
578 src/fs.h: src/stat.c src/extract-magic
579 $(AM_V_GEN)rm -f $@
580 $(AM_V_at)${MKDIR_P} src
581 $(AM_V_at)$(PERL) $(srcdir)/src/extract-magic \
582 $(srcdir)/src/stat.c > $@t
583 $(AM_V_at)chmod a-w $@t
584 $(AM_V_at)mv $@t $@
586 BUILT_SOURCES += src/version.c
587 src/version.c: Makefile
588 $(AM_V_GEN)rm -f $@
589 $(AM_V_at)${MKDIR_P} src
590 $(AM_V_at)printf '#include <config.h>\n' > $@t
591 $(AM_V_at)printf 'char const *Version = "$(PACKAGE_VERSION)";\n' >> $@t
592 $(AM_V_at)chmod a-w $@t
593 $(AM_V_at)mv $@t $@
595 BUILT_SOURCES += src/version.h
596 src/version.h: Makefile
597 $(AM_V_GEN)rm -f $@
598 $(AM_V_at)${MKDIR_P} src
599 $(AM_V_at)printf 'extern char const *Version;\n' > $@t
600 $(AM_V_at)chmod a-w $@t
601 $(AM_V_at)mv $@t $@
603 # Generates a list of macro invocations like:
604 # SINGLE_BINARY_PROGRAM(program_name_str, main_name)
605 # once for each program list on $(single_binary_progs). Note that
606 # for [ the macro invocation is:
607 # SINGLE_BINARY_PROGRAM("[", _)
608 DISTCLEANFILES += src/coreutils.h
609 src/coreutils.h: Makefile
610 $(AM_V_GEN)rm -f $@
611 $(AM_V_at)${MKDIR_P} src
612 $(AM_V_at)for prog in x $(single_binary_progs); do \
613 test $$prog = x && continue; \
614 prog=`basename $$prog`; \
615 main=`echo $$prog | tr '[' '_'`; \
616 echo "SINGLE_BINARY_PROGRAM(\"$$prog\", $$main)"; \
617 done | sort > $@t
618 $(AM_V_at)chmod a-w $@t
619 $(AM_V_at)mv $@t $@
621 DISTCLEANFILES += src/version.c src/version.h
622 MAINTAINERCLEANFILES += $(BUILT_SOURCES)
624 all_programs = \
625 $(bin_PROGRAMS) \
626 $(bin_SCRIPTS) \
627 $(EXTRA_PROGRAMS)
629 pm = progs-makefile
630 pr = progs-readme
631 # Ensure that the list of programs in README matches the list
632 # of programs we can build.
633 check-local: check-README check-duplicate-no-install
634 .PHONY: check-README
635 check-README:
636 $(AM_V_GEN)rm -rf $(pr) $(pm)
637 $(AM_V_at)echo $(all_programs) \
638 | tr -s ' ' '\n' \
639 | sed -e 's,$(EXEEXT)$$,,' \
640 -e 's,^src/,,' \
641 -e 's/^ginstall$$/install/' \
642 | sed /libstdbuf/d \
643 | $(ASSORT) -u > $(pm) && \
644 sed -n '/^The programs .* are:/,/^[a-zA-Z]/p' $(top_srcdir)/README \
645 | sed -n '/^ */s///p' | tr -s ' ' '\n' > $(pr)
646 $(AM_V_at)diff $(pm) $(pr) && rm -rf $(pr) $(pm)
648 # Ensure that a by-default-not-installed program (listed in
649 # $(no_install__progs) is not also listed as another $(EXTRA_PROGRAMS)
650 # entry, because if that were to happen, it *would* be installed
651 # by default.
652 .PHONY: check-duplicate-no-install
653 check-duplicate-no-install:
654 $(AM_V_GEN)test -z "`echo '$(EXTRA_PROGRAMS)' | tr ' ' '\n' | uniq -d`"
656 # Use the just-built 'ginstall', when not cross-compiling.
657 if CROSS_COMPILING
658 cu_install_program = @INSTALL@
659 else
660 cu_install_program = src/ginstall
661 endif
662 INSTALL = $(cu_install_program) -c