.
[gnulib.git] / lib / Makefile.am
1 ## Process this file with automake to produce Makefile.in -*-Makefile-*-
2
3 AUTOMAKE_OPTIONS = ../src/ansi2knr
4
5 noinst_LIBRARIES = libfetish.a
6
7 INCLUDES = -I.. -I$(srcdir) -I../intl
8 DEFS = -DLIBDIR=\"$(libdir)\" @DEFS@
9
10 libfetish_a_SOURCES = \
11   getdate.y posixtm.c addext.c argmatch.c backupfile.c basename.c \
12   canon-host.c closeout.c diacrit.c dirname.c exclude.c filemode.c \
13   full-write.c getopt.c getopt1.c getstr.c getugroups.c hard-locale.c hash.c \
14   human.c idcache.c isdir.c linebuffer.c localcharset.c long-options.c \
15   makepath.c mbswidth.c md5.c memcasecmp.c memcoll.c modechange.c \
16   path-concat.c physmem.c \
17   quote.c quotearg.c readtokens.c safe-read.c same.c save-cwd.c \
18   savedir.c sha.c stripslash.c unicodeio.c userspec.c version-etc.c xgetcwd.c \
19   xgethostname.c xmalloc.c xstrdup.c xstrtod.c xstrtol.c xstrtoul.c \
20   xstrtoumax.c yesno.c
21
22 libfetish_a_LIBADD = @LIBOBJS@ @ALLOCA@
23 libfetish_a_DEPENDENCIES = $(libfetish_a_LIBADD)
24
25 noinst_HEADERS = \
26   argmatch.h backupfile.h bumpalloc.h closeout.h diacrit.h dirname.h error.h \
27   exclude.h filemode.h fnmatch.h __fpending.h fsusage.h \
28   getdate.h getline.h getopt.h \
29   getstr.h getpagesize.h group-member.h hard-locale.h hash.h human.h lchown.h \
30   linebuffer.h long-options.h mbswidth.h md5.h memcasecmp.h memcoll.h \
31   makepath.h mbswidth.h modechange.h mountlist.h nanosleep.h obstack.h \
32   path-concat.h pathmax.h physmem.h posixtm.h \
33   quote.h quotearg.h readtokens.h \
34   readutmp.h regex.h safe-read.h same.h save-cwd.h savedir.h sha.h \
35   strverscmp.h unicodeio.h version-etc.h xalloc.h xstrtod.h xstrtol.h
36
37 BUILT_SOURCES = getdate.c lstat.c stat.c
38 MAINTAINERCLEANFILES = $(BUILT_SOURCES)
39 DISTCLEANFILES = lstat.c stat.c
40
41 EXTRA_DIST = xstat.in config.charset ref-add.sin ref-del.sin
42 lstat.c: xstat.in
43         sed \
44           -e '/@IGNORE@/d' \
45           -e 's/@xstat@/lstat/g' \
46           -e '/_LSTAT_ONLY@/d' \
47           -e '/@BEGIN_STAT_ONLY@/,/@END_STAT_ONLY@/d' \
48           $(srcdir)/xstat.in > $@-t
49         mv $@-t $@
50
51 stat.c: xstat.in
52         sed \
53           -e '/@IGNORE@/d' \
54           -e 's/@xstat@/stat/g' \
55           -e '/_STAT_ONLY@/d' \
56           -e '/@BEGIN_LSTAT_ONLY@/,/@END_LSTAT_ONLY@/d' \
57           $(srcdir)/xstat.in > $@-t
58         mv $@-t $@
59
60
61 # The following is needed in order to install a simple file in $(libdir)
62 # which is shared with other installed packages. We use a list of referencing
63 # packages so that "make uninstall" will remove the file if and only if it
64 # is not used by another installed package.
65 # On systems with glibc-2.1 or newer, the file is redundant, therefore we
66 # avoid installing it.
67
68 all-local: charset.alias ref-add.sed ref-del.sed lstat.c stat.c
69
70 charset_alias = $(DESTDIR)$(libdir)/charset.alias
71 charset_tmp = $(DESTDIR)$(libdir)/charset.tmp
72 install-exec-local: all-local
73         $(mkinstalldirs) $(DESTDIR)$(libdir)
74         if test -f $(charset_alias); then \
75           sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \
76           $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
77           rm -f $(charset_tmp) ; \
78         else \
79           if test @GLIBC21@ = no; then \
80             sed -f ref-add.sed charset.alias > $(charset_tmp) ; \
81             $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
82             rm -f $(charset_tmp) ; \
83           fi ; \
84         fi
85
86 uninstall-local: all-local
87         if test -f $(charset_alias); then \
88           sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \
89           if grep '^# Packages using this file: $$' $(charset_tmp) \
90               > /dev/null; then \
91             rm -f $(charset_alias); \
92           else \
93             $(INSTALL_DATA) $(charset_tmp) $(charset_alias); \
94           fi; \
95           rm -f $(charset_tmp); \
96         fi
97
98 charset.alias: config.charset
99         $(SHELL) $(srcdir)/config.charset '@host@' > t-$@
100         mv t-$@ $@
101
102 SUFFIXES = .sed .sin
103 .sin.sed:
104         sed -e '/^#/d' -e 's/@''PACKAGE''@/@PACKAGE@/g' $< > $@-t
105         mv $@-t $@
106
107 CLEANFILES = charset.alias ref-add.sed ref-del.sed