1## Process this file with automake to produce Makefile.in -*-Makefile-*- 2 3## Copyright (C) 1990-1991, 1993-2010 Free Software Foundation, Inc. 4 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. 9## 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. 14## 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/>. 17 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 23no_install__progs = \ 24 arch hostname su 25 26build_if_possible__progs = \ 27 chroot \ 28 df \ 29 hostid \ 30 libstdbuf.so \ 31 nice \ 32 pinky \ 33 stdbuf \ 34 stty \ 35 su \ 36 uptime \ 37 users \ 38 who 39 40AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) 41 42EXTRA_PROGRAMS = \ 43 $(no_install__progs) \ 44 $(build_if_possible__progs) \ 45 [ \ 46 base64 \ 47 basename \ 48 cat \ 49 chcon \ 50 chgrp \ 51 chmod \ 52 chown \ 53 cksum \ 54 comm \ 55 cp \ 56 csplit \ 57 cut \ 58 date \ 59 dd \ 60 dir \ 61 dircolors \ 62 dirname \ 63 du \ 64 echo \ 65 env \ 66 expand \ 67 expr \ 68 factor \ 69 false \ 70 fmt \ 71 fold \ 72 ginstall \ 73 groups \ 74 head \ 75 id \ 76 join \ 77 kill \ 78 link \ 79 ln \ 80 logname \ 81 ls \ 82 md5sum \ 83 mkdir \ 84 mkfifo \ 85 mknod \ 86 mktemp \ 87 mv \ 88 nl \ 89 nproc \ 90 nohup \ 91 od \ 92 paste \ 93 pathchk \ 94 pr \ 95 printenv \ 96 printf \ 97 ptx \ 98 pwd \ 99 readlink \ 100 rm \ 101 rmdir \ 102 runcon \ 103 seq \ 104 sha1sum \ 105 sha224sum \ 106 sha256sum \ 107 sha384sum \ 108 sha512sum \ 109 shred \ 110 shuf \ 111 sleep \ 112 sort \ 113 split \ 114 stat \ 115 sum \ 116 sync \ 117 tac \ 118 tail \ 119 tee \ 120 test \ 121 timeout \ 122 touch \ 123 tr \ 124 true \ 125 truncate \ 126 tsort \ 127 tty \ 128 uname \ 129 unexpand \ 130 uniq \ 131 unlink \ 132 vdir \ 133 wc \ 134 whoami \ 135 yes 136 137bin_PROGRAMS = $(OPTIONAL_BIN_PROGS) 138 139noinst_PROGRAMS = setuidgid getlimits 140 141pkglib_PROGRAMS = $(OPTIONAL_PKGLIB_PROGS) 142 143noinst_HEADERS = \ 144 chown-core.h \ 145 copy.h \ 146 cp-hash.h \ 147 dircolors.h \ 148 fs.h \ 149 group-list.h \ 150 ls.h \ 151 operand2sig.h \ 152 prog-fprintf.h \ 153 remove.h \ 154 system.h \ 155 wheel-size.h \ 156 wheel.h \ 157 uname.h 158 159EXTRA_DIST = dcgen dircolors.hin tac-pipe.c \ 160 wheel-gen.pl extract-magic c99-to-c89.diff 161BUILT_SOURCES = 162CLEANFILES = $(SCRIPTS) su 163 164# Also remove these sometimes-built programs. 165# For example, even when excluded, they're built via sc_check-AUTHORS. 166CLEANFILES += $(no_install__progs) 167 168AM_CPPFLAGS = -I$(top_srcdir)/lib 169 170noinst_LIBRARIES = libver.a 171nodist_libver_a_SOURCES = version.c version.h 172 173# Sometimes, the expansion of $(LIBINTL) includes -lc which may 174# include modules defining variables like `optind', so libcoreutils.a 175# must precede $(LIBINTL) in order to ensure we use GNU getopt. 176# But libcoreutils.a must also follow $(LIBINTL), since libintl uses 177# replacement functions defined in libcoreutils.a. 178LDADD = libver.a ../lib/libcoreutils.a $(LIBINTL) ../lib/libcoreutils.a 179 180# First, list all programs, to make listing per-program libraries easier. 181# See [ below. 182arch_LDADD = $(LDADD) 183base64_LDADD = $(LDADD) 184basename_LDADD = $(LDADD) 185cat_LDADD = $(LDADD) 186chcon_LDADD = $(LDADD) 187chgrp_LDADD = $(LDADD) 188chmod_LDADD = $(LDADD) 189chown_LDADD = $(LDADD) 190chroot_LDADD = $(LDADD) 191cksum_LDADD = $(LDADD) 192comm_LDADD = $(LDADD) 193nproc_LDADD = $(LDADD) 194cp_LDADD = $(LDADD) 195csplit_LDADD = $(LDADD) 196cut_LDADD = $(LDADD) 197date_LDADD = $(LDADD) 198dd_LDADD = $(LDADD) 199df_LDADD = $(LDADD) 200# See dir_LDADD below 201dircolors_LDADD = $(LDADD) 202dirname_LDADD = $(LDADD) 203du_LDADD = $(LDADD) 204echo_LDADD = $(LDADD) 205env_LDADD = $(LDADD) 206expand_LDADD = $(LDADD) 207expr_LDADD = $(LDADD) 208factor_LDADD = $(LDADD) 209false_LDADD = $(LDADD) 210fmt_LDADD = $(LDADD) 211fold_LDADD = $(LDADD) 212getlimits_LDADD = $(LDADD) 213ginstall_LDADD = $(LDADD) 214groups_LDADD = $(LDADD) 215head_LDADD = $(LDADD) 216hostid_LDADD = $(LDADD) 217hostname_LDADD = $(LDADD) 218id_LDADD = $(LDADD) 219join_LDADD = $(LDADD) 220kill_LDADD = $(LDADD) 221link_LDADD = $(LDADD) 222ln_LDADD = $(LDADD) 223logname_LDADD = $(LDADD) 224ls_LDADD = $(LDADD) 225md5sum_LDADD = $(LDADD) 226mkdir_LDADD = $(LDADD) 227mkfifo_LDADD = $(LDADD) 228mknod_LDADD = $(LDADD) 229mktemp_LDADD = $(LDADD) 230mv_LDADD = $(LDADD) 231nice_LDADD = $(LDADD) 232nl_LDADD = $(LDADD) 233nohup_LDADD = $(LDADD) 234od_LDADD = $(LDADD) 235paste_LDADD = $(LDADD) 236pathchk_LDADD = $(LDADD) 237pinky_LDADD = $(LDADD) 238pr_LDADD = $(LDADD) 239printenv_LDADD = $(LDADD) 240printf_LDADD = $(LDADD) 241ptx_LDADD = $(LDADD) 242pwd_LDADD = $(LDADD) 243readlink_LDADD = $(LDADD) 244rm_LDADD = $(LDADD) 245rmdir_LDADD = $(LDADD) 246runcon_LDADD = $(LDADD) 247seq_LDADD = $(LDADD) 248setuidgid_LDADD = $(LDADD) 249sha1sum_LDADD = $(LDADD) 250sha224sum_LDADD = $(LDADD) 251sha256sum_LDADD = $(LDADD) 252sha384sum_LDADD = $(LDADD) 253sha512sum_LDADD = $(LDADD) 254shred_LDADD = $(LDADD) 255shuf_LDADD = $(LDADD) 256sleep_LDADD = $(LDADD) 257sort_LDADD = $(LDADD) 258split_LDADD = $(LDADD) 259stat_LDADD = $(LDADD) 260stdbuf_LDADD = $(LDADD) 261stty_LDADD = $(LDADD) 262su_LDADD = $(LDADD) 263sum_LDADD = $(LDADD) 264sync_LDADD = $(LDADD) 265tac_LDADD = $(LDADD) 266tail_LDADD = $(LDADD) 267tee_LDADD = $(LDADD) 268test_LDADD = $(LDADD) 269timeout_LDADD = $(LDADD) 270touch_LDADD = $(LDADD) 271tr_LDADD = $(LDADD) 272true_LDADD = $(LDADD) 273truncate_LDADD = $(LDADD) 274tsort_LDADD = $(LDADD) 275tty_LDADD = $(LDADD) 276uname_LDADD = $(LDADD) 277unexpand_LDADD = $(LDADD) 278uniq_LDADD = $(LDADD) 279unlink_LDADD = $(LDADD) 280uptime_LDADD = $(LDADD) 281users_LDADD = $(LDADD) 282# See vdir_LDADD below 283wc_LDADD = $(LDADD) 284who_LDADD = $(LDADD) 285whoami_LDADD = $(LDADD) 286yes_LDADD = $(LDADD) 287 288# Synonyms. Recall that Automake transliterates '[' to '_'. 289__LDADD = $(test_LDADD) 290dir_LDADD = $(ls_LDADD) 291vdir_LDADD = $(ls_LDADD) 292 293# Shared files 294copy_LDADD = 295cp_LDADD += $(copy_LDADD) 296ginstall_LDADD += $(copy_LDADD) 297mv_LDADD += $(copy_LDADD) 298 299remove_LDADD = 300mv_LDADD += $(remove_LDADD) 301rm_LDADD += $(remove_LDADD) 302 303# for eaccess, euidaccess 304copy_LDADD += $(LIB_EACCESS) 305remove_LDADD += $(LIB_EACCESS) 306test_LDADD += $(LIB_EACCESS) 307 308# for selinux use 309chcon_LDADD += $(LIB_SELINUX) 310copy_LDADD += $(LIB_SELINUX) 311ginstall_LDADD += $(LIB_SELINUX) 312id_LDADD += $(LIB_SELINUX) 313ls_LDADD += $(LIB_SELINUX) 314mkdir_LDADD += $(LIB_SELINUX) 315mkfifo_LDADD += $(LIB_SELINUX) 316mknod_LDADD += $(LIB_SELINUX) 317runcon_LDADD += $(LIB_SELINUX) 318stat_LDADD += $(LIB_SELINUX) 319 320# for gettime, settime, utimecmp, utimens 321copy_LDADD += $(LIB_CLOCK_GETTIME) 322date_LDADD += $(LIB_CLOCK_GETTIME) 323ginstall_LDADD += $(LIB_CLOCK_GETTIME) 324ls_LDADD += $(LIB_CLOCK_GETTIME) 325pr_LDADD += $(LIB_CLOCK_GETTIME) 326touch_LDADD += $(LIB_CLOCK_GETTIME) 327 328# for gethrxtime, randint, randread, gen_tempname, mkstemp 329dd_LDADD += $(LIB_GETHRXTIME) 330mktemp_LDADD += $(LIB_GETHRXTIME) 331shred_LDADD += $(LIB_GETHRXTIME) 332shuf_LDADD += $(LIB_GETHRXTIME) 333sort_LDADD += $(LIB_GETHRXTIME) 334tac_LDADD += $(LIB_GETHRXTIME) 335 336# for cap_get_file 337ls_LDADD += $(LIB_CAP) 338 339# for fdatasync 340dd_LDADD += $(LIB_FDATASYNC) 341shred_LDADD += $(LIB_FDATASYNC) 342 343# for strtod, strtold 344printf_LDADD += $(POW_LIB) 345seq_LDADD += $(POW_LIB) 346sleep_LDADD += $(POW_LIB) 347sort_LDADD += $(POW_LIB) 348tail_LDADD += $(POW_LIB) 349uptime_LDADD += $(POW_LIB) 350 351# for xnanosleep 352sleep_LDADD += $(LIB_NANOSLEEP) 353sort_LDADD += $(LIB_NANOSLEEP) 354tail_LDADD += $(LIB_NANOSLEEP) 355 356# for various GMP functions 357expr_LDADD += $(LIB_GMP) 358factor_LDADD += $(LIB_GMP) 359 360# for getloadavg 361uptime_LDADD += $(GETLOADAVG_LIBS) 362 363# for crypt 364su_LDADD += $(LIB_CRYPT) 365 366# for various ACL functions 367copy_LDADD += $(LIB_ACL) 368ls_LDADD += $(LIB_ACL) 369 370# for various xattr functions 371copy_LDADD += $(LIB_XATTR) 372 373# for print_unicode_char, proper_name_utf8 374cat_LDADD += $(LIBICONV) 375cp_LDADD += $(LIBICONV) 376df_LDADD += $(LIBICONV) 377du_LDADD += $(LIBICONV) 378getlimits_LDADD += $(LIBICONV) 379printf_LDADD += $(LIBICONV) 380ptx_LDADD += $(LIBICONV) 381split_LDADD += $(LIBICONV) 382stdbuf_LDADD += $(LIBICONV) 383timeout_LDADD += $(LIBICONV) 384truncate_LDADD += $(LIBICONV) 385 386# for canon_host 387pinky_LDADD += $(GETADDRINFO_LIB) 388who_LDADD += $(GETADDRINFO_LIB) 389 390# for gethostname, uname 391hostname_LDADD += $(GETHOSTNAME_LIB) 392uname_LDADD += $(GETHOSTNAME_LIB) 393 394$(PROGRAMS): ../lib/libcoreutils.a 395 396# Get the release year from ../lib/version-etc.c. 397RELEASE_YEAR = \ 398 `sed -n '/.*COPYRIGHT_YEAR = \([0-9][0-9][0-9][0-9]\) };/s//\1/p' \ 399 $(top_srcdir)/lib/version-etc.c` 400 401all-local: su$(EXEEXT) 402 403installed_su = $(DESTDIR)$(bindir)/`echo su|sed '$(transform)'` 404 405setuid_root_mode = a=rx,u+s 406 407install_su = \ 408 if test "$(INSTALL_SU)" = yes; then \ 409 p=su; \ 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); \ 416 else \ 417 :; \ 418 fi 419 420install-root: su$(EXEEXT) 421 @$(install_su) 422 423install-exec-hook: su$(EXEEXT) 424 @if test "$(INSTALL_SU)" = yes; then \ 425 TMPFILE=$(DESTDIR)$(bindir)/.su-$$$$; \ 426 rm -f $$TMPFILE; \ 427 echo > $$TMPFILE; \ 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; \ 434 rm -f $$TMPFILE; \ 435 if test $$can_create_suid_root_executable = yes; then \ 436 $(install_su); \ 437 else \ 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); \ 441 fi; \ 442 else :; \ 443 fi 444 445uninstall-local: 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); \ 451 else :; \ 452 fi; \ 453 fi 454 455copy_sources = copy.c cp-hash.c 456 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. 460 461transform = s/ginstall/install/; $(program_transform_name) 462ginstall_SOURCES = install.c prog-fprintf.c $(copy_sources) 463 464# This is for the '[' program. Automake transliterates '[' to '_'. 465__SOURCES = lbracket.c 466 467cp_SOURCES = cp.c $(copy_sources) 468dir_SOURCES = ls.c ls-dir.c 469vdir_SOURCES = ls.c ls-vdir.c 470id_SOURCES = id.c group-list.c 471groups_SOURCES = groups.c group-list.c 472ln_SOURCES = ln.c 473ls_SOURCES = ls.c ls-ls.c 474chown_SOURCES = chown.c chown-core.c 475chgrp_SOURCES = chgrp.c chown-core.c 476kill_SOURCES = kill.c operand2sig.c 477timeout_SOURCES = timeout.c operand2sig.c 478 479mv_SOURCES = mv.c remove.c $(copy_sources) 480rm_SOURCES = rm.c remove.c 481 482mkdir_SOURCES = mkdir.c prog-fprintf.c 483rmdir_SOURCES = rmdir.c prog-fprintf.c 484 485uname_SOURCES = uname.c uname-uname.c 486arch_SOURCES = uname.c uname-arch.c 487nproc_SOURCES = nproc.c 488 489md5sum_SOURCES = md5sum.c 490md5sum_CPPFLAGS = -DHASH_ALGO_MD5=1 $(AM_CPPFLAGS) 491sha1sum_SOURCES = md5sum.c 492sha1sum_CPPFLAGS = -DHASH_ALGO_SHA1=1 $(AM_CPPFLAGS) 493sha224sum_SOURCES = md5sum.c 494sha224sum_CPPFLAGS = -DHASH_ALGO_SHA224=1 $(AM_CPPFLAGS) 495sha256sum_SOURCES = md5sum.c 496sha256sum_CPPFLAGS = -DHASH_ALGO_SHA256=1 $(AM_CPPFLAGS) 497sha384sum_SOURCES = md5sum.c 498sha384sum_CPPFLAGS = -DHASH_ALGO_SHA384=1 $(AM_CPPFLAGS) 499sha512sum_SOURCES = md5sum.c 500sha512sum_CPPFLAGS = -DHASH_ALGO_SHA512=1 $(AM_CPPFLAGS) 501 502ginstall_CPPFLAGS = -DENABLE_MATCHPATHCON=1 $(AM_CPPFLAGS) 503 504# Ensure we don't link against libcoreutils.a as that lib is 505# not compiled with -fPIC which causes issues on 64 bit at least 506libstdbuf_so_LDADD = 507 508# Note libstdbuf is only compiled if GCC is available 509# (as per the check in configure.ac), so these flags should be available. 510# libtool is probably required to relax this dependency. 511libstdbuf_so_LDFLAGS = -shared 512libstdbuf_so_CFLAGS = -fPIC $(AM_CFLAGS) 513 514editpl = sed -e 's,@''PERL''@,$(PERL),g' 515 516BUILT_SOURCES += dircolors.h 517dircolors.h: dcgen dircolors.hin 518 $(AM_V_GEN)rm -f $@ $@-t 519 $(AM_V_at)$(PERL) -w -- $(srcdir)/dcgen $(srcdir)/dircolors.hin > $@-t 520 $(AM_V_at)chmod a-w $@-t 521 $(AM_V_at)mv $@-t $@ 522 523wheel_size = 5 524 525BUILT_SOURCES += wheel-size.h 526wheel-size.h: Makefile.am 527 $(AM_V_GEN)rm -f $@ $@-t 528 $(AM_V_at)echo '#define WHEEL_SIZE $(wheel_size)' > $@-t 529 $(AM_V_at)chmod a-w $@-t 530 $(AM_V_at)mv $@-t $@ 531 532BUILT_SOURCES += wheel.h 533wheel.h: wheel-gen.pl Makefile.am 534 $(AM_V_GEN)rm -f $@ $@-t 535 $(AM_V_at)$(srcdir)/wheel-gen.pl $(wheel_size) > $@-t 536 $(AM_V_at)chmod a-w $@-t 537 $(AM_V_at)mv $@-t $@ 538 539# false exits nonzero even with --help or --version. 540# test doesn't support --help or --version. 541# Tell automake to exempt then from that installcheck test. 542AM_INSTALLCHECK_STD_OPTIONS_EXEMPT = false test 543 544# Compare fs.h with the list of file system names/magic-numbers in the 545# Linux statfs man page. This target prints any new name/number pairs. 546# Also compare against /usr/include/linux/magic.h 547.PHONY: fs-magic-compare 548fs-magic-compare: fs-magic fs-kernel-magic fs-def 549 join -v1 -t@ fs-magic fs-def 550 join -v1 -t@ fs-kernel-magic fs-def 551 552CLEANFILES += fs-def 553fs-def: fs.h 554 grep '^# *define ' $< > $@-t && mv $@-t $@ 555 556# Massage bits of the statfs man page and definitions from 557# /usr/include/linux/magic.h to be in a form consistent with what's in fs.h. 558fs_normalize_perl_subst = \ 559 -e 's/MINIX_SUPER_MAGIC\b/MINIX/;' \ 560 -e 's/MINIX_SUPER_MAGIC2\b/MINIX_30/;' \ 561 -e 's/MINIX2_SUPER_MAGIC\b/MINIX_V2/;' \ 562 -e 's/MINIX2_SUPER_MAGIC2\b/MINIX_V2_30/;' \ 563 -e 's/MINIX3_SUPER_MAGIC\b/MINIX_V3/;' \ 564 -e 's/CIFS_MAGIC_NUMBER/CIFS/;' \ 565 -e 's/(_SUPER)?_MAGIC//;' \ 566 -e 's/\s+0x(\S+)/" 0x" . uc $$1/e;' \ 567 -e 's/(\s+0x)(\X{3})\b/$${1}0$$2/;' \ 568 -e 's/(\s+0x)(\X{6})\b/$${1}00$$2/;' \ 569 -e 's/(\s+0x)(\X{7})\b/$${1}0$$2/;' \ 570 -e 's/^\s+//;' \ 571 -e 's/^\#define\s+//;' \ 572 -e 's/^_(XIAFS)/$$1/;' \ 573 -e 's/^USBDEVICE/USBDEVFS/;' \ 574 -e 's/NTFS_SB/NTFS/;' \ 575 -e 's/^/\# define S_MAGIC_/;' \ 576 -e 's,\s*/\* .*? \*/,,;' 577 578CLEANFILES += fs-magic 579fs-magic: Makefile 580 man statfs \ 581 |perl -ne '/File system types:/.../Nobody kno/ and print' \ 582 |grep 0x | perl -p \ 583 $(fs_normalize_perl_subst) \ 584 | grep -Ev 'S_MAGIC_EXT[34]|STACK_END' \ 585 | LC_ALL=C sort \ 586 > $@-t && mv $@-t $@ 587 588CLEANFILES += fs-kernel-magic 589fs-kernel-magic: Makefile 590 perl -ne '/^#define.*0x/ and print' /usr/include/linux/magic.h \ 591 | perl -p \ 592 $(fs_normalize_perl_subst) \ 593 | grep -Ev 'S_MAGIC_EXT[34]|STACK_END' \ 594 | LC_ALL=C sort \ 595 > $@-t && mv $@-t $@ 596 597BUILT_SOURCES += fs.h 598fs.h: stat.c extract-magic 599 $(AM_V_GEN)rm -f $@ 600 $(AM_V_at)$(PERL) $(srcdir)/extract-magic $(srcdir)/stat.c > $@t 601 $(AM_V_at)chmod a-w $@t 602 $(AM_V_at)mv $@t $@ 603 604BUILT_SOURCES += version.c 605version.c: Makefile 606 $(AM_V_GEN)rm -f $@ 607 $(AM_V_at)printf '#include <config.h>\n' > $@t 608 $(AM_V_at)printf 'char const *Version = "$(PACKAGE_VERSION)";\n' >> $@t 609 $(AM_V_at)chmod a-w $@t 610 $(AM_V_at)mv $@t $@ 611 612BUILT_SOURCES += version.h 613version.h: Makefile 614 $(AM_V_GEN)rm -f $@ 615 $(AM_V_at)printf 'extern char const *Version;\n' > $@t 616 $(AM_V_at)chmod a-w $@t 617 $(AM_V_at)mv $@t $@ 618 619DISTCLEANFILES = version.c version.h 620MAINTAINERCLEANFILES = $(BUILT_SOURCES) 621 622# Sort in traditional ASCII order, regardless of the current locale; 623# otherwise we may get into trouble with distinct strings that the 624# current locale considers to be equal. 625ASSORT = LC_ALL=C sort 626 627all_programs = \ 628 $(bin_PROGRAMS) \ 629 $(bin_SCRIPTS) \ 630 $(EXTRA_PROGRAMS) 631 632built_programs.list: 633 @echo $(bin_PROGRAMS) $(bin_SCRIPTS) | tr ' ' '\n' \ 634 | sed -e 's,$(EXEEXT)$$,,' | $(ASSORT) -u | tr '\n' ' ' 635 636all_programs.list: 637 @echo $(all_programs) | tr ' ' '\n' | sed -e 's,$(EXEEXT)$$,,' \ 638 | $(ASSORT) -u 639 640# This is required because we have broken inter-directory dependencies: 641# in order to generate all man pages, even those for which we don't 642# install a binary, require that all programs be built at distribution time. 643dist-hook: $(all_programs) 644 645pm = progs-makefile 646pr = progs-readme 647# Ensure that the list of programs in README matches the list 648# of programs we can build. 649check: check-README check-duplicate-no-install 650.PHONY: check-README 651check-README: 652 $(AM_V_GEN)rm -rf $(pr) $(pm) 653 $(AM_V_at)echo $(all_programs) \ 654 | tr -s ' ' '\n' | sed -e 's,$(EXEEXT)$$,,;s/ginstall/install/' \ 655 | sed /libstdbuf/d \ 656 | $(ASSORT) -u > $(pm) && \ 657 sed -n '/^The programs .* are:/,/^[a-zA-Z]/p' $(top_srcdir)/README \ 658 | sed -n '/^ */s///p' | tr -s ' ' '\n' > $(pr) 659 $(AM_V_at)diff $(pm) $(pr) && rm -rf $(pr) $(pm) 660 661# Ensure that a by-default-not-installed program (listed in 662# $(no_install__progs) is not also listed in $(EXTRA_PROGRAMS), because 663# if that were to happen, it *would* be installed by default. 664.PHONY: check-duplicate-no-install 665check-duplicate-no-install: tr 666 $(AM_V_GEN)test -z "`echo '$(EXTRA_PROGRAMS)'| ./tr ' ' '\n' | uniq -d`" 667 668# Ensure that the list of programs and author names is accurate. 669# We need a UTF8 locale. If a lack of locale support or a missing 670# translation inhibits printing of UTF-8 names, just skip this test. 671au_dotdot = authors-dotdot 672au_actual = authors-actual 673.PHONY: sc_check-AUTHORS 674sc_check-AUTHORS: $(all_programs) 675 $(AM_V_GEN)locale=en_US.UTF-8; \ 676 LC_ALL="$$locale" ./cat --version \ 677 | grep ' Torbjorn ' > /dev/null \ 678 && { echo "$@: skipping this check"; exit 0; }; \ 679 rm -f $(au_actual) $(au_dotdot); \ 680 for i in `ls $(all_programs) | sed -e 's,$(EXEEXT)$$,,' \ 681 | sed /libstdbuf/d \ 682 | $(ASSORT) -u`; do \ 683 test "$$i" = '[' && continue; \ 684 exe=$$i; \ 685 if test "$$i" = install; then \ 686 exe=ginstall; \ 687 elif test "$$i" = test; then \ 688 exe='['; \ 689 fi; \ 690 LC_ALL="$$locale" ./$$exe --version \ 691 | perl -0 -pi -e 's/,\n/, /gm' \ 692 | sed -n -e '/Written by /{ s//'"$$i"': /;' \ 693 -e 's/,* and /, /; s/\.$$//; p; }'; \ 694 done > $(au_actual) && \ 695 sed -n '/^[^ ][^ ]*:/p' $(top_srcdir)/AUTHORS > $(au_dotdot) && \ 696 diff $(au_actual) $(au_dotdot) && rm -f $(au_actual) $(au_dotdot) 697 698# The following rule is not designed to be portable, 699# and relies on tools that not everyone has. 700 701# Most functions in src/*.c should have static scope. 702# Any that don't must be marked with `extern', but `main' 703# and `usage' are exceptions. They're always extern, but 704# don't need to be marked. Also functions starting with __ 705# are exempted due to possibly being added by the compiler 706# (when compiled as a shared library for example). 707# 708# The second nm|grep checks for file-scope variables with `extern' scope. 709.PHONY: sc_tight_scope 710sc_tight_scope: $(bin_PROGRAMS) 711 $(AM_V_GEN)t=exceptions-$$$$; \ 712 trap "s=$$?; rm -f $$t; exit $$s" 0 1 2 13 15; \ 713 src=`for f in $(SOURCES); do \ 714 test -f $$f && d= || d=$(srcdir)/; echo $$d$$f; done`; \ 715 hdr=`for f in $(noinst_HEADERS); do \ 716 test -f $$f && d= || d=$(srcdir)/; echo $$d$$f; done`; \ 717 ( printf 'main\nusage\n_.*\n'; \ 718 grep -h -A1 '^extern .*[^;]$$' $$src \ 719 | grep -vE '^(extern |--)' | sed 's/ .*//'; \ 720 perl -ne '/^extern (?:enum )?\S+ (\S*) \(/ and print "$$1\n"' $$hdr; \ 721 ) | $(ASSORT) -u | sed 's/^/^/;s/$$/$$/' > $$t; \ 722 nm -e *.$(OBJEXT) \ 723 | sed -n 's/.* T //p' \ 724 | sed 's/^_//' \ 725 | grep -Ev -f $$t && \ 726 { echo 'the above functions should have static scope' 1>&2; \ 727 exit 1; } || : ; \ 728 ( printf '^program_name$$\n'; \ 729 perl -ne '/^extern .*?\**(\w+);/ and print "^$$1\$$\n"' \ 730 $$hdr *.h ) | $(ASSORT) -u > $$t; \ 731 nm -e *.$(OBJEXT) \ 732 | sed -n 's/.* [BD] //p' \ 733 | sed 's/^_//' \ 734 | grep -Ev -f $$t && \ 735 { echo 'the above variables should have static scope' 1>&2; \ 736 exit 1; } || : 737 738# Use the just-built ./ginstall, when not cross-compiling. 739if CROSS_COMPILING 740cu_install_program = @INSTALL_PROGRAM@ 741else 742cu_install_program = ./ginstall 743endif 744INSTALL_PROGRAM = $(cu_install_program) 745