(libfetish_a_SOURCES): Remove memcasecmp.c and memcasecmp.h.
[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   imaxtostr.c \
43   linebuffer.c linebuffer.h \
44   localcharset.c localcharset.h \
45   mbswidth.c mbswidth.h \
46   offtostr.c \
47   open-safer.c \
48   readtokens0.c readtokens0.h \
49   regex.h \
50   root-dev-ino.c root-dev-ino.h \
51   stat-macros.h \
52   stdio-safer.h \
53   stripslash.c \
54   time_r.c time_r.h \
55   umaxtostr.c \
56   unicodeio.c unicodeio.h \
57   unistd-safer.h \
58   version-etc.c version-etc.h version-etc-fsf.c \
59   xalloc-die.c \
60   xfts.c xfts.h \
61   xgetcwd.c xgetcwd.h \
62   xgethostname.c xgethostname.h \
63   xmemcoll.c xmemcoll.h \
64   xnanosleep.c xnanosleep.h \
65   xreadlink.c xreadlink.h \
66   xstrndup.c xstrndup.h \
67   xstrtod.c xstrtod.h \
68   xstrtoimax.c \
69   xstrtol.c xstrtol.h \
70   xstrtoul.c \
71   xstrtoumax.c
72
73 libfetish_a_SOURCES += \
74   printf-args.h \
75   printf-parse.h \
76   vasprintf.h \
77   vasnprintf.h
78
79 libfetish_a_LIBADD = $(LIBOBJS) $(ALLOCA)
80 libfetish_a_DEPENDENCIES = $(libfetish_a_LIBADD)
81
82 lib_OBJECTS = $(libfetish_a_OBJECTS)
83
84
85 BUILT_SOURCES = getdate.c
86 CLEANFILES =
87 MAINTAINERCLEANFILES = $(BUILT_SOURCES)
88 MOSTLYCLEANFILES =
89 SUFFIXES =
90
91 EXTRA_DIST = getdate.c config.charset ref-add.sin ref-del.sin \
92   getndelim2.c getndelim2.h \
93   inttostr.c inttostr.h
94
95 # We need the following in order to install a simple file in $(libdir)
96 # which is shared with other installed packages. We use a list of referencing
97 # packages so that "make uninstall" will remove the file if and only if it
98 # is not used by another installed package.
99 # On systems with glibc-2.1 or newer, the file is redundant, therefore we
100 # avoid installing it.
101
102 all-local: charset.alias ref-add.sed ref-del.sed
103
104 charset_alias = $(DESTDIR)$(libdir)/charset.alias
105 charset_tmp = $(DESTDIR)$(libdir)/charset.tmp
106 install-exec-local: all-local
107         test $(GLIBC21) != no || $(mkinstalldirs) $(DESTDIR)$(libdir)
108         if test -f $(charset_alias); then \
109           sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \
110           $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
111           rm -f $(charset_tmp) ; \
112         else \
113           if test $(GLIBC21) = no; then \
114             sed -f ref-add.sed charset.alias > $(charset_tmp) ; \
115             $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
116             rm -f $(charset_tmp) ; \
117           fi ; \
118         fi
119
120 uninstall-local: all-local
121         if test -f $(charset_alias); then \
122           sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \
123           if grep '^# Packages using this file: $$' $(charset_tmp) \
124               > /dev/null; then \
125             rm -f $(charset_alias); \
126           else \
127             $(INSTALL_DATA) $(charset_tmp) $(charset_alias); \
128           fi; \
129           rm -f $(charset_tmp); \
130         fi
131
132 charset.alias: config.charset
133         $(SHELL) $(srcdir)/config.charset '$(host)' > t-$@
134         mv t-$@ $@
135
136 SUFFIXES += .sed .sin
137 .sin.sed:
138         sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@
139         mv t-$@ $@
140
141 CLEANFILES += charset.alias ref-add.sed ref-del.sed
142
143 BUILT_SOURCES += $(STDBOOL_H)
144 EXTRA_DIST += stdbool_.h
145 MOSTLYCLEANFILES += stdbool.h stdbool.ht
146 # Create stdbool.h on systems that lack a working one.
147 stdbool.h: stdbool_.h
148         sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' $(srcdir)/stdbool_.h > $@t
149         mv $@t $@
150
151 BUILT_SOURCES += $(ALLOCA_H)
152 EXTRA_DIST += alloca_.h
153
154 # We need the following in order to create an <alloca.h> when the system
155 # doesn't have one that works with the given compiler.
156 all-local $(lib_OBJECTS): $(ALLOCA_H)
157 alloca.h: alloca_.h
158         cp $(srcdir)/alloca_.h $@-t
159         mv $@-t $@
160 MOSTLYCLEANFILES += alloca.h alloca.h-t
161
162 BUILT_SOURCES += $(FNMATCH_H)
163 EXTRA_DIST += fnmatch_.h fnmatch_loop.c
164
165 # We need the following in order to create an <fnmatch.h> when the system
166 # doesn't have one that supports the required API.
167 all-local $(lib_OBJECTS): $(FNMATCH_H)
168 fnmatch.h: fnmatch_.h
169         cp $(srcdir)/fnmatch_.h $@-t
170         mv $@-t $@
171 MOSTLYCLEANFILES += fnmatch.h fnmatch.h-t
172
173 BUILT_SOURCES += $(GETOPT_H)
174 EXTRA_DIST += getopt_.h getopt_int.h
175
176 check: unit-test
177
178 .PHONY: unit-test
179 unit-test: t-fpending
180         ./t-fpending > /dev/null
181
182 # We need the following in order to create an <getopt.h> when the system
183 # doesn't have one that works with the given compiler.
184 all-local $(lib_OBJECTS): $(GETOPT_H)
185 getopt.h: getopt_.h
186         cp $(srcdir)/getopt_.h $@-t
187         mv $@-t $@
188 MOSTLYCLEANFILES += getopt.h getopt.h-t