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