3 # Copyright (C) 1999, 2001-2002, 2006-2007, 2009-2024 Free Software Foundation,
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.
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.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19 ALL_RECURSIVE_TARGETS =
22 SUBDIRS = lib doc . tests
23 AM_CPPFLAGS = -I$(top_srcdir)/lib
24 AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
26 # Tell the linker to omit references to unused shared libraries.
27 AM_LDFLAGS = $(IGNORE_UNUSED_LIBRARIES_CFLAGS)
29 noinst_LIBRARIES = libver.a
30 nodist_libver_a_SOURCES = version.c version.h
31 DISTCLEANFILES = version.c version.h
41 man_MANS = gunzip.1 gzexe.1 gzip.1 \
42 zcat.1 zcmp.1 zdiff.1 zforce.1 zgrep.1 $(ZLESS_MAN) zmore.1 znew.1
44 EXTRA_DIST = $(ACINCLUDE_INPUTS) $(man_MANS) \
49 gunzip.in gzexe.in gzip.doc \
51 sample/ztouch sample/add.c sample/sub.c sample/zread.c sample/zfile \
53 zcat.in zcmp.in zdiff.in \
54 zegrep.in zfgrep.in zforce.in zgrep.in zless.in zmore.in znew.in
55 noinst_HEADERS = deflate.h gzip.h lzw.h
58 bin_SCRIPTS = gunzip gzexe zcat zcmp zdiff \
59 zegrep zfgrep zforce zgrep $(ZLESS_PROG) zmore znew
61 bits.c deflate.c gzip.c inflate.c \
62 trees.c unlzh.c unlzw.c unpack.c unzip.c util.c zip.c
63 gzip_LDADD = libver.a lib/libgzip.a
64 gzip_LDADD += $(CLOCK_TIME_LIB) $(FDATASYNC_LIB)
65 # gnulib-tool also recommends $(MBRTOWC_LIB) and $(LIBINTL), but
66 # modules needing those libraries are avoided so the libraries can be omitted.
68 gzip_SOURCES += dfltcc.c
71 BUILT_SOURCES += version.c
74 $(AM_V_at)printf '#include <config.h>\n' > $@t
75 $(AM_V_at)printf '#include "version.h"\n' >> $@t
76 $(AM_V_at)printf 'char const *Version = "$(PACKAGE_VERSION)";\n' >> $@t
77 $(AM_V_at)chmod a-w $@t
80 BUILT_SOURCES += version.h
83 $(AM_V_at)printf 'extern char const *Version;\n' > $@t
84 $(AM_V_at)chmod a-w $@t
88 $(AM_V_GEN)groff -man -Tascii $(srcdir)/gzip.1 | col -b | uniq > $@-t \
89 && mv $@-t $(srcdir)/gzip.doc
91 gzip.doc.gz: gzip.doc $(bin_PROGRAMS)
92 $(AM_V_GEN)./gzip < $(srcdir)/gzip.doc >$@-t && mv $@-t $@
96 $(AM_V_GEN)rm -f $@-t $@ \
98 -e 's|/bin/sh|$(SHELL)|g' \
99 -e 's|[@]GREP@|$(GREP)|g' \
100 -e "s|'gzip'|$(GZIP_TRANSFORMED)|g" \
101 -e "s|'zdiff'|$(ZDIFF_TRANSFORMED)|g" \
102 -e "s|'zgrep'|$(ZGREP_TRANSFORMED)|g" \
103 -e 's|[@]VERSION@|$(VERSION)|g' \
104 $(srcdir)/$@.in >$@-t \
108 # Arrange so that .tarball-version appears only in the distribution
109 # tarball, and never in a checked-out repository.
110 dist-hook: gen-ChangeLog
111 $(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
113 gen_start_date = 2008-01-01
114 .PHONY: gen-ChangeLog
116 $(AM_V_GEN)if test -d .git; then \
117 $(top_srcdir)/build-aux/gitlog-to-changelog \
118 --since=$(gen_start_date) > $(distdir)/cl-t && \
119 { rm -f $(distdir)/ChangeLog && \
120 mv $(distdir)/cl-t $(distdir)/ChangeLog; } \
123 # Prepend "." to $PATH:
124 new_path = PATH=.$(PATH_SEPARATOR)$$PATH
126 # A simple test, just of gzip -- more of a sanity check than anything else.
127 FILES_TO_CHECK = $(bin_SCRIPTS) \
128 $(top_srcdir)/ChangeLog $(top_srcdir)/configure $(top_srcdir)/gzip.c
129 check-local: $(FILES_TO_CHECK) $(bin_PROGRAMS) gzip.doc.gz
130 $(AM_V_GEN)$(new_path); { test '$(srcdir)' != . \
131 || zdiff gzip.doc.gz; }
132 $(AM_V_at)$(new_path); zdiff $(srcdir)/gzip.doc $(srcdir)/gzip.doc
133 $(AM_V_at)$(new_path); zdiff $(srcdir)/gzip.doc gzip.doc.gz
134 $(AM_V_at)$(new_path); zdiff - $(srcdir)/gzip.doc <gzip.doc.gz
135 $(AM_V_at)$(new_path); zdiff gzip.doc.gz gzip.doc.gz
136 $(AM_V_at)$(new_path); zgrep -iV >/dev/null
137 $(AM_V_at)$(new_path); \
138 for opt in --rsyncable '' -1 -9; do \
139 for file in $(FILES_TO_CHECK); do \
140 gzip $$opt -c -- "$$file" \
141 | gzip -d | cmp - "$$file" || exit 1; \
145 install-exec-hook: remove-installed-links
146 install-exec-hook remove-installed-links:
147 @for prog_ext in $(bin_PROGRAMS) $(bin_SCRIPTS); do \
148 prog=`echo "$$prog_ext"|sed 's/$(EXEEXT)$$//'`; \
150 gunzip) aliases='uncompress';; \
153 transform='$(transform)'; \
154 test "X$$prog" = "X$$prog_ext" || \
155 transform="$$transform"';s/$$/$(EXEEXT)/'; \
156 destbindir=$(DESTDIR)$(bindir); \
157 source=`echo "$$prog"|sed "$$transform"`; \
158 for alias in $$aliases; do \
159 dest=`echo "$$alias"|sed "$$transform"`; \
161 cd "$$destbindir" && \
165 ln "$$source" "$$dest" || $(LN_S) "$$source" "$$dest";; \
171 uninstall-local: remove-installed-links
173 ALL_RECURSIVE_TARGETS += distcheck-hook
177 MAINTAINERCLEANFILES = gzip.doc
179 MOSTLYCLEANFILES = _match.i match_.s _match.S gzip.doc.gz \
180 gunzip gzexe zcat zcmp zdiff zegrep zfgrep zforce zgrep zless zmore znew
182 # gzip, zdiff and zgrep are used by installed scripts, and installed names
183 # might be transformed by 'configure' options like --program-transform-name.
184 # Create executabls in the current directory by the transformed names,
185 # for the benefit of 'make check'.
186 if GZIP_IS_TRANSFORMED
187 BUILT_SOURCES += $(GZIP_TRANSFORMED)
188 MOSTLYCLEANFILES += $(GZIP_TRANSFORMED)
190 printf '%s\n' >'$@' \
192 'exec '\''$(abs_top_builddir)/gzip'\'' "$$@"'
195 if ZDIFF_IS_TRANSFORMED
196 BUILT_SOURCES += $(ZDIFF_TRANSFORMED)
197 MOSTLYCLEANFILES += $(ZDIFF_TRANSFORMED)
198 $(ZDIFF_TRANSFORMED):
199 printf '%s\n' >'$@' \
201 'exec '\''$(abs_top_builddir)/zdiff'\'' "$$@"'
204 if ZGREP_IS_TRANSFORMED
205 BUILT_SOURCES += $(ZGREP_TRANSFORMED)
206 MOSTLYCLEANFILES += $(ZGREP_TRANSFORMED)
207 $(ZGREP_TRANSFORMED):
208 printf '%s\n' >'$@' \
210 'exec '\''$(abs_top_builddir)/zgrep'\'' "$$@"'