1 # Make coreutils programs. -*-Makefile-*-
2 # This is included by the top-level Makefile.am.
4 ## Copyright (C) 1990-2024 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
26 include $(srcdir)/src
/cu-progs.mk
29 $(no_install__progs
) \
30 $(build_if_possible__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.
49 src
/find-mount-point.h \
76 CLEANFILES
+= $(SCRIPTS
)
78 # Also remove these sometimes-built programs.
79 # For example, even when excluded, they're built via 'sc_check-AUTHORS'
81 CLEANFILES
+= $(no_install__progs
)
83 noinst_LIBRARIES
+= src
/libver.a
84 nodist_src_libver_a_SOURCES
= src
/version.c src
/version.h
86 # Tell the linker to omit references to unused shared libraries.
87 AM_LDFLAGS
= $(IGNORE_UNUSED_LIBRARIES_CFLAGS
)
89 # Extra libraries needed by more than one program. Will be updated later.
93 # Sometimes, the expansion of $(LIBINTL) includes -lc which may
94 # include modules defining variables like 'optind', so libcoreutils.a
95 # must precede $(LIBINTL) in order to ensure we use GNU getopt.
96 # But libcoreutils.a must also follow $(LIBINTL), since libintl uses
97 # replacement functions defined in libcoreutils.a.
98 # Similarly for $(MBRTOWC_LIB).
99 LDADD
= src
/libver.a lib
/libcoreutils.a
$(LIBINTL
) $(MBRTOWC_LIB
) \
102 # First, list all programs, to make listing per-program libraries easier.
104 src_arch_LDADD
= $(LDADD
)
105 src_base64_LDADD
= $(LDADD
)
106 src_base32_LDADD
= $(LDADD
)
107 src_basenc_LDADD
= $(LDADD
)
108 src_basename_LDADD
= $(LDADD
)
109 src_cat_LDADD
= $(LDADD
)
110 src_chcon_LDADD
= $(LDADD
)
111 # See chgrp_LDADD below
112 src_chmod_LDADD
= $(LDADD
)
113 src_chown_LDADD
= $(LDADD
)
114 src_chroot_LDADD
= $(LDADD
)
115 src_cksum_LDADD
= $(LDADD
)
116 src_comm_LDADD
= $(LDADD
)
117 src_nproc_LDADD
= $(LDADD
)
118 src_cp_LDADD
= $(LDADD
)
120 src_coreutils_LDADD
= $(LDADD
)
122 src_csplit_LDADD
= $(LDADD
)
123 src_cut_LDADD
= $(LDADD
)
124 src_date_LDADD
= $(LDADD
)
125 src_dd_LDADD
= $(LDADD
)
126 src_df_LDADD
= $(LDADD
)
127 # See dir_LDADD below
128 src_dircolors_LDADD
= $(LDADD
)
129 src_dirname_LDADD
= $(LDADD
)
130 src_du_LDADD
= $(LDADD
)
131 src_echo_LDADD
= $(LDADD
)
132 src_env_LDADD
= $(LDADD
)
133 src_expand_LDADD
= $(LDADD
)
134 src_expr_LDADD
= $(LDADD
)
135 src_factor_LDADD
= $(LDADD
)
136 src_false_LDADD
= $(LDADD
)
137 src_fmt_LDADD
= $(LDADD
)
138 src_fold_LDADD
= $(LDADD
)
139 src_getlimits_LDADD
= $(LDADD
)
140 src_ginstall_LDADD
= $(LDADD
)
141 src_groups_LDADD
= $(LDADD
)
142 src_head_LDADD
= $(LDADD
)
143 src_hostid_LDADD
= $(LDADD
)
144 src_hostname_LDADD
= $(LDADD
)
145 src_id_LDADD
= $(LDADD
)
146 src_join_LDADD
= $(LDADD
)
147 src_kill_LDADD
= $(LDADD
)
148 src_link_LDADD
= $(LDADD
)
149 src_ln_LDADD
= $(LDADD
)
150 src_logname_LDADD
= $(LDADD
)
151 src_ls_LDADD
= $(LDADD
)
153 # This must *not* depend on anything in lib/, since it is used to generate
154 # src/primes.h. If it depended on libcoreutils.a, that would pull all lib/*.c
155 # into BUILT_SOURCES.
156 src_make_prime_list_LDADD
=
158 src_md5sum_LDADD
= $(LDADD
)
159 src_mkdir_LDADD
= $(LDADD
)
160 src_mkfifo_LDADD
= $(LDADD
)
161 src_mknod_LDADD
= $(LDADD
)
162 src_mktemp_LDADD
= $(LDADD
)
163 src_mv_LDADD
= $(LDADD
)
164 src_nice_LDADD
= $(LDADD
)
165 src_nl_LDADD
= $(LDADD
)
166 src_nohup_LDADD
= $(LDADD
)
167 src_numfmt_LDADD
= $(LDADD
)
168 src_od_LDADD
= $(LDADD
)
169 src_paste_LDADD
= $(LDADD
)
170 src_pathchk_LDADD
= $(LDADD
)
171 src_pinky_LDADD
= $(LDADD
)
172 src_pr_LDADD
= $(LDADD
)
173 src_printenv_LDADD
= $(LDADD
)
174 src_printf_LDADD
= $(LDADD
)
175 src_ptx_LDADD
= $(LDADD
)
176 src_pwd_LDADD
= $(LDADD
)
177 src_readlink_LDADD
= $(LDADD
)
178 src_realpath_LDADD
= $(LDADD
)
179 src_rm_LDADD
= $(LDADD
)
180 src_rmdir_LDADD
= $(LDADD
)
181 src_runcon_LDADD
= $(LDADD
)
182 src_seq_LDADD
= $(LDADD
)
183 src_sha1sum_LDADD
= $(LDADD
)
184 src_sha224sum_LDADD
= $(LDADD
)
185 src_sha256sum_LDADD
= $(LDADD
)
186 src_sha384sum_LDADD
= $(LDADD
)
187 src_sha512sum_LDADD
= $(LDADD
)
188 src_shred_LDADD
= $(LDADD
)
189 src_shuf_LDADD
= $(LDADD
)
190 src_sleep_LDADD
= $(LDADD
)
191 src_sort_LDADD
= $(LDADD
)
192 src_split_LDADD
= $(LDADD
)
193 src_stat_LDADD
= $(LDADD
)
194 src_stdbuf_LDADD
= $(LDADD
)
195 src_stty_LDADD
= $(LDADD
)
196 src_sum_LDADD
= $(LDADD
)
197 src_sync_LDADD
= $(LDADD
)
198 src_tac_LDADD
= $(LDADD
)
199 src_tail_LDADD
= $(LDADD
)
200 src_tee_LDADD
= $(LDADD
)
201 src_test_LDADD
= $(LDADD
)
202 src_timeout_LDADD
= $(LDADD
)
203 src_touch_LDADD
= $(LDADD
)
204 src_tr_LDADD
= $(LDADD
)
205 src_true_LDADD
= $(LDADD
)
206 src_truncate_LDADD
= $(LDADD
)
207 src_tsort_LDADD
= $(LDADD
)
208 src_tty_LDADD
= $(LDADD
)
209 src_uname_LDADD
= $(LDADD
)
210 src_unexpand_LDADD
= $(LDADD
)
211 src_uniq_LDADD
= $(LDADD
)
212 src_unlink_LDADD
= $(LDADD
)
213 src_uptime_LDADD
= $(LDADD
)
214 src_users_LDADD
= $(LDADD
)
215 # See vdir_LDADD below
216 src_wc_LDADD
= $(LDADD
)
217 src_who_LDADD
= $(LDADD
)
218 src_whoami_LDADD
= $(LDADD
)
219 src_yes_LDADD
= $(LDADD
)
221 # Synonyms. Recall that Automake transliterates '[' and '/' to '_'.
222 src___LDADD
= $(src_test_LDADD
)
223 src_dir_LDADD
= $(src_ls_LDADD
)
224 src_vdir_LDADD
= $(src_ls_LDADD
)
225 src_chgrp_LDADD
= $(src_chown_LDADD
)
227 src_cp_LDADD
+= $(copy_ldadd
)
228 src_ginstall_LDADD
+= $(copy_ldadd
)
229 src_mv_LDADD
+= $(copy_ldadd
)
231 src_mv_LDADD
+= $(remove_ldadd
)
232 src_rm_LDADD
+= $(remove_ldadd
)
234 # for eaccess, euidaccess
235 copy_ldadd
+= $(EUIDACCESS_LIBGEN
)
236 remove_ldadd
+= $(EUIDACCESS_LIBGEN
)
237 src_sort_LDADD
+= $(EUIDACCESS_LIBGEN
)
238 src_test_LDADD
+= $(EUIDACCESS_LIBGEN
)
241 copy_ldadd
+= $(LIB_SELINUX
)
242 src_chcon_LDADD
+= $(LIB_SELINUX
)
243 src_ginstall_LDADD
+= $(LIB_SELINUX
)
244 src_id_LDADD
+= $(LIB_SELINUX
)
245 src_id_LDADD
+= $(LIB_SMACK
)
246 src_ls_LDADD
+= $(LIB_SELINUX
)
247 src_ls_LDADD
+= $(LIB_SMACK
)
248 src_mkdir_LDADD
+= $(LIB_SELINUX
)
249 src_mkdir_LDADD
+= $(LIB_SMACK
)
250 src_mkfifo_LDADD
+= $(LIB_SELINUX
)
251 src_mkfifo_LDADD
+= $(LIB_SMACK
)
252 src_mknod_LDADD
+= $(LIB_SELINUX
)
253 src_mknod_LDADD
+= $(LIB_SMACK
)
254 src_runcon_LDADD
+= $(LIB_SELINUX
)
255 src_stat_LDADD
+= $(LIB_SELINUX
)
257 # for nvlist_lookup_uint64_array
258 src_stat_LDADD
+= $(LIB_NVPAIR
)
260 # for gettime, settime, tempname, utimecmp, utimens
261 copy_ldadd
+= $(CLOCK_TIME_LIB
)
262 src_date_LDADD
+= $(CLOCK_TIME_LIB
)
263 src_ginstall_LDADD
+= $(CLOCK_TIME_LIB
)
264 src_ln_LDADD
+= $(CLOCK_TIME_LIB
)
265 src_ls_LDADD
+= $(CLOCK_TIME_LIB
)
266 src_mktemp_LDADD
+= $(CLOCK_TIME_LIB
)
267 src_pr_LDADD
+= $(CLOCK_TIME_LIB
)
268 src_sort_LDADD
+= $(CLOCK_TIME_LIB
)
269 src_split_LDADD
+= $(CLOCK_TIME_LIB
)
270 src_tac_LDADD
+= $(CLOCK_TIME_LIB
)
271 src_timeout_LDADD
+= $(TIMER_TIME_LIB
)
272 src_touch_LDADD
+= $(CLOCK_TIME_LIB
)
275 src_dd_LDADD
+= $(GETHRXTIME_LIB
)
278 src_ls_LDADD
+= $(LIB_CAP
)
281 src_dd_LDADD
+= $(FDATASYNC_LIB
)
282 src_shred_LDADD
+= $(FDATASYNC_LIB
)
283 src_sync_LDADD
+= $(FDATASYNC_LIB
)
286 src_sleep_LDADD
+= $(NANOSLEEP_LIB
)
287 src_sort_LDADD
+= $(NANOSLEEP_LIB
)
288 src_tail_LDADD
+= $(NANOSLEEP_LIB
)
290 # for various GMP functions
291 src_expr_LDADD
+= $(LIBGMP
)
292 src_factor_LDADD
+= $(LIBGMP
)
295 src_uptime_LDADD
+= $(GETLOADAVG_LIBS
)
297 # for various ACL functions
298 copy_ldadd
+= $(LIB_ACL
)
299 src_ls_LDADD
+= $(FILE_HAS_ACL_LIB
)
301 # for various xattr functions
302 copy_ldadd
+= $(LIB_XATTR
)
304 # for print_unicode_char
305 src_printf_LDADD
+= $(LIBICONV
)
307 # for libcrypto hash routines
308 src_md5sum_LDADD
+= $(LIB_CRYPTO
)
309 src_sort_LDADD
+= $(LIB_DL
) $(LIB_CRYPTO
)
310 src_sha1sum_LDADD
+= $(LIB_CRYPTO
)
311 src_sha224sum_LDADD
+= $(LIB_CRYPTO
)
312 src_sha256sum_LDADD
+= $(LIB_CRYPTO
)
313 src_sha384sum_LDADD
+= $(LIB_CRYPTO
)
314 src_sha512sum_LDADD
+= $(LIB_CRYPTO
)
315 src_cksum_LDADD
+= $(LIB_CRYPTO
)
318 src_pinky_LDADD
+= $(GETADDRINFO_LIB
)
319 src_who_LDADD
+= $(GETADDRINFO_LIB
)
321 # for gethostname, uname
322 src_hostname_LDADD
+= $(GETHOSTNAME_LIB
)
323 src_uname_LDADD
+= $(GETHOSTNAME_LIB
)
326 src_pinky_LDADD
+= $(READUTMP_LIB
)
327 src_uptime_LDADD
+= $(READUTMP_LIB
)
328 src_users_LDADD
+= $(READUTMP_LIB
)
329 src_who_LDADD
+= $(READUTMP_LIB
)
332 src_kill_LDADD
+= $(LIBTHREAD
)
334 # for pthread-cond, pthread-mutex, pthread-thread
335 src_sort_LDADD
+= $(LIBPMULTITHREAD
)
337 # for pthread_sigmask
338 src_sort_LDADD
+= $(PTHREAD_SIGMASK_LIB
)
340 # Get the release year from lib/version-etc.c.
342 `sed -n '/.*COPYRIGHT_YEAR = \([0-9][0-9][0-9][0-9]\) };/s//\1/p' \
343 $(top_srcdir)/lib/version-etc.c`
355 # Use 'ginstall' in the definition of PROGRAMS and in dependencies to avoid
356 # confusion with the 'install' target. The install rule transforms 'ginstall'
357 # to install before applying any user-specified name transformations.
359 # Don't apply prefix transformations to libstdbuf shared lib
360 # as that's not generally needed, and we need to reference the
361 # name directly in LD_PRELOAD etc. In general it's surprising
362 # that $(transform) is applied to libexec at all given that is
363 # for internal package naming, not privy to $(transform).
365 transform
= s
/ginstall
/install/;/libstdbuf
/!$(program_transform_name
)
367 src_ginstall_SOURCES
= src
/install.c src
/prog-fprintf.c
$(copy_sources
) \
370 # This is for the '[' program. Automake transliterates '[' and '/' to '_'.
371 src___SOURCES
= src
/lbracket.c
373 nodist_src_coreutils_SOURCES
= src
/coreutils.h
374 src_coreutils_SOURCES
= src
/coreutils.c
376 src_cp_SOURCES
= src
/cp.c
$(copy_sources
) $(selinux_sources
)
377 src_date_SOURCES
= src
/date.c src
/show-date.c
378 src_dir_SOURCES
= src
/ls.c src
/ls-dir.c
379 src_du_SOURCES
= src
/du.c src
/show-date.c
380 src_env_SOURCES
= src
/env.c src
/operand2sig.c
381 src_vdir_SOURCES
= src
/ls.c src
/ls-vdir.c
382 src_id_SOURCES
= src
/id.c src
/group-list.c
383 src_groups_SOURCES
= src
/groups.c src
/group-list.c
384 src_ls_SOURCES
= src
/ls.c src
/ls-ls.c
385 src_ln_SOURCES
= src
/ln.c \
386 src
/force-link.c src
/force-link.h \
387 src
/relpath.c src
/relpath.h
388 src_chown_SOURCES
= src
/chown.c src
/chown-core.c src
/chown-chown.c
389 src_chgrp_SOURCES
= src
/chown.c src
/chown-core.c src
/chown-chgrp.c
390 src_kill_SOURCES
= src
/kill.c src
/operand2sig.c
391 src_realpath_SOURCES
= src
/realpath.c src
/relpath.c src
/relpath.h
392 src_timeout_SOURCES
= src
/timeout.c src
/operand2sig.c
394 src_mv_SOURCES
= src
/mv.c src
/remove.c
$(copy_sources
) $(selinux_sources
)
395 src_rm_SOURCES
= src
/rm.c src
/remove.c
397 src_mkdir_SOURCES
= src
/mkdir.c src
/prog-fprintf.c
$(selinux_sources
)
398 src_rmdir_SOURCES
= src
/rmdir.c src
/prog-fprintf.c
400 src_mkfifo_SOURCES
= src
/mkfifo.c
$(selinux_sources
)
401 src_mknod_SOURCES
= src
/mknod.c
$(selinux_sources
)
403 src_df_SOURCES
= src
/df.c src
/find-mount-point.c
404 src_stat_SOURCES
= src
/stat.c src
/find-mount-point.c
406 src_uname_SOURCES
= src
/uname.c src
/uname-uname.c
407 src_arch_SOURCES
= src
/uname.c src
/uname-arch.c
409 src_cut_SOURCES
= src
/cut.c src
/set-fields.c
410 src_numfmt_SOURCES
= src
/numfmt.c src
/set-fields.c
412 src_split_SOURCES
= src
/split.c src
/temp-stream.c
413 src_tac_SOURCES
= src
/tac.c src
/temp-stream.c
415 src_tail_SOURCES
= src
/tail.c src
/iopoll.c
416 src_tee_SOURCES
= src
/tee.c src
/iopoll.c
418 src_sum_SOURCES
= src
/sum.c src
/sum.h src
/digest.c
419 src_sum_CPPFLAGS
= -DHASH_ALGO_SUM
=1 $(AM_CPPFLAGS
)
421 src_md5sum_SOURCES
= src
/digest.c
422 src_md5sum_CPPFLAGS
= -DHASH_ALGO_MD5
=1 $(AM_CPPFLAGS
)
423 src_sha1sum_SOURCES
= src
/digest.c
424 src_sha1sum_CPPFLAGS
= -DHASH_ALGO_SHA1
=1 $(AM_CPPFLAGS
)
425 src_sha224sum_SOURCES
= src
/digest.c
426 src_sha224sum_CPPFLAGS
= -DHASH_ALGO_SHA224
=1 $(AM_CPPFLAGS
)
427 src_sha256sum_SOURCES
= src
/digest.c
428 src_sha256sum_CPPFLAGS
= -DHASH_ALGO_SHA256
=1 $(AM_CPPFLAGS
)
429 src_sha384sum_SOURCES
= src
/digest.c
430 src_sha384sum_CPPFLAGS
= -DHASH_ALGO_SHA384
=1 $(AM_CPPFLAGS
)
431 src_sha512sum_SOURCES
= src
/digest.c
432 src_sha512sum_CPPFLAGS
= -DHASH_ALGO_SHA512
=1 $(AM_CPPFLAGS
)
433 src_b2sum_CPPFLAGS
= -DHASH_ALGO_BLAKE2
=1 -DHAVE_CONFIG_H
$(AM_CPPFLAGS
)
434 src_b2sum_SOURCES
= src
/digest.c \
435 src
/blake2
/blake2.h src
/blake2
/blake2-impl.h \
436 src
/blake2
/blake2b-ref.c \
437 src
/blake2
/b2sum.c src
/blake2
/b2sum.h
439 src_cksum_SOURCES
= $(src_b2sum_SOURCES
) src
/sum.c src
/sum.h \
440 src
/cksum.c src
/cksum.h src
/crctab.c
441 src_cksum_CPPFLAGS
= -DHASH_ALGO_CKSUM
=1 -DHAVE_CONFIG_H
$(AM_CPPFLAGS
)
444 noinst_LIBRARIES
+= src
/libcksum_avx512.a
445 src_libcksum_avx512_a_SOURCES
= src
/cksum_avx512.c src
/cksum.h
446 cksum_avx512_ldadd
= src
/libcksum_avx512.a
447 src_cksum_LDADD
+= $(cksum_avx512_ldadd
)
448 src_libcksum_avx512_a_CFLAGS
= -mavx512bw
-mavx512f
-mvpclmulqdq
$(AM_CFLAGS
)
451 noinst_LIBRARIES
+= src
/libcksum_avx2.a
452 src_libcksum_avx2_a_SOURCES
= src
/cksum_avx2.c src
/cksum.h
453 cksum_avx2_ldadd
= src
/libcksum_avx2.a
454 src_cksum_LDADD
+= $(cksum_avx2_ldadd
)
455 src_libcksum_avx2_a_CFLAGS
= -mpclmul
-mavx
-mavx2
-mvpclmulqdq
$(AM_CFLAGS
)
458 noinst_LIBRARIES
+= src
/libcksum_pclmul.a
459 src_libcksum_pclmul_a_SOURCES
= src
/cksum_pclmul.c src
/cksum.h
460 cksum_pclmul_ldadd
= src
/libcksum_pclmul.a
461 src_cksum_LDADD
+= $(cksum_pclmul_ldadd
)
462 src_libcksum_pclmul_a_CFLAGS
= -mavx
-mpclmul
$(AM_CFLAGS
)
465 noinst_LIBRARIES
+= src
/libcksum_vmull.a
466 src_libcksum_vmull_a_SOURCES
= src
/cksum_vmull.c src
/cksum.h
467 cksum_vmull_ldadd
= src
/libcksum_vmull.a
468 src_cksum_LDADD
+= $(cksum_vmull_ldadd
)
469 src_libcksum_vmull_a_CFLAGS
= -march
=armv8-a
+crypto
$(AM_CFLAGS
)
472 src_base64_SOURCES
= src
/basenc.c
473 src_base64_CPPFLAGS
= -DBASE_TYPE
=64 $(AM_CPPFLAGS
)
474 src_base32_SOURCES
= src
/basenc.c
475 src_base32_CPPFLAGS
= -DBASE_TYPE
=32 $(AM_CPPFLAGS
)
476 src_basenc_SOURCES
= src
/basenc.c
477 src_basenc_CPPFLAGS
= -DBASE_TYPE
=42 $(AM_CPPFLAGS
)
479 src_expand_SOURCES
= src
/expand.c src
/expand-common.c
480 src_unexpand_SOURCES
= src
/unexpand.c src
/expand-common.c
482 src_wc_SOURCES
= src
/wc.c
483 if USE_AVX2_WC_LINECOUNT
484 noinst_LIBRARIES
+= src
/libwc_avx2.a
485 src_libwc_avx2_a_SOURCES
= src
/wc_avx2.c
486 wc_avx2_ldadd
= src
/libwc_avx2.a
487 src_wc_LDADD
+= $(wc_avx2_ldadd
)
488 src_libwc_avx2_a_CFLAGS
= -mavx2
$(AM_CFLAGS
)
491 # Ensure we don't link against libcoreutils.a as that lib is
492 # not compiled with -fPIC which causes issues on 64 bit at least
493 src_libstdbuf_so_LDADD
= $(LIBINTL
)
495 # Note libstdbuf is only compiled if GCC is available
496 # (as per the check in configure.ac), so these flags should be available.
497 # libtool is probably required to relax this dependency.
498 src_libstdbuf_so_LDFLAGS
= -shared
499 src_libstdbuf_so_CFLAGS
= -fPIC
$(AM_CFLAGS
)
501 BUILT_SOURCES
+= src
/coreutils.h
503 # Single binary dependencies
504 src_coreutils_CFLAGS
= -DSINGLE_BINARY
$(AM_CFLAGS
)
505 #src_coreutils_LDFLAGS = $(AM_LDFLAGS)
506 src_coreutils_LDADD
= $(single_binary_deps
) $(LDADD
) $(single_binary_libs
)
507 EXTRA_src_coreutils_DEPENDENCIES
= $(single_binary_deps
)
509 include $(top_srcdir
)/src
/single-binary.mk
511 # Creates symlinks or shebangs to the installed programs when building
512 # coreutils single binary.
513 EXTRA_src_coreutils_DEPENDENCIES
+= src
/coreutils_
$(single_binary_install_type
)
516 CLEANFILES
+= src
/coreutils_symlinks
517 src
/coreutils_symlinks
: Makefile
519 $(AM_V_at
)${MKDIR_P} src
520 $(AM_V_at
)for i in x
$(single_binary_progs
); do \
521 test $$i = x
&& continue
; \
522 rm -f src
/$$i$(EXEEXT
) || exit
$$?
; \
523 $(LN_S
) -s coreutils
$(EXEEXT
) src
/$$i$(EXEEXT
) || exit
$$?
; \
526 CLEANFILES
+= src
/coreutils_shebangs
527 src
/coreutils_shebangs
: Makefile
529 $(AM_V_at
)${MKDIR_P} src
530 $(AM_V_at
)for i in x
$(single_binary_progs
); do \
531 test $$i = x
&& continue
; \
532 rm -f src
/$$i$(EXEEXT
) || exit
$$?
; \
533 printf
'#!%s --coreutils-prog-shebang=%s\n' \
534 $(abs_top_builddir
)/src
/coreutils
$(EXEEXT
) $$i \
535 >src
/$$i$(EXEEXT
) || exit
$$?
; \
536 chmod a
+x
,a-w src
/$$i$(EXEEXT
) || exit
$$?
; \
540 $(AM_V_at
)for i in x
$(single_binary_progs
); do \
541 test $$i = x
&& continue
; \
542 rm -f src
/$$i$(EXEEXT
) || exit
$$?
; \
546 BUILT_SOURCES
+= $(top_srcdir
)/src
/dircolors.h
547 $(top_srcdir
)/src
/dircolors.h
: src
/dcgen src
/dircolors.hin
548 $(AM_V_GEN
)rm -f
$@
$@
-t
549 $(AM_V_at
)${MKDIR_P} src
550 $(AM_V_at
)$(PERL
) -w
-- $(srcdir)/src
/dcgen \
551 $(srcdir)/src
/dircolors.hin
> $@
-t
552 $(AM_V_at
)chmod a-w
$@
-t
555 # This file is built by maintainers. It's architecture-independent,
556 # and it needs to be built on a widest-known-int architecture, so it's
557 # built only if absent. It is not cleaned because we don't want to
558 # insist that maintainers must build on hosts that support the widest
559 # known ints (currently 128-bit).
560 BUILT_SOURCES
+= $(top_srcdir
)/src
/primes.h
561 $(top_srcdir
)/src
/primes.h
:
562 $(AM_V_at
)${MKDIR_P} src
563 $(MAKE
) src
/make-prime-list
$(EXEEXT
)
564 $(AM_V_GEN
)rm -f
$@
$@
-t
565 $(AM_V_at
)src
/make-prime-list
$(EXEEXT
) 5000 > $@
-t
566 $(AM_V_at
)chmod a-w
$@
-t
569 # false exits nonzero even with --help or --version.
570 # test doesn't support --help or --version.
571 # Tell automake to exempt then from that installcheck test.
572 AM_INSTALLCHECK_STD_OPTIONS_EXEMPT
= src
/false src
/test
574 # Compare fs.h with the list of file system names/magic-numbers in the
575 # Linux statfs man page. This target prints any new name/number pairs.
576 # Also compare against /usr/include/linux/magic.h
577 .PHONY
: src
/fs-magic-compare
578 src
/fs-magic-compare
: src
/fs-magic src
/fs-kernel-magic src
/fs-def
579 @
join -v1
-t@ src
/fs-magic src
/fs-def
580 @
join -v1
-t@ src
/fs-kernel-magic src
/fs-def
582 CLEANFILES
+= src
/fs-def
584 @grep
'^# *define ' src
/fs.h |
$(ASSORT
) > $@
-t
&& mv
$@
-t
$@
586 # Massage bits of the statfs man page and definitions from
587 # /usr/include/linux/magic.h to be in a form consistent with what's in fs.h.
588 fs_normalize_perl_subst
= \
589 -e
's/MINIX_SUPER_MAGIC\b/MINIX/;' \
590 -e
's/MINIX_SUPER_MAGIC2\b/MINIX_30/;' \
591 -e
's/MINIX2_SUPER_MAGIC\b/MINIX_V2/;' \
592 -e
's/MINIX2_SUPER_MAGIC2\b/MINIX_V2_30/;' \
593 -e
's/MINIX3_SUPER_MAGIC\b/MINIX_V3/;' \
594 -e
's/CIFS_MAGIC_NUMBER/CIFS/;' \
595 -e
's/AFS_FS/KAFS/;' \
596 -e
's/(_SUPER)?_MAGIC//;' \
597 -e
's/\s+0x(\S+)/" 0x" . uc $$1/e;' \
598 -e
's/(\s+0x)(\X{2})\b/$${1}00$$2/;' \
599 -e
's/(\s+0x)(\X{3})\b/$${1}0$$2/;' \
600 -e
's/(\s+0x)(\X{6})\b/$${1}00$$2/;' \
601 -e
's/(\s+0x)(\X{7})\b/$${1}0$$2/;' \
603 -e
's/^\043define\s+//;' \
604 -e
's/^_(XIAFS)/$$1/;' \
605 -e
's/^USBDEVICE/USBDEVFS/;' \
606 -e
's/NTFS_SB/NTFS/;' \
607 -e
's/^/\043 define S_MAGIC_/;' \
608 -e
's,\s*/\* .*? \*/,,;'
610 CLEANFILES
+= src
/fs-magic
611 src
/fs-magic
: Makefile
612 @MANPAGER
= man statfs \
613 |perl
-ne
'/File system types:/.../Nobody kno/ and print' \
615 $(fs_normalize_perl_subst
) \
616 | grep
-Ev
'S_MAGIC_EXT[34]|STACK_END' \
620 DISTCLEANFILES
+= src
/fs-latest-magic.h
621 # This rule currently gets the latest header, but probably isn't general
622 # enough to enable by default.
623 # @kgit='https://git.kernel.org/cgit/linux/kernel/git'; \
624 # wget -q $$kgit/torvalds/linux.git/plain/include/uapi/linux/magic.h \
626 src
/fs-latest-magic.h
:
629 CLEANFILES
+= src
/fs-kernel-magic
630 src
/fs-kernel-magic
: Makefile src
/fs-latest-magic.h
631 @perl
-ne
'/^#define.*0x/ and print' \
632 /usr
/include/linux
/magic.h src
/fs-latest-magic.h \
634 $(fs_normalize_perl_subst
) \
635 | grep
-Ev
'S_MAGIC_EXT[34]|STACK_END' \
639 BUILT_SOURCES
+= $(top_srcdir
)/src
/fs-is-local.h
640 $(top_srcdir
)/src
/fs-is-local.h
: src
/stat.c src
/extract-magic
642 $(AM_V_at
)${MKDIR_P} src
643 $(AM_V_at
)$(PERL
) $(srcdir)/src
/extract-magic \
644 --local
$(srcdir)/src
/stat.c
> $@t
645 $(AM_V_at
)chmod a-w
$@t
648 BUILT_SOURCES
+= $(top_srcdir
)/src
/fs.h
649 $(top_srcdir
)/src
/fs.h
: src
/stat.c src
/extract-magic
651 $(AM_V_at
)${MKDIR_P} src
652 $(AM_V_at
)$(PERL
) $(srcdir)/src
/extract-magic \
653 $(srcdir)/src
/stat.c
> $@t
654 $(AM_V_at
)chmod a-w
$@t
657 BUILT_SOURCES
+= src
/version.c
658 src
/version.c
: Makefile
660 $(AM_V_at
)${MKDIR_P} src
661 $(AM_V_at
)printf
'#include <config.h>\n' > $@t
662 $(AM_V_at
)printf
'#include "version.h"\n' >> $@t
663 $(AM_V_at
)printf
'char const *Version = "$(PACKAGE_VERSION)";\n' >> $@t
664 $(AM_V_at
)chmod a-w
$@t
667 BUILT_SOURCES
+= src
/version.h
668 src
/version.h
: Makefile
670 $(AM_V_at
)${MKDIR_P} src
671 $(AM_V_at
)printf
'extern char const *Version;\n' > $@t
672 $(AM_V_at
)chmod a-w
$@t
675 # Generates a list of macro invocations like:
676 # SINGLE_BINARY_PROGRAM(program_name_str, main_name)
677 # once for each program list on $(single_binary_progs). Note that
678 # for [ the macro invocation is:
679 # SINGLE_BINARY_PROGRAM("[", _)
680 DISTCLEANFILES
+= src
/coreutils.h
681 src
/coreutils.h
: Makefile
683 $(AM_V_at
)${MKDIR_P} src
684 $(AM_V_at
)for prog in x
$(single_binary_progs
); do \
685 test $$prog = x
&& continue
; \
686 prog
=`basename $$prog`; \
687 main
=`echo $$prog | tr '[' '_'`; \
688 echo
"SINGLE_BINARY_PROGRAM(\"$$prog\", $$main)"; \
690 $(AM_V_at
)chmod a-w
$@t
693 DISTCLEANFILES
+= src
/version.c src
/version.h
694 MAINTAINERCLEANFILES
+= $(BUILT_SOURCES
)
703 # Ensure that the list of programs in README matches the list
704 # of programs we can build.
705 check-local
: check-README check-duplicate-no-install
708 $(AM_V_GEN
)rm -rf
$(pr
) $(pm
)
709 $(AM_V_at
)echo
$(all_programs
) \
711 | sed
-e
's,$(EXEEXT)$$,,' \
713 -e
's/^ginstall$$/install/' \
715 |
$(ASSORT
) -u
> $(pm
) && \
716 sed
-n
'/^The programs .* are:/,/^[a-zA-Z]/p' $(top_srcdir
)/README \
717 | sed
-n
'/^ */s///p' | tr
-s
' ' '\n' > $(pr
)
718 $(AM_V_at
)diff
$(pm
) $(pr
) && rm -rf
$(pr
) $(pm
)
720 # Ensure that a by-default-not-installed program (listed in
721 # $(no_install__progs) is not also listed as another $(EXTRA_PROGRAMS)
722 # entry, because if that were to happen, it *would* be installed
724 .PHONY
: check-duplicate-no-install
725 check-duplicate-no-install
:
726 $(AM_V_GEN
)test -z
"`echo '$(EXTRA_PROGRAMS)' | tr ' ' '\n' | uniq -d`"
728 # Use the just-built 'ginstall', when not cross-compiling.
730 cu_install_program
= @INSTALL@
732 cu_install_program
= src
/ginstall
734 INSTALL
= $(cu_install_program
) -c