1
## Process this file with automake to produce Makefile.in -*-Makefile-*-
3
## Copyright (C) 1990-1991, 1993-2011 Free Software Foundation, Inc.
5
## This program is free software: you can redistribute it and/or modify
6
## it under the terms of the GNU General Public License as published by
7
## the Free Software Foundation, either version 3 of the License, or
8
## (at your option) any later version.
10
## This program is distributed in the hope that it will be useful,
11
## but WITHOUT ANY WARRANTY; without even the implied warranty of
12
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
## GNU General Public License for more details.
15
## You should have received a copy of the GNU General Public License
16
## along with this program. If not, see <http://www.gnu.org/licenses/>.
18
# These are the names of programs that are not installed by default.
19
# This list is *not* intended for programs like who, nice, chroot, etc.,
20
# that are built only when certain requisite system features are detected.
21
# Hence, if you want to install programs from this list anyway, say A and B,
22
# use --enable-install-program=A,B
26
build_if_possible__progs = \
40
AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
43
$(no_install__progs) \
44
$(build_if_possible__progs) \
137
bin_PROGRAMS = $(OPTIONAL_BIN_PROGS)
139
noinst_PROGRAMS = setuidgid getlimits
141
pkglibexec_PROGRAMS = $(OPTIONAL_PKGLIB_PROGS)
162
EXTRA_DIST = dcgen dircolors.hin tac-pipe.c \
163
wheel-gen.pl extract-magic c99-to-c89.diff
165
CLEANFILES = $(SCRIPTS) su
167
# Also remove these sometimes-built programs.
168
# For example, even when excluded, they're built via _sc_check-AUTHORS.
169
CLEANFILES += $(no_install__progs)
171
AM_CPPFLAGS = -I$(top_srcdir)/lib
173
noinst_LIBRARIES = libver.a
174
nodist_libver_a_SOURCES = version.c version.h
176
# Tell the linker to omit references to unused shared libraries.
177
AM_LDFLAGS = $(IGNORE_UNUSED_LIBRARIES_CFLAGS)
179
# Sometimes, the expansion of $(LIBINTL) includes -lc which may
180
# include modules defining variables like `optind', so libcoreutils.a
181
# must precede $(LIBINTL) in order to ensure we use GNU getopt.
182
# But libcoreutils.a must also follow $(LIBINTL), since libintl uses
183
# replacement functions defined in libcoreutils.a.
184
LDADD = libver.a ../lib/libcoreutils.a $(LIBINTL) ../lib/libcoreutils.a
186
# First, list all programs, to make listing per-program libraries easier.
188
arch_LDADD = $(LDADD)
189
base64_LDADD = $(LDADD)
190
basename_LDADD = $(LDADD)
192
chcon_LDADD = $(LDADD)
193
chgrp_LDADD = $(LDADD)
194
chmod_LDADD = $(LDADD)
195
chown_LDADD = $(LDADD)
196
chroot_LDADD = $(LDADD)
197
cksum_LDADD = $(LDADD)
198
comm_LDADD = $(LDADD)
199
nproc_LDADD = $(LDADD)
201
csplit_LDADD = $(LDADD)
203
date_LDADD = $(LDADD)
206
# See dir_LDADD below
207
dircolors_LDADD = $(LDADD)
208
dirname_LDADD = $(LDADD)
210
echo_LDADD = $(LDADD)
212
expand_LDADD = $(LDADD)
213
expr_LDADD = $(LDADD)
214
factor_LDADD = $(LDADD)
215
false_LDADD = $(LDADD)
217
fold_LDADD = $(LDADD)
218
getlimits_LDADD = $(LDADD)
219
ginstall_LDADD = $(LDADD)
220
groups_LDADD = $(LDADD)
221
head_LDADD = $(LDADD)
222
hostid_LDADD = $(LDADD)
223
hostname_LDADD = $(LDADD)
225
join_LDADD = $(LDADD)
226
kill_LDADD = $(LDADD)
227
link_LDADD = $(LDADD)
229
logname_LDADD = $(LDADD)
231
md5sum_LDADD = $(LDADD)
232
mkdir_LDADD = $(LDADD)
233
mkfifo_LDADD = $(LDADD)
234
mknod_LDADD = $(LDADD)
235
mktemp_LDADD = $(LDADD)
237
nice_LDADD = $(LDADD)
239
nohup_LDADD = $(LDADD)
241
paste_LDADD = $(LDADD)
242
pathchk_LDADD = $(LDADD)
243
pinky_LDADD = $(LDADD)
245
printenv_LDADD = $(LDADD)
246
printf_LDADD = $(LDADD)
249
readlink_LDADD = $(LDADD)
251
rmdir_LDADD = $(LDADD)
252
runcon_LDADD = $(LDADD)
254
setuidgid_LDADD = $(LDADD)
255
sha1sum_LDADD = $(LDADD)
256
sha224sum_LDADD = $(LDADD)
257
sha256sum_LDADD = $(LDADD)
258
sha384sum_LDADD = $(LDADD)
259
sha512sum_LDADD = $(LDADD)
260
shred_LDADD = $(LDADD)
261
shuf_LDADD = $(LDADD)
262
sleep_LDADD = $(LDADD)
263
sort_LDADD = $(LDADD)
264
split_LDADD = $(LDADD)
265
stat_LDADD = $(LDADD)
266
stdbuf_LDADD = $(LDADD)
267
stty_LDADD = $(LDADD)
270
sync_LDADD = $(LDADD)
272
tail_LDADD = $(LDADD)
274
test_LDADD = $(LDADD)
275
timeout_LDADD = $(LDADD)
276
touch_LDADD = $(LDADD)
278
true_LDADD = $(LDADD)
279
truncate_LDADD = $(LDADD)
280
tsort_LDADD = $(LDADD)
282
uname_LDADD = $(LDADD)
283
unexpand_LDADD = $(LDADD)
284
uniq_LDADD = $(LDADD)
285
unlink_LDADD = $(LDADD)
286
uptime_LDADD = $(LDADD)
287
users_LDADD = $(LDADD)
288
# See vdir_LDADD below
291
whoami_LDADD = $(LDADD)
294
# Synonyms. Recall that Automake transliterates '[' to '_'.
295
__LDADD = $(test_LDADD)
296
dir_LDADD = $(ls_LDADD)
297
vdir_LDADD = $(ls_LDADD)
301
cp_LDADD += $(copy_LDADD)
302
ginstall_LDADD += $(copy_LDADD)
303
mv_LDADD += $(copy_LDADD)
306
mv_LDADD += $(remove_LDADD)
307
rm_LDADD += $(remove_LDADD)
309
# for eaccess, euidaccess
310
copy_LDADD += $(LIB_EACCESS)
311
remove_LDADD += $(LIB_EACCESS)
312
test_LDADD += $(LIB_EACCESS)
315
chcon_LDADD += $(LIB_SELINUX)
316
copy_LDADD += $(LIB_SELINUX)
317
ginstall_LDADD += $(LIB_SELINUX)
318
id_LDADD += $(LIB_SELINUX)
319
ls_LDADD += $(LIB_SELINUX)
320
mkdir_LDADD += $(LIB_SELINUX)
321
mkfifo_LDADD += $(LIB_SELINUX)
322
mknod_LDADD += $(LIB_SELINUX)
323
runcon_LDADD += $(LIB_SELINUX)
324
stat_LDADD += $(LIB_SELINUX)
326
# for gettime, settime, utimecmp, utimens
327
copy_LDADD += $(LIB_CLOCK_GETTIME)
328
date_LDADD += $(LIB_CLOCK_GETTIME)
329
ginstall_LDADD += $(LIB_CLOCK_GETTIME)
330
ls_LDADD += $(LIB_CLOCK_GETTIME)
331
pr_LDADD += $(LIB_CLOCK_GETTIME)
332
timeout_LDADD += $(LIB_TIMER_TIME)
333
touch_LDADD += $(LIB_CLOCK_GETTIME)
336
dd_LDADD += $(LIB_GETHRXTIME)
339
ls_LDADD += $(LIB_CAP)
342
dd_LDADD += $(LIB_FDATASYNC)
343
shred_LDADD += $(LIB_FDATASYNC)
346
sleep_LDADD += $(LIB_NANOSLEEP)
347
sort_LDADD += $(LIB_NANOSLEEP)
348
tail_LDADD += $(LIB_NANOSLEEP)
350
# for various GMP functions
351
expr_LDADD += $(LIB_GMP)
352
factor_LDADD += $(LIB_GMP)
355
uptime_LDADD += $(GETLOADAVG_LIBS)
358
su_LDADD += $(LIB_CRYPT)
360
# for various ACL functions
361
copy_LDADD += $(LIB_ACL)
362
ls_LDADD += $(LIB_ACL)
364
# for various xattr functions
365
copy_LDADD += $(LIB_XATTR)
367
# for print_unicode_char, proper_name_utf8
368
cat_LDADD += $(LIBICONV)
369
cp_LDADD += $(LIBICONV)
370
df_LDADD += $(LIBICONV)
371
du_LDADD += $(LIBICONV)
372
getlimits_LDADD += $(LIBICONV)
373
printf_LDADD += $(LIBICONV)
374
ptx_LDADD += $(LIBICONV)
375
split_LDADD += $(LIBICONV)
376
stdbuf_LDADD += $(LIBICONV)
377
timeout_LDADD += $(LIBICONV)
378
truncate_LDADD += $(LIBICONV)
381
pinky_LDADD += $(GETADDRINFO_LIB)
382
who_LDADD += $(GETADDRINFO_LIB)
384
# for gethostname, uname
385
hostname_LDADD += $(GETHOSTNAME_LIB)
386
uname_LDADD += $(GETHOSTNAME_LIB)
389
kill_LDADD += $(LIBTHREAD)
392
sort_LDADD += $(LIB_PTHREAD)
394
$(PROGRAMS): ../lib/libcoreutils.a
396
# Get the release year from ../lib/version-etc.c.
398
`sed -n '/.*COPYRIGHT_YEAR = \([0-9][0-9][0-9][0-9]\) };/s//\1/p' \
399
$(top_srcdir)/lib/version-etc.c`
401
all-local: su$(EXEEXT)
403
installed_su = $(DESTDIR)$(bindir)/`echo su|sed '$(transform)'`
405
setuid_root_mode = a=rx,u+s
408
if test "$(INSTALL_SU)" = yes; then \
410
echo " $(INSTALL_PROGRAM) $$p $(installed_su)"; \
411
$(INSTALL_PROGRAM) $$p $(installed_su); \
412
echo " chown root $(installed_su)"; \
413
chown root $(installed_su); \
414
echo " chmod $(setuid_root_mode) $(installed_su)"; \
415
chmod $(setuid_root_mode) $(installed_su); \
420
install-root: su$(EXEEXT)
423
install-exec-hook: su$(EXEEXT)
424
@if test "$(INSTALL_SU)" = yes; then \
425
TMPFILE=$(DESTDIR)$(bindir)/.su-$$$$; \
428
## See if we can create a setuid root executable in $(bindir).
429
## If not, then don't even try to install su.
430
can_create_suid_root_executable=no; \
431
chown root $$TMPFILE > /dev/null 2>&1 \
432
&& chmod $(setuid_root_mode) $$TMPFILE > /dev/null 2>&1 \
433
&& can_create_suid_root_executable=yes; \
435
if test $$can_create_suid_root_executable = yes; then \
438
echo "WARNING: insufficient access; not installing su"; \
439
echo "NOTE: to install su, run 'make install-root' as root"; \
440
rm -f $(installed_su); \
446
# Remove su only if it's one we installed.
447
@if test "$(INSTALL_SU)" = yes; then \
448
if grep '$(PACKAGE_NAME)' $(installed_su) > /dev/null 2>&1; then \
449
echo " rm -f $(installed_su)"; \
450
rm -f $(installed_su); \
455
copy_sources = copy.c cp-hash.c extent-scan.c extent-scan.h
457
# Use `ginstall' in the definition of PROGRAMS and in dependencies to avoid
458
# confusion with the `install' target. The install rule transforms `ginstall'
459
# to install before applying any user-specified name transformations.
461
transform = s/ginstall/install/; $(program_transform_name)
462
ginstall_SOURCES = install.c prog-fprintf.c $(copy_sources)
464
# This is for the '[' program. Automake transliterates '[' to '_'.
465
__SOURCES = lbracket.c
467
cp_SOURCES = cp.c $(copy_sources)
468
dir_SOURCES = ls.c ls-dir.c
469
vdir_SOURCES = ls.c ls-vdir.c
470
id_SOURCES = id.c group-list.c
471
groups_SOURCES = groups.c group-list.c
473
ls_SOURCES = ls.c ls-ls.c
474
chown_SOURCES = chown.c chown-core.c
475
chgrp_SOURCES = chgrp.c chown-core.c
476
kill_SOURCES = kill.c operand2sig.c
477
timeout_SOURCES = timeout.c operand2sig.c
479
mv_SOURCES = mv.c remove.c $(copy_sources)
480
rm_SOURCES = rm.c remove.c
482
mkdir_SOURCES = mkdir.c prog-fprintf.c
483
rmdir_SOURCES = rmdir.c prog-fprintf.c
485
df_SOURCES = df.c find-mount-point.c
486
stat_SOURCES = stat.c find-mount-point.c
488
uname_SOURCES = uname.c uname-uname.c
489
arch_SOURCES = uname.c uname-arch.c
490
nproc_SOURCES = nproc.c
492
md5sum_SOURCES = md5sum.c
493
md5sum_CPPFLAGS = -DHASH_ALGO_MD5=1 $(AM_CPPFLAGS)
494
sha1sum_SOURCES = md5sum.c
495
sha1sum_CPPFLAGS = -DHASH_ALGO_SHA1=1 $(AM_CPPFLAGS)
496
sha224sum_SOURCES = md5sum.c
497
sha224sum_CPPFLAGS = -DHASH_ALGO_SHA224=1 $(AM_CPPFLAGS)
498
sha256sum_SOURCES = md5sum.c
499
sha256sum_CPPFLAGS = -DHASH_ALGO_SHA256=1 $(AM_CPPFLAGS)
500
sha384sum_SOURCES = md5sum.c
501
sha384sum_CPPFLAGS = -DHASH_ALGO_SHA384=1 $(AM_CPPFLAGS)
502
sha512sum_SOURCES = md5sum.c
503
sha512sum_CPPFLAGS = -DHASH_ALGO_SHA512=1 $(AM_CPPFLAGS)
505
ginstall_CPPFLAGS = -DENABLE_MATCHPATHCON=1 $(AM_CPPFLAGS)
507
# Ensure we don't link against libcoreutils.a as that lib is
508
# not compiled with -fPIC which causes issues on 64 bit at least
511
# Note libstdbuf is only compiled if GCC is available
512
# (as per the check in configure.ac), so these flags should be available.
513
# libtool is probably required to relax this dependency.
514
libstdbuf_so_LDFLAGS = -shared
515
libstdbuf_so_CFLAGS = -fPIC $(AM_CFLAGS)
517
editpl = sed -e 's,@''PERL''@,$(PERL),g'
519
BUILT_SOURCES += dircolors.h
520
dircolors.h: dcgen dircolors.hin
521
$(AM_V_GEN)rm -f $@ $@-t
522
$(AM_V_at)$(PERL) -w -- $(srcdir)/dcgen $(srcdir)/dircolors.hin > $@-t
523
$(AM_V_at)chmod a-w $@-t
528
BUILT_SOURCES += wheel-size.h
529
wheel-size.h: Makefile.am
530
$(AM_V_GEN)rm -f $@ $@-t
531
$(AM_V_at)echo '#define WHEEL_SIZE $(wheel_size)' > $@-t
532
$(AM_V_at)chmod a-w $@-t
535
BUILT_SOURCES += wheel.h
536
wheel.h: wheel-gen.pl Makefile.am
537
$(AM_V_GEN)rm -f $@ $@-t
538
$(AM_V_at)$(srcdir)/wheel-gen.pl $(wheel_size) > $@-t
539
$(AM_V_at)chmod a-w $@-t
542
# false exits nonzero even with --help or --version.
543
# test doesn't support --help or --version.
544
# Tell automake to exempt then from that installcheck test.
545
AM_INSTALLCHECK_STD_OPTIONS_EXEMPT = false test
547
# Compare fs.h with the list of file system names/magic-numbers in the
548
# Linux statfs man page. This target prints any new name/number pairs.
549
# Also compare against /usr/include/linux/magic.h
550
.PHONY: fs-magic-compare
551
fs-magic-compare: fs-magic fs-kernel-magic fs-def
552
join -v1 -t@ fs-magic fs-def
553
join -v1 -t@ fs-kernel-magic fs-def
557
grep '^# *define ' $< | $(ASSORT) > $@-t && mv $@-t $@
559
# Massage bits of the statfs man page and definitions from
560
# /usr/include/linux/magic.h to be in a form consistent with what's in fs.h.
561
fs_normalize_perl_subst = \
562
-e 's/MINIX_SUPER_MAGIC\b/MINIX/;' \
563
-e 's/MINIX_SUPER_MAGIC2\b/MINIX_30/;' \
564
-e 's/MINIX2_SUPER_MAGIC\b/MINIX_V2/;' \
565
-e 's/MINIX2_SUPER_MAGIC2\b/MINIX_V2_30/;' \
566
-e 's/MINIX3_SUPER_MAGIC\b/MINIX_V3/;' \
567
-e 's/CIFS_MAGIC_NUMBER/CIFS/;' \
568
-e 's/(_SUPER)?_MAGIC//;' \
569
-e 's/\s+0x(\S+)/" 0x" . uc $$1/e;' \
570
-e 's/(\s+0x)(\X{3})\b/$${1}0$$2/;' \
571
-e 's/(\s+0x)(\X{6})\b/$${1}00$$2/;' \
572
-e 's/(\s+0x)(\X{7})\b/$${1}0$$2/;' \
574
-e 's/^\#define\s+//;' \
575
-e 's/^_(XIAFS)/$$1/;' \
576
-e 's/^USBDEVICE/USBDEVFS/;' \
577
-e 's/NTFS_SB/NTFS/;' \
578
-e 's/^/\# define S_MAGIC_/;' \
579
-e 's,\s*/\* .*? \*/,,;'
581
CLEANFILES += fs-magic
584
|perl -ne '/File system types:/.../Nobody kno/ and print' \
586
$(fs_normalize_perl_subst) \
587
| grep -Ev 'S_MAGIC_EXT[34]|STACK_END' \
591
CLEANFILES += fs-kernel-magic
592
fs-kernel-magic: Makefile
593
perl -ne '/^#define.*0x/ and print' /usr/include/linux/magic.h \
595
$(fs_normalize_perl_subst) \
596
| grep -Ev 'S_MAGIC_EXT[34]|STACK_END' \
600
BUILT_SOURCES += fs.h
601
fs.h: stat.c extract-magic
603
$(AM_V_at)$(PERL) $(srcdir)/extract-magic $(srcdir)/stat.c > $@t
604
$(AM_V_at)chmod a-w $@t
607
BUILT_SOURCES += version.c
610
$(AM_V_at)printf '#include <config.h>\n' > $@t
611
$(AM_V_at)printf 'char const *Version = "$(PACKAGE_VERSION)";\n' >> $@t
612
$(AM_V_at)chmod a-w $@t
615
BUILT_SOURCES += version.h
618
$(AM_V_at)printf 'extern char const *Version;\n' > $@t
619
$(AM_V_at)chmod a-w $@t
622
DISTCLEANFILES = version.c version.h
623
MAINTAINERCLEANFILES = $(BUILT_SOURCES)
625
# Sort in traditional ASCII order, regardless of the current locale;
626
# otherwise we may get into trouble with distinct strings that the
627
# current locale considers to be equal.
628
ASSORT = LC_ALL=C sort
636
@echo $(bin_PROGRAMS) $(bin_SCRIPTS) | tr ' ' '\n' \
637
| sed -e 's,$(EXEEXT)$$,,' | $(ASSORT) -u | tr '\n' ' '
640
@echo $(all_programs) | tr ' ' '\n' | sed -e 's,$(EXEEXT)$$,,' \
644
# This is required because we have broken inter-directory dependencies:
645
# in order to generate all man pages, even those for which we don't
646
# install a binary, require that all programs be built at distribution time.
647
dist-hook: $(all_programs)
649
# Ensure that all programs are built so we can for example
650
# subsequently syntax check all man pages.
652
all_programs: $(all_programs)
656
# Ensure that the list of programs in README matches the list
657
# of programs we can build.
658
check: check-README check-duplicate-no-install
661
$(AM_V_GEN)rm -rf $(pr) $(pm)
662
$(AM_V_at)echo $(all_programs) \
663
| tr -s ' ' '\n' | sed -e 's,$(EXEEXT)$$,,;s/ginstall/install/' \
665
| $(ASSORT) -u > $(pm) && \
666
sed -n '/^The programs .* are:/,/^[a-zA-Z]/p' $(top_srcdir)/README \
667
| sed -n '/^ */s///p' | tr -s ' ' '\n' > $(pr)
668
$(AM_V_at)diff $(pm) $(pr) && rm -rf $(pr) $(pm)
670
# Ensure that a by-default-not-installed program (listed in
671
# $(no_install__progs) is not also listed in $(EXTRA_PROGRAMS), because
672
# if that were to happen, it *would* be installed by default.
673
.PHONY: check-duplicate-no-install
674
check-duplicate-no-install: tr
675
$(AM_V_GEN)test -z "`echo '$(EXTRA_PROGRAMS)'| ./tr ' ' '\n' | uniq -d`"
677
# Ensure that the list of programs and author names is accurate.
678
# We need a UTF8 locale. If a lack of locale support or a missing
679
# translation inhibits printing of UTF-8 names, just skip this test.
680
au_dotdot = authors-dotdot
681
au_actual = authors-actual
682
.PHONY: _sc_check-AUTHORS
683
_sc_check-AUTHORS: $(all_programs)
684
@locale=en_US.UTF-8; \
685
LC_ALL=$$locale ./cat --version \
686
| grep ' Torbjorn ' > /dev/null \
687
&& { echo "$@: skipping this check"; exit 0; }; \
688
rm -f $(au_actual) $(au_dotdot); \
689
for i in `ls $(all_programs) | sed -e 's,$(EXEEXT)$$,,' \
691
| $(ASSORT) -u`; do \
692
test "$$i" = '[' && continue; \
694
if test "$$i" = install; then \
696
elif test "$$i" = test; then \
699
LC_ALL=$$locale ./$$exe --version \
700
| perl -0 -pi -e 's/,\n/, /gm' \
701
| sed -n -e '/Written by /{ s//'"$$i"': /;' \
702
-e 's/,* and /, /; s/\.$$//; p; }'; \
703
done > $(au_actual) && \
704
sed -n '/^[^ ][^ ]*:/p' $(top_srcdir)/AUTHORS > $(au_dotdot) && \
705
diff $(au_actual) $(au_dotdot) && rm -f $(au_actual) $(au_dotdot)
707
# Use the just-built ./ginstall, when not cross-compiling.
709
cu_install_program = @INSTALL_PROGRAM@
711
cu_install_program = ./ginstall
713
INSTALL_PROGRAM = $(cu_install_program)