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