Imported Upstream version 1.6
[debian/gzip] / Makefile.am
1 # Make gzip (GNU zip).
2
3 # Copyright (C) 1999, 2001-2002, 2006-2007, 2009-2013 Free Software Foundation,
4 # Inc.
5
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
10
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15
16 # You should have received a copy of the GNU General Public License along
17 # with this program; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20 ALL_RECURSIVE_TARGETS =
21 BUILT_SOURCES =
22
23 SUBDIRS = lib doc . tests
24 AM_CPPFLAGS = -I$(top_srcdir)/lib
25 AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
26
27 # Tell the linker to omit references to unused shared libraries.
28 AM_LDFLAGS = $(IGNORE_UNUSED_LIBRARIES_CFLAGS)
29
30 noinst_LIBRARIES = libver.a
31 nodist_libver_a_SOURCES = version.c version.h
32 DISTCLEANFILES = version.c version.h
33
34 man_MANS = gunzip.1 gzexe.1 gzip.1 \
35   zcat.1 zcmp.1 zdiff.1 zforce.1 zgrep.1 zless.1 zmore.1 znew.1
36
37 EXTRA_DIST = $(ACINCLUDE_INPUTS) $(man_MANS) \
38   ChangeLog-2007 \
39   cfg.mk        \
40   dist-check.mk \
41   algorithm.doc \
42   gunzip.in gzexe.in gzip.doc \
43   revision.h sample/makecrc.c \
44   sample/ztouch sample/add.c sample/sub.c sample/zread.c sample/zfile \
45   tailor.h \
46   zcat.in zcmp.in zdiff.in \
47   zegrep.in zfgrep.in zforce.in zgrep.in zless.in zmore.in znew.in
48 noinst_HEADERS = gzip.h lzw.h
49
50 bin_PROGRAMS = gzip
51 bin_SCRIPTS = gunzip gzexe zcat zcmp zdiff \
52   zegrep zfgrep zforce zgrep zless zmore znew
53 gzip_SOURCES = \
54   bits.c deflate.c gzip.c inflate.c lzw.c \
55   trees.c unlzh.c unlzw.c unpack.c unzip.c util.c zip.c
56 gzip_LDADD = libver.a lib/libgzip.a
57 gzip_LDADD += $(LIB_CLOCK_GETTIME)
58
59 BUILT_SOURCES += version.c
60 version.c: Makefile
61         $(AM_V_GEN)rm -f $@
62         $(AM_V_at)printf '#include <config.h>\n' > $@t
63         $(AM_V_at)printf 'char const *Version = "$(PACKAGE_VERSION)";\n' >> $@t
64         $(AM_V_at)chmod a-w $@t
65         $(AM_V_at)mv $@t $@
66
67 BUILT_SOURCES += version.h
68 version.h: Makefile
69         $(AM_V_GEN)rm -f $@
70         $(AM_V_at)printf 'extern char const *Version;\n' > $@t
71         $(AM_V_at)chmod a-w $@t
72         $(AM_V_at)mv $@t $@
73
74 gzip.doc: gzip.1
75         $(AM_V_GEN)groff -man -Tascii $(srcdir)/gzip.1 | col -b | uniq > $@-t \
76           && mv $@-t $@
77
78 gzip.doc.gz: gzip.doc $(bin_PROGRAMS)
79         $(AM_V_GEN)./gzip < $(srcdir)/gzip.doc >$@-t && mv $@-t $@
80
81 SUFFIXES = .in
82 .in:
83         $(AM_V_GEN)sed \
84                 -e 's|/bin/sh|$(SHELL)|g' \
85                 -e 's|[@]bindir@|'\''$(bindir)'\''|g' \
86                 -e 's|[@]GREP@|$(GREP)|g' \
87                 -e 's|[@]VERSION@|$(VERSION)|g' \
88                 $(srcdir)/$@.in >$@-t \
89           && chmod a+x $@-t \
90           && mv $@-t $@
91
92 # Arrange so that .tarball-version appears only in the distribution
93 # tarball, and never in a checked-out repository.
94 dist-hook: gen-ChangeLog
95         $(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
96
97 gen_start_date = 2008-01-01
98 .PHONY: gen-ChangeLog
99 gen-ChangeLog:
100         $(AM_V_GEN)if test -d .git; then                                \
101           $(top_srcdir)/build-aux/gitlog-to-changelog                   \
102             --since=$(gen_start_date) > $(distdir)/cl-t;                \
103           rm -f $(distdir)/ChangeLog;                                   \
104           mv $(distdir)/cl-t $(distdir)/ChangeLog;                      \
105         fi
106
107 # A simple test, just of gzip -- more of a sanity check than anything else.
108 FILES_TO_CHECK = $(bin_SCRIPTS) \
109   $(top_srcdir)/ChangeLog $(top_srcdir)/configure $(top_srcdir)/gzip.c
110 check-local: $(FILES_TO_CHECK) $(bin_PROGRAMS) gzip.doc.gz
111         { test '$(srcdir)' != . || ./zdiff --__bindir . -c gzip.doc.gz; }
112         ./zdiff --__bindir . -c $(srcdir)/gzip.doc $(srcdir)/gzip.doc
113         ./zdiff --__bindir . $(srcdir)/gzip.doc gzip.doc.gz
114         ./zdiff --__bindir . -c - $(srcdir)/gzip.doc <gzip.doc.gz
115         ./zdiff --__bindir . -c gzip.doc.gz gzip.doc.gz
116         ./zgrep --__bindir . -iV >/dev/null
117         for file in $(FILES_TO_CHECK); do \
118           ./gzip -cv -- "$$file" | ./gzip -d | cmp - "$$file" || exit 1; \
119         done
120         @echo 'Test succeeded.'
121
122 install-exec-hook: remove-installed-links
123 install-exec-hook remove-installed-links:
124         @for prog_ext in $(bin_PROGRAMS) $(bin_SCRIPTS); do \
125           prog=`echo "$$prog_ext"|sed 's/$(EXEEXT)$$//'`; \
126           case $$prog in \
127           gunzip) aliases='uncompress';; \
128           *) continue;; \
129           esac; \
130           transform='$(transform)'; \
131           test "X$$prog" = "X$$prog_ext" || \
132             transform="$$transform"';s/$$/$(EXEEXT)/'; \
133           destbindir=$(DESTDIR)$(bindir); \
134           source=`echo "$$prog"|sed "$$transform"`; \
135           for alias in $$aliases; do \
136             dest=`echo "$$alias"|sed "$$transform"`; \
137             (set -x; \
138              cd "$$destbindir" && \
139              rm -f "$$dest" && \
140              case $@ in \
141              install-exec-hook) \
142                ln "$$source" "$$dest" || $(LN_S) "$$source" "$$dest";; \
143              esac \
144             ) || exit; \
145           done; \
146         done
147
148 uninstall-local: remove-installed-links
149
150 ALL_RECURSIVE_TARGETS += distcheck-hook
151 distcheck-hook:
152         $(MAKE) my-distcheck
153
154 MAINTAINERCLEANFILES = gzip.doc
155
156 MOSTLYCLEANFILES = _match.i match_.s _match.S gzip.doc.gz \
157   gunzip gzexe zcat zcmp zdiff zegrep zfgrep zforce zgrep zless zmore znew