(libcoreutils_a_SOURCES): Remove diacrit.c and diacrit.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., 51 Franklin Street, Fifth Floor, Boston, MA
18 ## 02110-1301, USA.
19
20 noinst_LIBRARIES = libcoreutils.a
21
22 noinst_PROGRAMS = t-fpending
23 LDADD = $(noinst_LIBRARIES)
24
25 AM_CPPFLAGS = -I.. -I$(srcdir)
26 DEFS += -DLIBDIR=\"$(libdir)\"
27
28 libcoreutils_a_SOURCES = \
29   allocsa.c allocsa.h \
30   euidaccess.h \
31   exit.h \
32   full-read.c full-read.h \
33   full-write.c full-write.h \
34   gettext.h \
35   localcharset.c localcharset.h \
36   mbswidth.c mbswidth.h \
37   readtokens0.c readtokens0.h \
38   regex.h \
39   time_r.c time_r.h \
40   unicodeio.c unicodeio.h \
41   xalloc-die.c \
42   xgethostname.c xgethostname.h \
43   xmemcoll.c xmemcoll.h \
44   xstrndup.c xstrndup.h \
45   xstrtoimax.c \
46   xstrtoumax.c
47
48 libcoreutils_a_SOURCES += \
49   printf-args.h \
50   printf-parse.h \
51   vasprintf.h \
52   vasnprintf.h
53
54 libcoreutils_a_LIBADD = $(LIBOBJS) $(ALLOCA)
55 libcoreutils_a_DEPENDENCIES = $(libcoreutils_a_LIBADD)
56
57 lib_OBJECTS = $(libcoreutils_a_OBJECTS)
58
59
60 BUILT_SOURCES = getdate.c
61 CLEANFILES =
62 MAINTAINERCLEANFILES = $(BUILT_SOURCES)
63 MOSTLYCLEANFILES =
64 SUFFIXES =
65
66 EXTRA_DIST = getdate.c config.charset ref-add.sin ref-del.sin \
67   getndelim2.c getndelim2.h
68
69 # We need the following in order to install a simple file in $(libdir)
70 # which is shared with other installed packages. We use a list of referencing
71 # packages so that "make uninstall" will remove the file if and only if it
72 # is not used by another installed package.
73 # On systems with glibc-2.1 or newer, the file is redundant, therefore we
74 # avoid installing it.
75
76 all-local: charset.alias ref-add.sed ref-del.sed
77
78 charset_alias = $(DESTDIR)$(libdir)/charset.alias
79 charset_tmp = $(DESTDIR)$(libdir)/charset.tmp
80 install-exec-local: all-local
81         test $(GLIBC21) != no || $(mkinstalldirs) $(DESTDIR)$(libdir)
82         if test -f $(charset_alias); then \
83           sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \
84           $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
85           rm -f $(charset_tmp) ; \
86         else \
87           if test $(GLIBC21) = no; then \
88             sed -f ref-add.sed charset.alias > $(charset_tmp) ; \
89             $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
90             rm -f $(charset_tmp) ; \
91           fi ; \
92         fi
93
94 uninstall-local: all-local
95         if test -f $(charset_alias); then \
96           sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \
97           if grep '^# Packages using this file: $$' $(charset_tmp) \
98               > /dev/null; then \
99             rm -f $(charset_alias); \
100           else \
101             $(INSTALL_DATA) $(charset_tmp) $(charset_alias); \
102           fi; \
103           rm -f $(charset_tmp); \
104         fi
105
106 charset.alias: config.charset
107         $(SHELL) $(srcdir)/config.charset '$(host)' > t-$@
108         mv t-$@ $@
109
110 SUFFIXES += .sed .sin
111 .sin.sed:
112         sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@
113         mv t-$@ $@
114
115 CLEANFILES += charset.alias ref-add.sed ref-del.sed
116
117 BUILT_SOURCES += $(STDBOOL_H)
118 EXTRA_DIST += stdbool_.h
119 MOSTLYCLEANFILES += stdbool.h stdbool.ht
120 # Create stdbool.h on systems that lack a working one.
121 stdbool.h: stdbool_.h
122         sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' $(srcdir)/stdbool_.h > $@t
123         mv $@t $@
124
125 BUILT_SOURCES += $(ALLOCA_H)
126 EXTRA_DIST += alloca_.h
127
128 # We need the following in order to create an <alloca.h> when the system
129 # doesn't have one that works with the given compiler.
130 all-local $(lib_OBJECTS): $(ALLOCA_H)
131 alloca.h: alloca_.h
132         cp $(srcdir)/alloca_.h $@-t
133         mv $@-t $@
134 MOSTLYCLEANFILES += alloca.h alloca.h-t
135
136 BUILT_SOURCES += $(FNMATCH_H)
137 EXTRA_DIST += fnmatch_.h fnmatch_loop.c
138
139 # We need the following in order to create an <fnmatch.h> when the system
140 # doesn't have one that supports the required API.
141 all-local $(lib_OBJECTS): $(FNMATCH_H)
142 fnmatch.h: fnmatch_.h
143         cp $(srcdir)/fnmatch_.h $@-t
144         mv $@-t $@
145 MOSTLYCLEANFILES += fnmatch.h fnmatch.h-t
146
147 BUILT_SOURCES += $(GETOPT_H)
148 EXTRA_DIST += getopt_.h getopt_int.h
149
150 check: unit-test
151
152 .PHONY: unit-test
153 unit-test: t-fpending
154         ./t-fpending > /dev/null
155
156 # We need the following in order to create an <getopt.h> when the system
157 # doesn't have one that works with the given compiler.
158 all-local $(lib_OBJECTS): $(GETOPT_H)
159 getopt.h: getopt_.h
160         cp $(srcdir)/getopt_.h $@-t
161         mv $@-t $@
162 MOSTLYCLEANFILES += getopt.h getopt.h-t