Imported Upstream version 1.3.14
[debian/gzip] / Makefile.am
1 # Make gzip (GNU zip).
2
3 # Copyright (C) 1999, 2001-2002, 2006-2007, 2009 Free Software Foundation, Inc.
4
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
9
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14
15 # You should have received a copy of the GNU General Public License along
16 # with this program; if not, write to the Free Software Foundation, Inc.,
17 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
19 SUBDIRS = lib doc
20 ACLOCAL_AMFLAGS = -I m4
21 AM_CPPFLAGS = -I$(top_srcdir)/lib
22
23 man_MANS = gunzip.1 gzexe.1 gzip.1 \
24   zcat.1 zcmp.1 zdiff.1 zforce.1 zgrep.1 zless.1 zmore.1 znew.1
25
26 EXTRA_DIST = $(ACINCLUDE_INPUTS) $(man_MANS) \
27   ChangeLog-2007 \
28   tests/hufts-segv.gz \
29   algorithm.doc amiga/match.a amiga/Makefile.gcc amiga/Makefile.sasc \
30   amiga/tailor.c amiga/utime.h atari/Makefile.st crypt.h \
31   gunzip.in gzexe.in gzip.doc gzip.h lzw.h msdos/match.asm msdos/tailor.c \
32   msdos/gzip.prj msdos/doturboc.bat msdos/Makefile.msc msdos/Makefile.bor \
33   msdos/Makefile.djg nt/Makefile.nt os2/gzip.def os2/Makefile.os2 \
34   os2/gzip16.def primos/include/errno.h primos/include/fcntl.h \
35   primos/include/stdlib.h primos/include/sysStat.h \
36   primos/include/sysTypes.h primos/build.cpl primos/readme \
37   primos/primos.c primos/ci.opts revision.h sample/makecrc.c \
38   sample/ztouch sample/add.c sample/sub.c sample/zread.c sample/zfile \
39   tailor.h vms/Makefile.mms vms/gzip.hlp vms/vms.c vms/Readme.vms \
40   vms/Makefile.vms vms/Makefile.gcc vms/makegzip.com zcat.in zcmp.in zdiff.in \
41   zegrep.in zfgrep.in zforce.in zgrep.in zless.in zmore.in znew.in \
42   tests/test-lib.sh
43
44 bin_PROGRAMS = gzip
45 bin_SCRIPTS = gunzip gzexe zcat zcmp zdiff \
46   zegrep zfgrep zforce zgrep zless zmore znew
47 gzip_SOURCES = \
48   bits.c crypt.c deflate.c gzip.c inflate.c lzw.c \
49   trees.c unlzh.c unlzw.c unpack.c unzip.c util.c zip.c
50 gzip_LDADD = lib/libgzip.a
51 gzip_LDADD += $(LIB_CLOCK_GETTIME)
52
53 gzip.doc: gzip.1
54         $(AM_V_GEN)groff -man -Tascii $(srcdir)/gzip.1 | col -b | uniq > $@-t \
55           && mv $@-t $@
56
57 gzip.doc.gz: gzip.doc $(bin_PROGRAMS)
58         $(AM_V_GEN)./gzip < $(srcdir)/gzip.doc >$@-t && mv $@-t $@
59
60 SUFFIXES = .in
61 .in:
62         $(AM_V_GEN)sed \
63                 -e 's|/bin/sh|$(SHELL)|g' \
64                 -e 's|[@]bindir@|'\''$(bindir)'\''|g' \
65                 -e 's|[@]VERSION@|$(VERSION)|g' \
66                 $(srcdir)/$@.in >$@-t \
67           && chmod a+x $@-t \
68           && mv $@-t $@
69
70 # Arrange so that .tarball-version appears only in the distribution
71 # tarball, and never in a checked-out repository.
72 dist-hook: gen-ChangeLog
73         $(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
74
75 gen_start_date = 2008-01-01
76 .PHONY: gen-ChangeLog
77 gen-ChangeLog:
78         $(AM_V_GEN)if test -d .git; then                                \
79           $(top_srcdir)/build-aux/gitlog-to-changelog                   \
80             --since=$(gen_start_date) > $(distdir)/cl-t;                \
81           rm -f $(distdir)/ChangeLog;                                   \
82           mv $(distdir)/cl-t $(distdir)/ChangeLog;                      \
83         fi
84
85 # A simple test, just of gzip -- more of a sanity check than anything else.
86 FILES_TO_CHECK = $(bin_SCRIPTS) \
87   $(top_srcdir)/ChangeLog $(top_srcdir)/configure $(top_srcdir)/gzip.c
88 check-local: $(FILES_TO_CHECK) $(bin_PROGRAMS) gzip.doc.gz
89         { test '$(srcdir)' != . || ./zdiff --__bindir . -c gzip.doc.gz; }
90         ./zdiff --__bindir . -c $(srcdir)/gzip.doc $(srcdir)/gzip.doc
91         ./zdiff --__bindir . $(srcdir)/gzip.doc gzip.doc.gz
92         ./zdiff --__bindir . -c - $(srcdir)/gzip.doc <gzip.doc.gz
93         ./zdiff --__bindir . -c gzip.doc.gz gzip.doc.gz
94         ./zgrep --__bindir . -iV >/dev/null
95         for file in $(FILES_TO_CHECK); do \
96           ./gzip -cv -- "$$file" | ./gzip -d | cmp - "$$file" || exit 1; \
97         done
98         ./gzip -dc $(srcdir)/tests/hufts-segv.gz > /dev/null 2>&1; \
99           test $$? = 1
100         k=in-$$$$; printf a | ./gzip > $$k && \
101           test "`cat $$k | ./gzip -dc $$k - $$k`" = aaa && rm $$k
102         @echo 'Test succeeded.'
103
104 TESTS =                                         \
105   tests/trailing-nul                            \
106   tests/zdiff                                   \
107   tests/zgrep-f
108
109 EXTRA_DIST += $(TESTS)
110
111 install-exec-hook: remove-installed-links
112 install-exec-hook remove-installed-links:
113         @for prog_ext in $(bin_PROGRAMS) $(bin_SCRIPTS); do \
114           prog=`echo "$$prog_ext"|sed 's/$(EXEEXT)$$//'`; \
115           case $$prog in \
116           gunzip) aliases='uncompress';; \
117           *) continue;; \
118           esac; \
119           transform='$(transform)'; \
120           test "X$$prog" = "X$$prog_ext" || \
121             transform="$$transform"';s/$$/$(EXEEXT)/'; \
122           destbindir=$(DESTDIR)$(bindir); \
123           source=`echo "$$prog"|sed "$$transform"`; \
124           for alias in $$aliases; do \
125             dest=`echo "$$alias"|sed "$$transform"`; \
126             (set -x; \
127              cd "$$destbindir" && \
128              rm -f "$$dest" && \
129              case $@ in \
130              install-exec-hook) \
131                ln "$$source" "$$dest" || $(LN_S) "$$source" "$$dest";; \
132              esac \
133             ) || exit; \
134           done; \
135         done
136
137 uninstall-local: remove-installed-links
138
139 MAINTAINERCLEANFILES = gzip.doc
140
141 MOSTLYCLEANFILES = _match.i match_.s _match.S gzip.doc.gz \
142   gunzip gzexe zcat zcmp zdiff zegrep zfgrep zforce zgrep zless zmore znew
143
144 # Note that the first lines are statements.  They ensure that environment
145 # variables that can perturb tests are unset or set to expected values.
146 # The rest are envvar settings that propagate build-related Makefile
147 # variables to test scripts.
148 TESTS_ENVIRONMENT =                             \
149   tmp__=$$TMPDIR; test -d "$$tmp__" || tmp__=.; \
150   TMPDIR=$$tmp__; export TMPDIR;                \
151   exec 9>&2;                                    \
152   shell_or_perl_() {                            \
153     if grep '^\#!/usr/bin/perl' "$$1" > /dev/null; then                 \
154       if $(PERL) -e 'use warnings' > /dev/null 2>&1; then               \
155         grep '^\#!/usr/bin/perl -T' "$$1" > /dev/null && T_=T || T_=;   \
156         $(PERL) -w$$T_ -I$(srcdir) -MCoreutils                          \
157               -M"CuTmpdir qw($$f)" -- "$$1";    \
158       else                                      \
159         echo 1>&2 "$$tst: configure did not find a usable version of Perl," \
160           "so skipping this test";              \
161         (exit 77);                              \
162       fi;                                       \
163     else                                        \
164       $(SHELL) "$$1";                           \
165     fi;                                         \
166   };                                            \
167   export                                        \
168   abs_top_builddir='$(abs_top_builddir)'        \
169   abs_top_srcdir='$(abs_top_srcdir)'            \
170   abs_srcdir='$(abs_srcdir)'                    \
171   srcdir='$(srcdir)'                            \
172   top_srcdir='$(top_srcdir)'                    \
173   CC='$(CC)'                                    \
174   MAKE=$(MAKE)                                  \
175   PACKAGE_BUGREPORT='$(PACKAGE_BUGREPORT)'      \
176   PACKAGE_VERSION=$(PACKAGE_VERSION)            \
177   PERL='$(PERL)'                                \
178   PREFERABLY_POSIX_SHELL='$(PREFERABLY_POSIX_SHELL)' \
179   REPLACE_GETCWD=$(REPLACE_GETCWD)              \
180   PATH='$(abs_top_builddir)$(PATH_SEPARATOR)'"$$PATH" \
181   ; shell_or_perl_
182
183 VERBOSE = yes