Add jm_PREREQ_STRNLEN.
[gnulib.git] / lib / Makefile.am
1 ## Process this file with automake to produce Makefile.in -*-Makefile-*-
2
3 AUTOMAKE_OPTIONS = ../src/ansi2knr
4
5 noinst_LIBRARIES = libfetish.a
6
7 INCLUDES = -I.. -I$(srcdir)
8 DEFS = -DLIBDIR=\"$(libdir)\" @DEFS@
9
10 ## Put relatively complex files at the beginning of the list so
11 ## that parallel compiles finish a tiny bit sooner.  I don't see
12 ## a way to make regex.c appear earlier in the list, since it's
13 ## added by automake, but on systems with an up to date GNU libc,
14 ## regex.c isn't even compiled.
15 libfetish_a_SOURCES = \
16   acl.h acl.c \
17   getdate.h getdate.y \
18   posixtm.c posixtm.h \
19   posixver.c posixver.h \
20   strftime.c \
21   getopt.c getopt.h getopt1.c \
22   hash.c hash.h \
23   hash-pjw.c hash-pjw.h \
24   __fpending.h \
25   addext.c \
26   argmatch.c argmatch.h \
27   backupfile.c backupfile.h \
28   basename.c \
29   bumpalloc.h \
30   canon-host.c \
31   closeout.c closeout.h \
32   diacrit.c diacrit.h \
33   dirname.c dirname.h \
34   dirfd.h \
35   dup-safer.c \
36   exclude.c exclude.h \
37   filemode.c filemode.h \
38   fnmatch.h \
39   fopen-safer.c \
40   fsusage.h \
41   full-write.c full-write.h \
42   getline.h \
43   getpagesize.h \
44   getstr.c getstr.h \
45   gettime.c \
46   gettext.h \
47   getugroups.c \
48   group-member.h \
49   hard-locale.c hard-locale.h \
50   human.c human.h \
51   idcache.c \
52   isdir.c \
53   lchown.h \
54   linebuffer.c linebuffer.h \
55   localcharset.c \
56   long-options.c long-options.h \
57   makepath.c makepath.h \
58   mbswidth.c mbswidth.h \
59   md5.c md5.h \
60   memcasecmp.c memcasecmp.h \
61   memcoll.c memcoll.h \
62   modechange.c modechange.h \
63   mountlist.h \
64   path-concat.c path-concat.h \
65   pathmax.h \
66   physmem.c physmem.h \
67   quote.c quote.h \
68   quotearg.c quotearg.h \
69   readtokens.c readtokens.h \
70   readutmp.h \
71   regex.h \
72   safe-read.c safe-read.h \
73   same.c same.h \
74   save-cwd.c save-cwd.h \
75   savedir.c savedir.h \
76   settime.c \
77   sha.c sha.h \
78   sig2str.h \
79   stdio-safer.h \
80   stripslash.c \
81   strverscmp.h \
82   timespec.h \
83   unicodeio.c unicodeio.h \
84   unistd-safer.h \
85   userspec.c \
86   version-etc.c version-etc.h \
87   xalloc.h \
88   xgetcwd.c \
89   xgethostname.c \
90   xmalloc.c \
91   xmemcoll.c xmemcoll.h \
92   xreadlink.c xreadlink.h \
93   xstrdup.c \
94   xstrtod.c xstrtod.h \
95   xstrtol.c xstrtol.h \
96   xstrtoul.c \
97   xstrtoimax.c \
98   xstrtoumax.c \
99   yesno.c
100
101 libfetish_a_LIBADD = @LIBOBJS@ @ALLOCA@
102 libfetish_a_DEPENDENCIES = $(libfetish_a_LIBADD)
103
104
105 BUILT_SOURCES = getdate.c lstat.c stat.c unlocked-io.h
106 MAINTAINERCLEANFILES = $(BUILT_SOURCES)
107 DISTCLEANFILES = lstat.c stat.c unlocked-io.h
108
109 EXTRA_DIST = xstat.in config.charset ref-add.sin ref-del.sin gen-uio
110 lstat.c: xstat.in
111         sed \
112           -e '/@IGNORE@/d' \
113           -e 's/@xstat@/lstat/g' \
114           -e '/_LSTAT_ONLY@/d' \
115           -e '/@BEGIN_STAT_ONLY@/,/@END_STAT_ONLY@/d' \
116           $(srcdir)/xstat.in > $@-t
117         mv $@-t $@
118
119 stat.c: xstat.in
120         sed \
121           -e '/@IGNORE@/d' \
122           -e 's/@xstat@/stat/g' \
123           -e '/_STAT_ONLY@/d' \
124           -e '/@BEGIN_LSTAT_ONLY@/,/@END_LSTAT_ONLY@/d' \
125           $(srcdir)/xstat.in > $@-t
126         mv $@-t $@
127
128 # The following is needed in order to install a simple file in $(libdir)
129 # which is shared with other installed packages. We use a list of referencing
130 # packages so that "make uninstall" will remove the file if and only if it
131 # is not used by another installed package.
132 # On systems with glibc-2.1 or newer, the file is redundant, therefore we
133 # avoid installing it.
134
135 all-local: charset.alias ref-add.sed ref-del.sed lstat.c stat.c unlocked-io.h
136
137 charset_alias = $(DESTDIR)$(libdir)/charset.alias
138 charset_tmp = $(DESTDIR)$(libdir)/charset.tmp
139 install-exec-local: all-local
140         $(mkinstalldirs) $(DESTDIR)$(libdir)
141         if test -f $(charset_alias); then \
142           sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \
143           $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
144           rm -f $(charset_tmp) ; \
145         else \
146           if test @GLIBC21@ = no; then \
147             sed -f ref-add.sed charset.alias > $(charset_tmp) ; \
148             $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
149             rm -f $(charset_tmp) ; \
150           fi ; \
151         fi
152
153 uninstall-local: all-local
154         if test -f $(charset_alias); then \
155           sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \
156           if grep '^# Packages using this file: $$' $(charset_tmp) \
157               > /dev/null; then \
158             rm -f $(charset_alias); \
159           else \
160             $(INSTALL_DATA) $(charset_tmp) $(charset_alias); \
161           fi; \
162           rm -f $(charset_tmp); \
163         fi
164
165 charset.alias: config.charset
166         $(SHELL) $(srcdir)/config.charset '@host@' > t-$@
167         mv t-$@ $@
168
169 SUFFIXES = .sed .sin
170 .sin.sed:
171         sed -e '/^#/d' -e 's/@''PACKAGE''@/@PACKAGE@/g' $< > $@-t
172         mv $@-t $@
173
174 CLEANFILES = charset.alias ref-add.sed ref-del.sed
175
176 ###############################################
177
178 # FIXME: remove this dependency once automake handles it.
179 # As of cvs automake of about 2002-01-13,
180 # this dependency is necessary to avoid a build failure
181 # when running `make check' before running `make all'.
182 # Otherwise, unlocked-io.h is not built before it's needed.
183 getdate$U.o: unlocked-io.h
184
185 # FIXME: CAUTION this list is a duplicate of one in ../Makefile.cfg.
186 io_functions = \
187   clearerr feof ferror fflush fgets fputc fputs \
188   fread fwrite getc getchar putc putchar
189
190 unlocked-io.h: $(srcdir)/gen-uio Makefile.am
191         srcdir=$(srcdir) $(SHELL) $(srcdir)/gen-uio $(io_functions) > $@t
192         mv $@t $@