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