1## Makefile for the gettext-tools/misc subdirectory of GNU gettext
2## Copyright (C) 1995-1997, 2000-2003, 2005-2007, 2009-2010, 2019-2020 Free
3## 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
16## along with this program.  If not, see <https://www.gnu.org/licenses/>.
17
18## Process this file with automake to produce Makefile.in.
19
20AUTOMAKE_OPTIONS = 1.2 gnits
21EXTRA_DIST =
22MOSTLYCLEANFILES =
23CLEANFILES =
24DISTCLEANFILES =
25
26
27# Scripts for maintainers.
28
29bin_SCRIPTS = gettextize autopoint
30
31DISTCLEANFILES += gettextize autopoint convert-archive
32
33CLEANFILES += \
34  archive.dir.tar.gz \
35  archive.dir.tar.bz2 \
36  archive.dir.tar.xz \
37  archive.cvs.tar.gz \
38  archive.git.tar.gz
39
40EXTRA_DIST += add-to-archive cvsuser.c archive.dir.tar
41
42gettextsrcdir = $(datadir)/gettext
43gettextsrc_DATA = $(ARCHIVE_@ARCHIVE_FORMAT@)
44ARCHIVE_dirgz = archive.dir.tar.gz
45ARCHIVE_dirbz2 = archive.dir.tar.bz2
46ARCHIVE_dirxz = archive.dir.tar.xz
47ARCHIVE_git = archive.git.tar.gz
48ARCHIVE_cvs = archive.cvs.tar.gz
49
50# The archive.dir.tar file appears in release tarballs.
51# The GNU Coding Standards say in
52# <https://www.gnu.org/prep/standards/html_node/Makefile-Basics.html>:
53#   "GNU distributions usually contain some files which are not source files
54#    ... . Since these files normally appear in the source directory, they
55#    should always appear in the source directory, not in the build directory.
56#    So Makefile rules to update them should put the updated files in the
57#    source directory."
58# Therefore we put this file in the source directory, not the build directory.
59
60# The archive.dir.tar is not stored in the version control repository.
61# Alpha-testers must use the one from an already installed release or from
62# https://alpha.gnu.org/gnu/gettext/ .
63$(srcdir)/archive.dir.tar:
64	if test -f $(gettextsrcdir)/archive.dir.tar.gz; then \
65	  gzip -d -c < $(gettextsrcdir)/archive.dir.tar.gz > $@-t && mv $@-t $@; \
66	else \
67	  if test -f $(gettextsrcdir)/archive.dir.tar.bz2; then \
68	    bzip2 -d -c < $(gettextsrcdir)/archive.dir.tar.bz2 > $@-t && mv $@-t $@; \
69	  else \
70	    if test -f $(gettextsrcdir)/archive.dir.tar.xz; then \
71	      xz -d -c < $(gettextsrcdir)/archive.dir.tar.xz > $@-t && mv $@-t $@; \
72	    else \
73	      echo "archive.dir.tar is not under version control. Please copy the archive.dir.tar.{gz,bz2,xz} from an already installed release to gettext-tools/misc/ and decompress it there." 1>&2; \
74	      exit 1; \
75	    fi; \
76	  fi; \
77	fi
78MOSTLYCLEANFILES += archive.dir.tar-t
79
80# The archive.dir.tar.gz is generated from archive.dir.tar.
81archive.dir.tar.gz: $(srcdir)/archive.dir.tar
82	gzip -c -9 < '$(srcdir)'/archive.dir.tar > $@-t && mv $@-t $@
83MOSTLYCLEANFILES += archive.dir.tar.gz-t
84
85# The archive.dir.tar.bz2 is generated from archive.dir.tar.
86archive.dir.tar.bz2: $(srcdir)/archive.dir.tar
87	bzip2 -c -9 < '$(srcdir)'/archive.dir.tar > $@-t && mv $@-t $@
88MOSTLYCLEANFILES += archive.dir.tar.bz2-t
89
90# The archive.dir.tar.xz is generated from archive.dir.tar.
91archive.dir.tar.xz: $(srcdir)/archive.dir.tar
92	xz -c -5 < '$(srcdir)'/archive.dir.tar > $@-t && mv $@-t $@
93MOSTLYCLEANFILES += archive.dir.tar.xz-t
94
95# The archive.git.tar.gz is generated from archive.dir.tar.
96archive.git.tar.gz: $(srcdir)/archive.dir.tar
97	./convert-archive dir git '$(srcdir)'/archive.dir.tar $@
98
99# The archive.cvs.tar.gz is generated from archive.dir.tar.
100archive.cvs.tar.gz: $(srcdir)/archive.dir.tar
101	./convert-archive dir cvs '$(srcdir)'/archive.dir.tar $@
102