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