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