1 ## Process this file with automake to produce Makefile.in -*-Makefile-*-
2 AUTOMAKE_OPTIONS = ansi2knr
4 EXTRA_PROGRAMS = chroot df hostid nice pinky stty su uname uptime users who
7 bin_SCRIPTS = groups @OPTIONAL_BIN_ZCRIPTS@
8 bin_PROGRAMS = chgrp chown chmod cp dd dircolors du \
9 ginstall link ln dir vdir ls mkdir \
10 mkfifo mknod mv rm rmdir shred stat sync touch unlink \
11 cat cksum comm csplit cut expand fmt fold head join md5sum \
12 nl od paste pr ptx sha1sum sort split sum tac tail tr tsort unexpand uniq wc \
13 basename date dirname echo env expr factor false \
14 hostname id kill logname pathchk printenv printf pwd seq sleep tee \
15 test true tty whoami yes \
16 @OPTIONAL_BIN_PROGS@ @DF_PROG@
18 localedir = $(datadir)/locale
21 system.h sys2.h checksum.h copy.h cp-hash.h ls.h dircolors.h remove.h \
24 EXTRA_DIST = dcgen dircolors.hin tac-pipe.c \
25 groups.sh nohup.sh wheel-gen.pl
26 CLEANFILES = $(SCRIPTS) su
28 INCLUDES = -I.. -I$(srcdir) -I$(top_srcdir)/lib -I../lib
29 DEFS = -DLOCALEDIR=\"$(localedir)\" -DSHAREDIR=\"$(datadir)\" @DEFS@
31 # Sometimes, the expansion of @LIBINTL@ includes -lc which may
32 # include modules defining variables like `optind', so libfetish.a
33 # must precede @LIBINTL@ in order to ensure we use GNU getopt.
34 # But libfetish.a must also follow @LIBINTL@, since libintl uses
35 # replacement functions defined in libfetish.a.
36 LDADD = ../lib/libfetish.a @LIBINTL@ ../lib/libfetish.a
38 dir_LDADD = $(LDADD) @LIB_CLOCK_GETTIME@
39 ls_LDADD = $(LDADD) @LIB_CLOCK_GETTIME@
40 shred_LDADD = $(LDADD) @LIB_CLOCK_GETTIME@
41 vdir_LDADD = $(LDADD) @LIB_CLOCK_GETTIME@
43 ## If necessary, add -lm to resolve use of pow in lib/strtod.c.
44 sort_LDADD = $(LDADD) @POW_LIB@
47 date_LDADD = $(LDADD) @LIB_CLOCK_GETTIME@
50 factor_LDADD = $(LDADD) @SQRT_LIBM@
52 # If necessary, add -lm to resolve use of pow in lib/strtod.c.
53 # If necessary, add -liconv to resolve use of iconv in lib/unicodeio.c.
54 printf_LDADD = $(LDADD) @POW_LIB@ @LIBICONV@
56 # If necessary, add -lm to resolve use of floor, rint, modf.
57 seq_LDADD = $(LDADD) @SEQ_LIBM@
59 # If necessary, add -lm to resolve the `pow' reference in lib/strtod.c
60 # or for the fesetround reference in sleep.c.
61 sleep_LDADD = $(LDADD) @FESETROUND_LIBM@ @POW_LIB@ \
62 @LIB_CLOCK_GETTIME@ @LIB_NANOSLEEP@
64 uptime_LDADD = $(LDADD) @GETLOADAVG_LIBS@
66 su_LDADD = $(LDADD) @LIB_CRYPT@
68 $(PROGRAMS): ../lib/libfetish.a
77 -e 's!@''bindir''@!$(bindir)!' \
78 -e 's/@''GNU_PACKAGE''@/@GNU_PACKAGE@/' \
79 -e 's/@''PACKAGE_BUGREPORT''@/@PACKAGE_BUGREPORT@/' \
80 -e 's/@''VERSION''@/@VERSION@/' $< > $@-t
86 installed_su = $(DESTDIR)$(bindir)/`echo su|sed '$(transform)'`
88 setuid_root_mode = a=rx,u+s
92 echo " $(INSTALL_PROGRAM) $$p $(installed_su)"; \
93 $(INSTALL_PROGRAM) $$p $(installed_su); \
94 echo " chown root $(installed_su)"; \
95 chown root $(installed_su); \
96 echo " chmod $(setuid_root_mode) $(installed_su)"; \
97 chmod $(setuid_root_mode) $(installed_su)
102 install-exec-local: su
103 @TMPFILE=$(DESTDIR)$(bindir)/.su-$$$$; \
106 ## See if we can create a setuid root executable in $(bindir).
107 ## If not, then don't even try to install su.
108 can_create_suid_root_executable=no; \
109 chown root $$TMPFILE > /dev/null 2>&1 \
110 && chmod $(setuid_root_mode) $$TMPFILE > /dev/null 2>&1 \
111 && can_create_suid_root_executable=yes; \
113 if test $$can_create_suid_root_executable = yes; then \
116 echo "WARNING: insufficient access; not installing su"; \
117 echo "NOTE: to install su, run 'make install-root' as root"; \
121 # Remove su only if it's one we installed.
122 @if grep '@GNU_PACKAGE@' $(installed_su) > /dev/null 2>&1; then \
123 echo " rm -f $(installed_su)"; \
124 rm -f $(installed_su); \
127 # Use `ginstall' in the definition of PROGRAMS and in dependencies to avoid
128 # confusion with the `install' target. The install rule transforms `ginstall'
129 # to install before applying any user-specified name transformations.
131 transform = s/ginstall/install/; @program_transform_name@
132 ginstall_SOURCES = install.c copy.c cp-hash.c
134 cp_SOURCES = cp.c copy.c cp-hash.c
135 dir_SOURCES = ls.c ls-dir.c
136 vdir_SOURCES = ls.c ls-vdir.c
137 ls_SOURCES = ls.c ls-ls.c
138 chown_SOURCES = chown.c chown-core.c
139 chgrp_SOURCES = chgrp.c chown-core.c
141 mv_SOURCES = mv.c copy.c cp-hash.c remove.c
142 rm_SOURCES = rm.c remove.c
144 md5sum_SOURCES = md5sum.c md5.c
145 sha1sum_SOURCES = md5sum.c sha1sum.c
148 editpl = sed -e 's,@''PERL''@,$(PERL),g'
150 MAINTAINERCLEANFILES = dircolors.h \
153 dircolors.h: dcgen dircolors.hin
154 $(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
179 -e s/success/failure/g \
180 -e 's/^ exit (EXIT_SUCCESS/ exit (EXIT_FAILURE/g' \
181 $(srcdir)/true.c > $@-t
186 # Ensure that the list of programs in README matches the list
187 # of programs we can build.
192 echo $(EXTRA_PROGRAMS) $(EXTRA_SCRIPTS) $(bin_SCRIPTS) $(bin_PROGRAMS) \
193 | tr -s ' ' '\n' | sort -u > $(pm)
194 sed -n '/^The programs .* are:/,/^[a-zA-Z]/p' $(top_srcdir)/README \
195 | sed -n '/^ */s///p' | tr -s ' ' '\n' > $(pr)
196 diff $(pm) $(pr) && rm -rf $(pr) $(pm)