Fix version.sh compatiblity with Solaris
[xz/debian.git] / src / xzdec / Makefile.am
blob31a6508cc7c5c49b90d6d648887ff0179f693690
1 ## SPDX-License-Identifier: 0BSD
2 ## Author: Lasse Collin
4 # Windows resource compiler support. It's fine to use xz_CPPFLAGS
5 # also for lzmadec.
6 .rc.o:
7         $(RC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
8                 $(xzdec_CPPFLAGS) $(CPPFLAGS) $(RCFLAGS) -i $< -o $@
11 xzdec_SOURCES = \
12         xzdec.c \
13         ../common/tuklib_progname.c \
14         ../common/tuklib_exit.c
16 if COND_W32
17 xzdec_SOURCES += xzdec_w32res.rc
18 endif
20 xzdec_CPPFLAGS = \
21         -DTUKLIB_GETTEXT=0 \
22         -I$(top_srcdir)/src/common \
23         -I$(top_srcdir)/src/liblzma/api \
24         -I$(top_builddir)/lib
25 xzdec_LDADD = $(top_builddir)/src/liblzma/liblzma.la
27 if COND_GNULIB
28 xzdec_LDADD += $(top_builddir)/lib/libgnu.a
29 endif
31 xzdec_LDADD += $(LTLIBINTL)
34 lzmadec_SOURCES = \
35         xzdec.c \
36         ../common/tuklib_progname.c \
37         ../common/tuklib_exit.c
39 if COND_W32
40 lzmadec_SOURCES += lzmadec_w32res.rc
41 endif
43 lzmadec_CPPFLAGS = $(xzdec_CPPFLAGS) -DLZMADEC
44 lzmadec_LDFLAGS = $(xzdec_LDFLAGS)
45 lzmadec_LDADD = $(xzdec_LDADD)
48 bin_PROGRAMS =
49 lzmadecmanlink =
51 if COND_XZDEC
52 bin_PROGRAMS += xzdec
53 dist_man_MANS = xzdec.1
54 endif
56 if COND_LZMADEC
57 bin_PROGRAMS += lzmadec
59 # Create the symlink lzmadec.1->xzdec.1 only if xzdec.1 was installed.
60 # This is better than creating a dangling symlink. The correct solution
61 # would be to install xzdec.1 as lzmadec.1 but this code is already too
62 # complicated so I won't do it. Installing only lzmadec is a bit unusual
63 # situation anyway so it's not that important.
64 if COND_XZDEC
65 lzmadecmanlink += lzmadec
66 endif
67 endif
69 if COND_XZDEC
70 # The installation of translated man pages abuses Automake internals
71 # by calling "install-man" with redefined dist_man_MANS and man_MANS.
72 # If this breaks some day, don't blame Automake developers.
73 install-data-hook:
74         languages= ; \
75         if test "$(USE_NLS)" = yes && test -d "$(top_srcdir)/po4a/man"; then \
76                 languages=`ls "$(top_srcdir)/po4a/man"`; \
77         fi; \
78         target=`echo xzdec | sed '$(transform)'` && \
79         link=`echo lzmadec | sed '$(transform)'` && \
80         for lang in . $$languages; do \
81                 man="$(top_srcdir)/po4a/man/$$lang/xzdec.1" ; \
82                 if test -f "$$man"; then \
83                         $(MAKE) dist_man_MANS="$$man" man_MANS= \
84                                 mandir="$(mandir)/$$lang" install-man; \
85                 fi; \
86                 man1dir="$(DESTDIR)$(mandir)/$$lang/man1" && \
87                 if test -f "$$man1dir/$$target.1"; then \
88                         if test -n "$(lzmadecmanlink)"; then ( \
89                                 cd "$$man1dir" && \
90                                 rm -f "$$link.1" && \
91                                 $(LN_S) "$$target.1" "$$link.1" \
92                         ); fi; \
93                 fi; \
94         done
96 uninstall-hook:
97         languages= ; \
98         if test "$(USE_NLS)" = yes && test -d "$(top_srcdir)/po4a/man"; then \
99                 languages=`ls "$(top_srcdir)/po4a/man"`; \
100         fi; \
101         for lang in . $$languages; do \
102                 for name in xzdec $(lzmadecmanlink); do \
103                         name=`echo $$name | sed '$(transform)'` && \
104                         rm -f "$(DESTDIR)$(mandir)/$$lang/man1/$$name.1"; \
105                 done; \
106         done
107 endif