build: include cfg.mk in the distribution tarball
[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 BUILT_SOURCES =
22
23 SUBDIRS = lib doc . tests
24 ACLOCAL_AMFLAGS = -I m4
25 AM_CPPFLAGS = -I$(top_srcdir)/lib
26 AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
27
28 # Tell the linker to omit references to unused shared libraries.
29 AM_LDFLAGS = $(IGNORE_UNUSED_LIBRARIES_CFLAGS)
30
31 noinst_LIBRARIES = libver.a
32 nodist_libver_a_SOURCES = version.c version.h
33 DISTCLEANFILES = version.c version.h
34
35 man_MANS = gunzip.1 gzexe.1 gzip.1 \
36   zcat.1 zcmp.1 zdiff.1 zforce.1 zgrep.1 zless.1 zmore.1 znew.1
37
38 EXTRA_DIST = $(ACINCLUDE_INPUTS) $(man_MANS) \
39   ChangeLog-2007 \
40   cfg.mk        \
41   dist-check.mk \
42   algorithm.doc amiga/match.a amiga/Makefile.gcc amiga/Makefile.sasc \
43   amiga/tailor.c amiga/utime.h atari/Makefile.st crypt.h \
44   gunzip.in gzexe.in gzip.doc gzip.h lzw.h msdos/match.asm msdos/tailor.c \
45   msdos/gzip.prj msdos/doturboc.bat msdos/Makefile.msc msdos/Makefile.bor \
46   msdos/Makefile.djg nt/Makefile.nt os2/gzip.def os2/Makefile.os2 \
47   os2/gzip16.def primos/include/errno.h primos/include/fcntl.h \
48   primos/include/stdlib.h primos/include/sysStat.h \
49   primos/include/sysTypes.h primos/build.cpl primos/readme \
50   primos/primos.c primos/ci.opts revision.h sample/makecrc.c \
51   sample/ztouch sample/add.c sample/sub.c sample/zread.c sample/zfile \
52   tailor.h vms/Makefile.mms vms/gzip.hlp vms/vms.c vms/Readme.vms \
53   vms/Makefile.vms vms/Makefile.gcc vms/makegzip.com zcat.in zcmp.in zdiff.in \
54   zegrep.in zfgrep.in zforce.in zgrep.in zless.in zmore.in znew.in
55
56 bin_PROGRAMS = gzip
57 bin_SCRIPTS = gunzip gzexe zcat zcmp zdiff \
58   zegrep zfgrep zforce zgrep zless zmore znew
59 gzip_SOURCES = \
60   bits.c crypt.c deflate.c gzip.c inflate.c lzw.c \
61   trees.c unlzh.c unlzw.c unpack.c unzip.c util.c zip.c
62 gzip_LDADD = libver.a lib/libgzip.a
63 gzip_LDADD += $(LIB_CLOCK_GETTIME)
64
65 BUILT_SOURCES += version.c
66 version.c: Makefile
67         $(AM_V_GEN)rm -f $@
68         $(AM_V_at)printf '#include <config.h>\n' > $@t
69         $(AM_V_at)printf 'char const *Version = "$(PACKAGE_VERSION)";\n' >> $@t
70         $(AM_V_at)chmod a-w $@t
71         $(AM_V_at)mv $@t $@
72
73 BUILT_SOURCES += version.h
74 version.h: Makefile
75         $(AM_V_GEN)rm -f $@
76         $(AM_V_at)printf 'extern char const *Version;\n' > $@t
77         $(AM_V_at)chmod a-w $@t
78         $(AM_V_at)mv $@t $@
79
80 gzip.doc: gzip.1
81         $(AM_V_GEN)groff -man -Tascii $(srcdir)/gzip.1 | col -b | uniq > $@-t \
82           && mv $@-t $@
83
84 gzip.doc.gz: gzip.doc $(bin_PROGRAMS)
85         $(AM_V_GEN)./gzip < $(srcdir)/gzip.doc >$@-t && mv $@-t $@
86
87 SUFFIXES = .in
88 .in:
89         $(AM_V_GEN)sed \
90                 -e 's|/bin/sh|$(SHELL)|g' \
91                 -e 's|[@]bindir@|'\''$(bindir)'\''|g' \
92                 -e 's|[@]VERSION@|$(VERSION)|g' \
93                 $(srcdir)/$@.in >$@-t \
94           && chmod a+x $@-t \
95           && mv $@-t $@
96
97 # Arrange so that .tarball-version appears only in the distribution
98 # tarball, and never in a checked-out repository.
99 dist-hook: gen-ChangeLog
100         $(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
101
102 gen_start_date = 2008-01-01
103 .PHONY: gen-ChangeLog
104 gen-ChangeLog:
105         $(AM_V_GEN)if test -d .git; then                                \
106           $(top_srcdir)/build-aux/gitlog-to-changelog                   \
107             --since=$(gen_start_date) > $(distdir)/cl-t;                \
108           rm -f $(distdir)/ChangeLog;                                   \
109           mv $(distdir)/cl-t $(distdir)/ChangeLog;                      \
110         fi
111
112 # A simple test, just of gzip -- more of a sanity check than anything else.
113 FILES_TO_CHECK = $(bin_SCRIPTS) \
114   $(top_srcdir)/ChangeLog $(top_srcdir)/configure $(top_srcdir)/gzip.c
115 check-local: $(FILES_TO_CHECK) $(bin_PROGRAMS) gzip.doc.gz
116         { test '$(srcdir)' != . || ./zdiff --__bindir . -c gzip.doc.gz; }
117         ./zdiff --__bindir . -c $(srcdir)/gzip.doc $(srcdir)/gzip.doc
118         ./zdiff --__bindir . $(srcdir)/gzip.doc gzip.doc.gz
119         ./zdiff --__bindir . -c - $(srcdir)/gzip.doc <gzip.doc.gz
120         ./zdiff --__bindir . -c gzip.doc.gz gzip.doc.gz
121         ./zgrep --__bindir . -iV >/dev/null
122         for file in $(FILES_TO_CHECK); do \
123           ./gzip -cv -- "$$file" | ./gzip -d | cmp - "$$file" || exit 1; \
124         done
125         @echo 'Test succeeded.'
126
127 install-exec-hook: remove-installed-links
128 install-exec-hook remove-installed-links:
129         @for prog_ext in $(bin_PROGRAMS) $(bin_SCRIPTS); do \
130           prog=`echo "$$prog_ext"|sed 's/$(EXEEXT)$$//'`; \
131           case $$prog in \
132           gunzip) aliases='uncompress';; \
133           *) continue;; \
134           esac; \
135           transform='$(transform)'; \
136           test "X$$prog" = "X$$prog_ext" || \
137             transform="$$transform"';s/$$/$(EXEEXT)/'; \
138           destbindir=$(DESTDIR)$(bindir); \
139           source=`echo "$$prog"|sed "$$transform"`; \
140           for alias in $$aliases; do \
141             dest=`echo "$$alias"|sed "$$transform"`; \
142             (set -x; \
143              cd "$$destbindir" && \
144              rm -f "$$dest" && \
145              case $@ in \
146              install-exec-hook) \
147                ln "$$source" "$$dest" || $(LN_S) "$$source" "$$dest";; \
148              esac \
149             ) || exit; \
150           done; \
151         done
152
153 uninstall-local: remove-installed-links
154
155 ALL_RECURSIVE_TARGETS += distcheck-hook
156 distcheck-hook:
157         $(MAKE) my-distcheck
158
159 MAINTAINERCLEANFILES = gzip.doc
160
161 MOSTLYCLEANFILES = _match.i match_.s _match.S gzip.doc.gz \
162   gunzip gzexe zcat zcmp zdiff zegrep zfgrep zforce zgrep zless zmore znew