from autoconf
[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   c-stack.c c-stack.h \
32   closeout.c closeout.h \
33   diacrit.c diacrit.h \
34   dirname.c dirname.h \
35   dirfd.h \
36   dup-safer.c \
37   exclude.c exclude.h \
38   exitfail.c exitfail.h \
39   filemode.c filemode.h \
40   file-type.c file-type.h \
41   fnmatch_.h \
42   fopen-safer.c \
43   fsusage.h \
44   full-write.c full-write.h \
45   getline.h \
46   getpagesize.h \
47   getstr.c getstr.h \
48   gettime.c \
49   gettext.h \
50   getugroups.c \
51   group-member.h \
52   hard-locale.c hard-locale.h \
53   human.c human.h \
54   idcache.c \
55   isdir.c \
56   lchown.h \
57   linebuffer.c linebuffer.h \
58   localcharset.c \
59   long-options.c long-options.h \
60   makepath.c makepath.h \
61   mbswidth.c mbswidth.h \
62   md5.c md5.h \
63   memcasecmp.c memcasecmp.h \
64   memcoll.c memcoll.h \
65   modechange.c modechange.h \
66   mountlist.h \
67   path-concat.c path-concat.h \
68   pathmax.h \
69   physmem.c physmem.h \
70   quote.c quote.h \
71   quotearg.c quotearg.h \
72   readtokens.c readtokens.h \
73   readutmp.h \
74   regex.h \
75   safe-read.c safe-read.h \
76   same.c same.h \
77   save-cwd.c save-cwd.h \
78   savedir.c savedir.h \
79   settime.c \
80   sha.c sha.h \
81   sig2str.h \
82   stdio-safer.h \
83   stripslash.c \
84   strverscmp.h \
85   timespec.h \
86   unicodeio.c unicodeio.h \
87   unistd-safer.h \
88   userspec.c \
89   version-etc.c version-etc.h \
90   xalloc.h \
91   xgetcwd.c \
92   xgethostname.c \
93   xmalloc.c \
94   xmemcoll.c xmemcoll.h \
95   xreadlink.c xreadlink.h \
96   xstrdup.c \
97   xstrtod.c xstrtod.h \
98   xstrtol.c xstrtol.h \
99   xstrtoul.c \
100   xstrtoimax.c \
101   xstrtoumax.c \
102   yesno.c
103
104 libfetish_a_LIBADD = @LIBOBJS@ @ALLOCA@
105 libfetish_a_DEPENDENCIES = $(libfetish_a_LIBADD)
106
107
108 BUILT_SOURCES = getdate.c lstat.c stat.c unlocked-io.h
109 MAINTAINERCLEANFILES = $(BUILT_SOURCES)
110 DISTCLEANFILES = lstat.c stat.c unlocked-io.h
111
112 EXTRA_DIST = xstat.in config.charset ref-add.sin ref-del.sin gen-uio \
113   fnmatch_loop.c
114
115 lstat.c: xstat.in
116         sed \
117           -e '/@IGNORE@/d' \
118           -e 's/@xstat@/lstat/g' \
119           -e '/_LSTAT_ONLY@/d' \
120           -e '/@BEGIN_STAT_ONLY@/,/@END_STAT_ONLY@/d' \
121           $(srcdir)/xstat.in > t-$@
122         mv t-$@ $@
123
124 stat.c: xstat.in
125         sed \
126           -e '/@IGNORE@/d' \
127           -e 's/@xstat@/stat/g' \
128           -e '/_STAT_ONLY@/d' \
129           -e '/@BEGIN_LSTAT_ONLY@/,/@END_LSTAT_ONLY@/d' \
130           $(srcdir)/xstat.in > t-$@
131         mv t-$@ $@
132
133 # The following is needed in order to install a simple file in $(libdir)
134 # which is shared with other installed packages. We use a list of referencing
135 # packages so that "make uninstall" will remove the file if and only if it
136 # is not used by another installed package.
137 # On systems with glibc-2.1 or newer, the file is redundant, therefore we
138 # avoid installing it.
139
140 all-local: charset.alias ref-add.sed ref-del.sed lstat.c stat.c unlocked-io.h
141
142 charset_alias = $(DESTDIR)$(libdir)/charset.alias
143 charset_tmp = $(DESTDIR)$(libdir)/charset.tmp
144 install-exec-local: all-local
145         $(mkinstalldirs) $(DESTDIR)$(libdir)
146         if test -f $(charset_alias); then \
147           sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \
148           $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
149           rm -f $(charset_tmp) ; \
150         else \
151           if test @GLIBC21@ = no; then \
152             sed -f ref-add.sed charset.alias > $(charset_tmp) ; \
153             $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
154             rm -f $(charset_tmp) ; \
155           fi ; \
156         fi
157
158 uninstall-local: all-local
159         if test -f $(charset_alias); then \
160           sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \
161           if grep '^# Packages using this file: $$' $(charset_tmp) \
162               > /dev/null; then \
163             rm -f $(charset_alias); \
164           else \
165             $(INSTALL_DATA) $(charset_tmp) $(charset_alias); \
166           fi; \
167           rm -f $(charset_tmp); \
168         fi
169
170 charset.alias: config.charset
171         $(SHELL) $(srcdir)/config.charset '@host@' > t-$@
172         mv t-$@ $@
173
174 SUFFIXES = .sed .sin
175 .sin.sed:
176         sed -e '/^#/d' -e 's/@''PACKAGE''@/@PACKAGE@/g' $< > t-$@
177         mv t-$@ $@
178
179 CLEANFILES = charset.alias ref-add.sed ref-del.sed
180
181 ###############################################
182
183 # FIXME: remove this dependency once automake handles it.
184 # As of cvs automake of about 2002-01-13,
185 # this dependency is necessary to avoid a build failure
186 # when running `make check' before running `make all'.
187 # Otherwise, unlocked-io.h is not built before it's needed.
188 getdate$U.o: unlocked-io.h
189
190 # FIXME: CAUTION this list is a duplicate of one in ../Makefile.cfg.
191 io_functions = \
192   clearerr feof ferror fflush fgets fputc fputs \
193   fread fwrite getc getchar putc putchar
194
195 unlocked-io.h: $(srcdir)/gen-uio Makefile.am
196         srcdir=$(srcdir) $(SHELL) $(srcdir)/gen-uio $(io_functions) > $@t
197         mv $@t $@