(libfetish_a_SOURCES): Remove linebuffer.[ch] and stripslash.c.
[platform/upstream/coreutils.git] / lib / Makefile.am
1 ## Makefile for gnulib/lib                              -*-Makefile-*-
2
3 # Copyright (C) 1995-2005 Free Software Foundation, Inc.
4
5 ## This program is free software; you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 2, or (at your option)
8 ## any later version.
9
10 ## This program is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 ## GNU General Public License for more details.
14
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program; if not, write to the Free Software
17 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18 ## 02111-1307, USA.
19
20 noinst_LIBRARIES = libfetish.a
21
22 noinst_PROGRAMS = t-fpending
23 LDADD = $(noinst_LIBRARIES)
24
25 AM_CPPFLAGS = -I.. -I$(srcdir)
26 DEFS += -DLIBDIR=\"$(libdir)\"
27
28 libfetish_a_SOURCES = \
29   allocsa.c allocsa.h \
30   argmatch.c argmatch.h \
31   cycle-check.c cycle-check.h \
32   dev-ino.h \
33   diacrit.c diacrit.h \
34   dup-safer.c \
35   euidaccess.h \
36   exit.h \
37   fcntl-safer.h \
38   fopen-safer.c \
39   full-read.c full-read.h \
40   full-write.c full-write.h \
41   gettext.h \
42   localcharset.c localcharset.h \
43   mbswidth.c mbswidth.h \
44   open-safer.c \
45   readtokens0.c readtokens0.h \
46   regex.h \
47   root-dev-ino.c root-dev-ino.h \
48   stat-macros.h \
49   stdio-safer.h \
50   time_r.c time_r.h \
51   unicodeio.c unicodeio.h \
52   unistd-safer.h \
53   version-etc.c version-etc.h version-etc-fsf.c \
54   xalloc-die.c \
55   xfts.c xfts.h \
56   xgetcwd.c xgetcwd.h \
57   xgethostname.c xgethostname.h \
58   xmemcoll.c xmemcoll.h \
59   xnanosleep.c xnanosleep.h \
60   xreadlink.c xreadlink.h \
61   xstrndup.c xstrndup.h \
62   xstrtod.c xstrtod.h \
63   xstrtoimax.c \
64   xstrtol.c xstrtol.h \
65   xstrtoul.c \
66   xstrtoumax.c
67
68 libfetish_a_SOURCES += \
69   printf-args.h \
70   printf-parse.h \
71   vasprintf.h \
72   vasnprintf.h
73
74 libfetish_a_LIBADD = $(LIBOBJS) $(ALLOCA)
75 libfetish_a_DEPENDENCIES = $(libfetish_a_LIBADD)
76
77 lib_OBJECTS = $(libfetish_a_OBJECTS)
78
79
80 BUILT_SOURCES = getdate.c
81 CLEANFILES =
82 MAINTAINERCLEANFILES = $(BUILT_SOURCES)
83 MOSTLYCLEANFILES =
84 SUFFIXES =
85
86 EXTRA_DIST = getdate.c config.charset ref-add.sin ref-del.sin \
87   getndelim2.c getndelim2.h
88
89 # We need the following in order to install a simple file in $(libdir)
90 # which is shared with other installed packages. We use a list of referencing
91 # packages so that "make uninstall" will remove the file if and only if it
92 # is not used by another installed package.
93 # On systems with glibc-2.1 or newer, the file is redundant, therefore we
94 # avoid installing it.
95
96 all-local: charset.alias ref-add.sed ref-del.sed
97
98 charset_alias = $(DESTDIR)$(libdir)/charset.alias
99 charset_tmp = $(DESTDIR)$(libdir)/charset.tmp
100 install-exec-local: all-local
101         test $(GLIBC21) != no || $(mkinstalldirs) $(DESTDIR)$(libdir)
102         if test -f $(charset_alias); then \
103           sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \
104           $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
105           rm -f $(charset_tmp) ; \
106         else \
107           if test $(GLIBC21) = no; then \
108             sed -f ref-add.sed charset.alias > $(charset_tmp) ; \
109             $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
110             rm -f $(charset_tmp) ; \
111           fi ; \
112         fi
113
114 uninstall-local: all-local
115         if test -f $(charset_alias); then \
116           sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \
117           if grep '^# Packages using this file: $$' $(charset_tmp) \
118               > /dev/null; then \
119             rm -f $(charset_alias); \
120           else \
121             $(INSTALL_DATA) $(charset_tmp) $(charset_alias); \
122           fi; \
123           rm -f $(charset_tmp); \
124         fi
125
126 charset.alias: config.charset
127         $(SHELL) $(srcdir)/config.charset '$(host)' > t-$@
128         mv t-$@ $@
129
130 SUFFIXES += .sed .sin
131 .sin.sed:
132         sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@
133         mv t-$@ $@
134
135 CLEANFILES += charset.alias ref-add.sed ref-del.sed
136
137 BUILT_SOURCES += $(STDBOOL_H)
138 EXTRA_DIST += stdbool_.h
139 MOSTLYCLEANFILES += stdbool.h stdbool.ht
140 # Create stdbool.h on systems that lack a working one.
141 stdbool.h: stdbool_.h
142         sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' $(srcdir)/stdbool_.h > $@t
143         mv $@t $@
144
145 BUILT_SOURCES += $(ALLOCA_H)
146 EXTRA_DIST += alloca_.h
147
148 # We need the following in order to create an <alloca.h> when the system
149 # doesn't have one that works with the given compiler.
150 all-local $(lib_OBJECTS): $(ALLOCA_H)
151 alloca.h: alloca_.h
152         cp $(srcdir)/alloca_.h $@-t
153         mv $@-t $@
154 MOSTLYCLEANFILES += alloca.h alloca.h-t
155
156 BUILT_SOURCES += $(FNMATCH_H)
157 EXTRA_DIST += fnmatch_.h fnmatch_loop.c
158
159 # We need the following in order to create an <fnmatch.h> when the system
160 # doesn't have one that supports the required API.
161 all-local $(lib_OBJECTS): $(FNMATCH_H)
162 fnmatch.h: fnmatch_.h
163         cp $(srcdir)/fnmatch_.h $@-t
164         mv $@-t $@
165 MOSTLYCLEANFILES += fnmatch.h fnmatch.h-t
166
167 BUILT_SOURCES += $(GETOPT_H)
168 EXTRA_DIST += getopt_.h getopt_int.h
169
170 check: unit-test
171
172 .PHONY: unit-test
173 unit-test: t-fpending
174         ./t-fpending > /dev/null
175
176 # We need the following in order to create an <getopt.h> when the system
177 # doesn't have one that works with the given compiler.
178 all-local $(lib_OBJECTS): $(GETOPT_H)
179 getopt.h: getopt_.h
180         cp $(srcdir)/getopt_.h $@-t
181         mv $@-t $@
182 MOSTLYCLEANFILES += getopt.h getopt.h-t