tests: run most tests via tests/Makefile.am
[debian/gzip] / Makefile.am
1 # Make gzip (GNU zip).
2
3 # Copyright (C) 1999, 2001-2002, 2006-2007, 2009-2010 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
22 SUBDIRS = lib doc . tests
23 ACLOCAL_AMFLAGS = -I m4
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 man_MANS = gunzip.1 gzexe.1 gzip.1 \
31   zcat.1 zcmp.1 zdiff.1 zforce.1 zgrep.1 zless.1 zmore.1 znew.1
32
33 EXTRA_DIST = $(ACINCLUDE_INPUTS) $(man_MANS) \
34   ChangeLog-2007 \
35   dist-check.mk \
36   algorithm.doc amiga/match.a amiga/Makefile.gcc amiga/Makefile.sasc \
37   amiga/tailor.c amiga/utime.h atari/Makefile.st crypt.h \
38   gunzip.in gzexe.in gzip.doc gzip.h lzw.h msdos/match.asm msdos/tailor.c \
39   msdos/gzip.prj msdos/doturboc.bat msdos/Makefile.msc msdos/Makefile.bor \
40   msdos/Makefile.djg nt/Makefile.nt os2/gzip.def os2/Makefile.os2 \
41   os2/gzip16.def primos/include/errno.h primos/include/fcntl.h \
42   primos/include/stdlib.h primos/include/sysStat.h \
43   primos/include/sysTypes.h primos/build.cpl primos/readme \
44   primos/primos.c primos/ci.opts revision.h sample/makecrc.c \
45   sample/ztouch sample/add.c sample/sub.c sample/zread.c sample/zfile \
46   tailor.h vms/Makefile.mms vms/gzip.hlp vms/vms.c vms/Readme.vms \
47   vms/Makefile.vms vms/Makefile.gcc vms/makegzip.com zcat.in zcmp.in zdiff.in \
48   zegrep.in zfgrep.in zforce.in zgrep.in zless.in zmore.in znew.in
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 crypt.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 = lib/libgzip.a
57 gzip_LDADD += $(LIB_CLOCK_GETTIME)
58
59 gzip.doc: gzip.1
60         $(AM_V_GEN)groff -man -Tascii $(srcdir)/gzip.1 | col -b | uniq > $@-t \
61           && mv $@-t $@
62
63 gzip.doc.gz: gzip.doc $(bin_PROGRAMS)
64         $(AM_V_GEN)./gzip < $(srcdir)/gzip.doc >$@-t && mv $@-t $@
65
66 SUFFIXES = .in
67 .in:
68         $(AM_V_GEN)sed \
69                 -e 's|/bin/sh|$(SHELL)|g' \
70                 -e 's|[@]bindir@|'\''$(bindir)'\''|g' \
71                 -e 's|[@]VERSION@|$(VERSION)|g' \
72                 $(srcdir)/$@.in >$@-t \
73           && chmod a+x $@-t \
74           && mv $@-t $@
75
76 # Arrange so that .tarball-version appears only in the distribution
77 # tarball, and never in a checked-out repository.
78 dist-hook: gen-ChangeLog
79         $(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
80
81 gen_start_date = 2008-01-01
82 .PHONY: gen-ChangeLog
83 gen-ChangeLog:
84         $(AM_V_GEN)if test -d .git; then                                \
85           $(top_srcdir)/build-aux/gitlog-to-changelog                   \
86             --since=$(gen_start_date) > $(distdir)/cl-t;                \
87           rm -f $(distdir)/ChangeLog;                                   \
88           mv $(distdir)/cl-t $(distdir)/ChangeLog;                      \
89         fi
90
91 # A simple test, just of gzip -- more of a sanity check than anything else.
92 FILES_TO_CHECK = $(bin_SCRIPTS) \
93   $(top_srcdir)/ChangeLog $(top_srcdir)/configure $(top_srcdir)/gzip.c
94 check-local: $(FILES_TO_CHECK) $(bin_PROGRAMS) gzip.doc.gz
95         { test '$(srcdir)' != . || ./zdiff --__bindir . -c gzip.doc.gz; }
96         ./zdiff --__bindir . -c $(srcdir)/gzip.doc $(srcdir)/gzip.doc
97         ./zdiff --__bindir . $(srcdir)/gzip.doc gzip.doc.gz
98         ./zdiff --__bindir . -c - $(srcdir)/gzip.doc <gzip.doc.gz
99         ./zdiff --__bindir . -c gzip.doc.gz gzip.doc.gz
100         ./zgrep --__bindir . -iV >/dev/null
101         for file in $(FILES_TO_CHECK); do \
102           ./gzip -cv -- "$$file" | ./gzip -d | cmp - "$$file" || exit 1; \
103         done
104         @echo 'Test succeeded.'
105
106 install-exec-hook: remove-installed-links
107 install-exec-hook remove-installed-links:
108         @for prog_ext in $(bin_PROGRAMS) $(bin_SCRIPTS); do \
109           prog=`echo "$$prog_ext"|sed 's/$(EXEEXT)$$//'`; \
110           case $$prog in \
111           gunzip) aliases='uncompress';; \
112           *) continue;; \
113           esac; \
114           transform='$(transform)'; \
115           test "X$$prog" = "X$$prog_ext" || \
116             transform="$$transform"';s/$$/$(EXEEXT)/'; \
117           destbindir=$(DESTDIR)$(bindir); \
118           source=`echo "$$prog"|sed "$$transform"`; \
119           for alias in $$aliases; do \
120             dest=`echo "$$alias"|sed "$$transform"`; \
121             (set -x; \
122              cd "$$destbindir" && \
123              rm -f "$$dest" && \
124              case $@ in \
125              install-exec-hook) \
126                ln "$$source" "$$dest" || $(LN_S) "$$source" "$$dest";; \
127              esac \
128             ) || exit; \
129           done; \
130         done
131
132 uninstall-local: remove-installed-links
133
134 ALL_RECURSIVE_TARGETS += distcheck-hook
135 distcheck-hook:
136         $(MAKE) my-distcheck
137
138 MAINTAINERCLEANFILES = gzip.doc
139
140 MOSTLYCLEANFILES = _match.i match_.s _match.S gzip.doc.gz \
141   gunzip gzexe zcat zcmp zdiff zegrep zfgrep zforce zgrep zless zmore znew