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