1 ## Process this file with automake to produce Makefile.in -*-Makefile-*-
3 EXTRA_PROGRAMS = chroot df hostid nice pinky stty su uname uptime users who
6 bin_SCRIPTS = groups @OPTIONAL_BIN_ZCRIPTS@
7 bin_PROGRAMS = chgrp chown chmod cp dd dircolors du \
8 ginstall link ln dir vdir ls mkdir \
9 mkfifo mknod mv readlink rm rmdir shred stat sync touch unlink \
10 cat cksum comm csplit cut expand fmt fold head join md5sum \
11 nl od paste pr ptx sha1sum sort split sum tac tail tr tsort unexpand uniq wc \
12 basename date dirname echo env expr factor false \
13 hostname id kill logname pathchk printenv printf pwd seq sleep tee \
14 test true tty whoami yes \
15 @OPTIONAL_BIN_PROGS@ @DF_PROG@
17 localedir = $(datadir)/locale
20 system.h sys2.h checksum.h copy.h cp-hash.h ls.h dircolors.h remove.h \
23 EXTRA_DIST = dcgen dircolors.hin tac-pipe.c \
24 groups.sh nohup.sh wheel-gen.pl
25 CLEANFILES = $(SCRIPTS) su
27 INCLUDES = -I.. -I$(srcdir) -I$(top_srcdir)/lib -I../lib
28 DEFS = -DLOCALEDIR=\"$(localedir)\" -DSHAREDIR=\"$(datadir)\" @DEFS@
30 # Sometimes, the expansion of @LIBINTL@ includes -lc which may
31 # include modules defining variables like `optind', so libfetish.a
32 # must precede @LIBINTL@ in order to ensure we use GNU getopt.
33 # But libfetish.a must also follow @LIBINTL@, since libintl uses
34 # replacement functions defined in libfetish.a.
35 LDADD = ../lib/libfetish.a @LIBINTL@ ../lib/libfetish.a
37 dir_LDADD = $(LDADD) @LIB_CLOCK_GETTIME@
38 ls_LDADD = $(LDADD) @LIB_CLOCK_GETTIME@
39 shred_LDADD = $(LDADD) @LIB_CLOCK_GETTIME@
40 vdir_LDADD = $(LDADD) @LIB_CLOCK_GETTIME@
42 ## If necessary, add -lm to resolve use of pow in lib/strtod.c.
43 sort_LDADD = $(LDADD) @POW_LIB@
46 date_LDADD = $(LDADD) @LIB_CLOCK_GETTIME@
49 factor_LDADD = $(LDADD) @SQRT_LIBM@
51 # If necessary, add -lm to resolve use of pow in lib/strtod.c.
52 # If necessary, add -liconv to resolve use of iconv in lib/unicodeio.c.
53 printf_LDADD = $(LDADD) @POW_LIB@ @LIBICONV@
55 # If necessary, add -lm to resolve use of floor, rint, modf.
56 seq_LDADD = $(LDADD) @SEQ_LIBM@
58 # If necessary, add -lm to resolve the `pow' reference in lib/strtod.c
59 # or for the fesetround reference in programs using nanosec.c.
61 $(LDADD) @FESETROUND_LIBM@ @POW_LIB@ @LIB_CLOCK_GETTIME@ @LIB_NANOSLEEP@
63 sleep_LDADD = $(nanosec_libs)
64 tail_LDADD = $(nanosec_libs)
66 uptime_LDADD = $(LDADD) @GETLOADAVG_LIBS@
68 su_LDADD = $(LDADD) @LIB_CRYPT@
70 $(PROGRAMS): ../lib/libfetish.a
79 -e 's!@''bindir''@!$(bindir)!' \
80 -e 's/@''GNU_PACKAGE''@/@GNU_PACKAGE@/' \
81 -e 's/@''PACKAGE_BUGREPORT''@/@PACKAGE_BUGREPORT@/' \
82 -e 's/@''VERSION''@/@VERSION@/' $< > $@-t
88 installed_su = $(DESTDIR)$(bindir)/`echo su|sed '$(transform)'`
90 setuid_root_mode = a=rx,u+s
94 echo " $(INSTALL_PROGRAM) $$p $(installed_su)"; \
95 $(INSTALL_PROGRAM) $$p $(installed_su); \
96 echo " chown root $(installed_su)"; \
97 chown root $(installed_su); \
98 echo " chmod $(setuid_root_mode) $(installed_su)"; \
99 chmod $(setuid_root_mode) $(installed_su)
104 install-exec-local: su
105 @TMPFILE=$(DESTDIR)$(bindir)/.su-$$$$; \
108 ## See if we can create a setuid root executable in $(bindir).
109 ## If not, then don't even try to install su.
110 can_create_suid_root_executable=no; \
111 chown root $$TMPFILE > /dev/null 2>&1 \
112 && chmod $(setuid_root_mode) $$TMPFILE > /dev/null 2>&1 \
113 && can_create_suid_root_executable=yes; \
115 if test $$can_create_suid_root_executable = yes; then \
118 echo "WARNING: insufficient access; not installing su"; \
119 echo "NOTE: to install su, run 'make install-root' as root"; \
123 # Remove su only if it's one we installed.
124 @if grep '@GNU_PACKAGE@' $(installed_su) > /dev/null 2>&1; then \
125 echo " rm -f $(installed_su)"; \
126 rm -f $(installed_su); \
129 # Use `ginstall' in the definition of PROGRAMS and in dependencies to avoid
130 # confusion with the `install' target. The install rule transforms `ginstall'
131 # to install before applying any user-specified name transformations.
133 transform = s/ginstall/install/; @program_transform_name@
134 ginstall_SOURCES = install.c copy.c cp-hash.c
136 cp_SOURCES = cp.c copy.c cp-hash.c
137 dir_SOURCES = ls.c ls-dir.c
138 vdir_SOURCES = ls.c ls-vdir.c
139 ls_SOURCES = ls.c ls-ls.c
140 chown_SOURCES = chown.c chown-core.c
141 chgrp_SOURCES = chgrp.c chown-core.c
143 mv_SOURCES = mv.c copy.c cp-hash.c remove.c
144 rm_SOURCES = rm.c remove.c
146 md5sum_SOURCES = md5sum.c md5.c
147 sha1sum_SOURCES = md5sum.c sha1sum.c
150 editpl = sed -e 's,@''PERL''@,$(PERL),g'
152 MAINTAINERCLEANFILES = dircolors.h \
155 dircolors.h: dcgen dircolors.hin
156 $(PERL) -w -- $(srcdir)/dcgen $(srcdir)/dircolors.hin > $@-t
161 wheel-size.h: Makefile.am
162 echo '#define WHEEL_SIZE $(wheel_size)' > $@-t
165 wheel.h: wheel-gen.pl Makefile.am
166 $(srcdir)/wheel-gen.pl $(wheel_size) \
170 BUILT_SOURCES = dircolors.h false.c wheel.h wheel-size.h
172 # false exits nonzero even with --help or --version.
173 # Tell automake to exempt it from that installcheck test.
174 AM_INSTALLCHECK_STD_OPTIONS_EXEMPT = false
180 -e s/success/failure/g \
181 -e 's/^ exit (EXIT_SUCCESS/ exit (EXIT_FAILURE/g' \
182 $(srcdir)/true.c > $@-t
194 # Ensure that the list of programs in README matches the list
195 # of programs we can build.
196 check: check-README check-misc
200 echo $(all_programs) \
201 | tr -s ' ' '\n' | sort -u > $(pm)
202 sed -n '/^The programs .* are:/,/^[a-zA-Z]/p' $(top_srcdir)/README \
203 | sed -n '/^ */s///p' | tr -s ' ' '\n' > $(pr)
204 diff $(pm) $(pr) && rm -rf $(pr) $(pm)
206 # Make sure we don't define any S_IS* macros in src/*.c files.
207 # Not a big deal, but they're already defined via system.h.
209 # Also make sure we don't use st_blocks. Use ST_NBLOCKS instead.
210 # This is a bit of a kludge, since it prevents use of the string
211 # even in comments, but for now it does the job with no false positives.
214 grep '^# *define *S_IS' $(SOURCES) && exit 1 || :
215 grep st_blocks $(SOURCES) && exit 1 || :
217 # Extract the list of authors from each file.
218 sed_filter = s/^ *//;s/N_ (//;s/^"//;s/")*$$//
219 # Sometimes the string is on the same line as the #define...
220 s1 = '/^\#define AUTHORS \([^\\]\)/{;s//\1/;$(sed_filter);p;q;}'
221 # Sometimes the string is on the backslash-continued line after the #define.
222 s2 = '/^\#define AUTHORS \\\\/{;n;$(sed_filter);p;q;}'
223 # FIXME: handle *.sh; and use $(all_programs), not $(SOURCES)
224 ../AUTHORS: $(SOURCES)
228 echo "Here are the names of the programs in this package,"; \
229 echo "each followed by the name(s) of its author(s)."; \
231 for i in $(SOURCES); do \
232 a=`sed -n $(s1) $$i`; \
234 || a=`sed -n $(s2) $$i`; \
235 if test "$$a"; then \
236 prog=`echo $$i|sed 's/\.c$$//'`; \
237 echo "$$prog: $$a"; \
239 done | sort -u ) > $@-t