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