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