1#   -*-makefile-*-
2#   source-distribution.make
3#
4#   Makefile rules to build snapshots from cvs, source .tar.gz etc
5#
6#   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
7#
8#   Author: Adam Fedor <fedor@gnu.org>
9#   Author: Nicola Pero <n.pero@mi.flashnet.it>
10#
11#   This file is part of the GNUstep Makefile Package.
12#
13#   This library is free software; you can redistribute it and/or
14#   modify it under the terms of the GNU General Public License
15#   as published by the Free Software Foundation; either version 3
16#   of the License, or (at your option) any later version.
17#
18#   You should have received a copy of the GNU General Public
19#   License along with this library; see the file COPYING.
20#   If not, write to the Free Software Foundation,
21#   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22
23#
24# Interesting variables to define in your GNUmakefile:
25#
26# PACKAGE_NAME = gnustep-base
27# PACKAGE_VERSION = 1.0.0
28#
29# For Git exports, you may want to define something like:
30#
31# GIT_MODULE_NAME = libs-base
32#
33# GIT_MODULE_NAME will default to the value of PACKAGE_NAME.
34# GIT_TAG_NAME is the same as GIT_MODULE_NAME if not set, and is used as
35# a prefix when creating a tag or exporting a tag. Currently, the Git
36# integration does not interact with remote repository, so specifying
37# a base URL is not needed.
38#
39# When Git tagging, an ANNOUNCE file can be used to create the annotated Git
40# tag's commit message.
41# - Passing GIT_TAG_ANNOUNCE_FILE will copy the file, then prefix it with
42#   a one-line 'Release $(PACKAGE_VERSION).' and an empty line.
43# - Additionally passing GIT_TAG_ANNOUNCE_OMIT_PREFACE will use the ANNOUNCE
44#   file verbatim, without the prefix.
45#
46# GIT_TAG_SIGN can be used to control whether the annotated Git tag should
47# be GPG-signed. Empty value or unspecified means no signature, 'yes' means
48# use the default signing key, and another value specifies which key should
49# be used; you can use things like key ID or e-mail address.
50#
51# For SVN exports, you may want to define something like:
52#
53# SVN_MODULE_NAME = base
54# SVN_BASE_URL = http://svn.gna.org/svn/gnustep/libs
55#
56# SVN_TAG_NAME is the same as SVN_MODULE_NAME if not set and is used to
57# tag and retrieve a module version.
58#
59# For CVS exports, you may want to define something like:
60#
61# CVS_MODULE_NAME = base
62# CVS_FLAGS = -d :pserver:anoncvs@subversions.gnu.org:/cvsroot/gnustep
63#
64# CVS_TAG_NAME is the same as CVS_MODULE_NAME if not set and is used to
65# tag and retreive a module version
66#
67# You can also pass/override them on the command line if you want,
68# make cvs-snapshot CVS_FLAGS="-d :pserver:anoncvs@subversions.gnu.org:/cvsroot/gnustep -z9"
69#
70# If you set the RELEASE_DIR variable, all generated .tar.gz files will
71# be automatically moved to that directory after having being created.
72# RELEASE_DIR is either an absolute path, or a relative path to the
73# current directory.
74#
75#
76# By default, .tar.gz archives will be created for distributions.
77# You can change the compression mechanism used by setting COMPRESSION
78# to any of the following variables -
79#
80#  none (no compression used)
81#  gzip (gzip, it's the default)
82#  bzip2 (bzip2)
83#
84# For example, 'make dist COMPRESSION=bzip2' creates a .tar.bz2 for
85# distribution.
86#
87#
88# If you want to omit some files from the distribution archive, add a
89# .dist-ignore file in the top-level directory of your package, listing
90# all files (/directories) you want to exclude from distribution.
91# CVS and .svn files are automatically excluded.
92#
93
94ifeq ($(CVS_MODULE_NAME),)
95  CVS_MODULE_NAME = $(PACKAGE_NAME)
96endif
97ifeq ($(CVS_TAG_NAME),)
98  CVS_TAG_NAME = $(CVS_MODULE_NAME)
99endif
100
101ifeq ($(CVS_FLAGS),)
102  CVS_FLAGS = -z3
103endif
104
105ifeq ($(SVN_MODULE_NAME),)
106  SVN_MODULE_NAME = $(PACKAGE_NAME)
107endif
108ifeq ($(SVN_TAG_NAME),)
109  SVN_TAG_NAME = $(SVN_MODULE_NAME)
110endif
111
112ifeq ($(GIT_MODULE_NAME),)
113  GIT_MODULE_NAME = $(SVN_MODULE_NAME)
114endif
115ifeq ($(GIT_TAG_NAME),)
116  GIT_TAG_NAME = $(GIT_MODULE_NAME)
117endif
118
119ifeq ($(HG_MODULE_NAME),)
120  HG_MODULE_NAME = $(SVN_MODULE_NAME)
121endif
122ifeq ($(HG_TAG_NAME),)
123  HG_TAG_NAME = $(HG_MODULE_NAME)
124endif
125
126
127# Set the cvs command we use.  Most of the times, this is 'cvs' and
128# you need to do nothing.  But you can override 'cvs' with something
129# else.  Useful for example when you need cvs to go through runsocks
130# you can do make cvs-snapshot CVS='runsocks cvs'
131ifeq ($(CVS),)
132  CVS = cvs
133endif
134ifeq ($(SVN),)
135  SVN = svn
136endif
137ifeq ($(GIT),)
138  GIT = git
139endif
140ifeq ($(HG),)
141  HG = hg
142endif
143
144#
145# You can set COMPRESSION_PROGRAM and COMPRESSION_EXT by hand if your
146# COMPRESSION type is not listed here.
147#
148# Otherwise, set COMPRESSION to '' or 'gzip' (for gzip), to 'none'
149# (for no compression), to 'bzip2' (for bzip2), and
150# COMPRESSION_PROGRAM, COMPRESSION_EXT is set for you.
151#
152
153ifeq ($(COMPRESSION_PROGRAM),)
154
155ifeq ($(COMPRESSION), none)
156  COMPRESSION_PROGRAM = cat
157  COMPRESSION_EXT =
158else
159ifeq ($(COMPRESSION), bzip2)
160  COMPRESSION_PROGRAM = bzip2
161  COMPRESSION_EXT = .bz2
162else
163ifeq ($(COMPRESSION),)
164  COMPRESSION_PROGRAM = gzip
165  COMPRESSION_EXT = .gz
166else
167ifeq ($(COMPRESSION), gzip)
168  COMPRESSION_PROGRAM = gzip
169  COMPRESSION_EXT = .gz
170else
171  $(warning "Unrecognized COMPRESSION - available are 'none', 'gzip', 'bzip2'")
172  $(warning "Unrecognized COMPRESSION - using gzip")
173  COMPRESSION_PROGRAM = gzip
174  COMPRESSION_EXT = .gz
175endif
176endif
177endif
178endif
179
180endif # COMPRESSION
181
182# Whether to GPG sign the Git tag.
183#
184# - By default (or with empty variable GIT_TAG_SIGN), annotated tag will be
185#   created without signature.
186# - If GIT_TAG_SIGN has value of 'yes', default e-mail address's key will
187#   be used.
188# - If GIT_TAG_SIGN has another value, the value will be used as the signing
189#   e-mail address.
190ifeq ($(GIT_TAG_SIGN), )
191GIT_TAG_ANNOTATION_FLAGS = -a
192else
193  ifeq ($(GIT_TAG_SIGN), yes)
194  GIT_TAG_ANNOTATION_FLAGS = -s
195  else
196  GIT_TAG_ANNOTATION_FLAGS = -u $(GIT_TAG_SIGN)
197  endif
198endif
199
200# Due to peculiarities of some packaging systems or package distribution
201# systems, we may want to permit customization of tarball version string.
202
203ifeq ($(TARBALL_VERSION), )
204TARBALL_VERSION := $(PACKAGE_VERSION)
205endif
206
207ifeq ($(TARBALL_VERSION_INCLUDE_SVN_REVISION), yes)
208# Revision; potentially expensive so expand when used.
209SVN_REVISION = $(shell svn info . | sed -ne 's/^Revision: //p')
210TARBALL_VERSION := $(TARBALL_VERSION)~svn$(SVN_REVISION)
211endif
212
213ifeq ($(TARBALL_VERSION_INCLUDE_DATE_TIME), yes)
214# Expand immediately; it should be constant in the script.
215DATE_TIME_VERSION := $(shell date +%Y%m%d%H%M)
216TARBALL_VERSION := $(TARBALL_VERSION)~date$(DATE_TIME_VERSION)
217endif
218
219VERSION_NAME = $(PACKAGE_NAME)-$(TARBALL_VERSION)
220
221ARCHIVE_FILE = $(VERSION_NAME).tar$(COMPRESSION_EXT)
222
223VERTAG = $(subst .,_,$(PACKAGE_VERSION))
224
225.PHONY: dist cvs-tag cvs-dist cvs-snapshot internal-cvs-export svn-tag svn-tag-stable svn-dist svn-bugfix internal-svn-export svn-snapshot
226
227#
228# Build a .tar.gz with the whole directory tree
229#
230dist: distclean
231	$(ECHO_NOTHING)echo "Generating $(ARCHIVE_FILE) in the parent directory..."; \
232	SNAPSHOT_DIR=`basename $$(pwd)`; \
233	if [ "$$SNAPSHOT_DIR" != "$(VERSION_NAME)" ]; then \
234	  if [ -d "../$(VERSION_NAME)" ]; then \
235	    echo "$(VERSION_NAME) already exists in parent directory (?):"; \
236	    echo "Saving old version in $(VERSION_NAME)~"; \
237	    mv ../$(VERSION_NAME) ../$(VERSION_NAME)~; \
238	  fi; \
239	  mkdir ../$(VERSION_NAME); \
240	  $(TAR) cfX -  $(GNUSTEP_MAKEFILES)/tar-exclude-list . | (cd ../$(VERSION_NAME); $(TAR) xf -); \
241	fi; \
242	cd ..; \
243	if [ -f $(ARCHIVE_FILE) ]; then             \
244	  echo "$(ARCHIVE_FILE) already exists:";    \
245	  echo "Saving old version in $(ARCHIVE_FILE)~"; \
246	  mv $(ARCHIVE_FILE) $(ARCHIVE_FILE)~;    \
247	fi; \
248	if [ -f $(VERSION_NAME)/.dist-ignore ]; then \
249	  $(TAR) cfX - $(VERSION_NAME)/.dist-ignore $(VERSION_NAME) \
250	      | $(COMPRESSION_PROGRAM) > $(ARCHIVE_FILE); \
251	else \
252	  $(TAR) cf - $(VERSION_NAME) \
253	      | $(COMPRESSION_PROGRAM) > $(ARCHIVE_FILE); \
254	fi; \
255	if [ "$$SNAPSHOT_DIR" != "$(VERSION_NAME)" ]; then \
256	  rm -rf $(VERSION_NAME);               \
257        fi; \
258	if [ ! -f $(ARCHIVE_FILE) ]; then \
259	  echo "*Error* creating .tar$(COMPRESSION_EXT) archive"; \
260	  exit 1; \
261	fi;$(END_ECHO)
262ifneq ($(RELEASE_DIR),)
263	$(ECHO_NOTHING)echo "Moving $(ARCHIVE_FILE) to $(RELEASE_DIR)..."; \
264	if [ ! -d $(RELEASE_DIR) ]; then \
265	  $(MKDIRS) $(RELEASE_DIR); \
266	fi; \
267	if [ -f $(RELEASE_DIR)/$(ARCHIVE_FILE) ]; then \
268	  echo "$(RELEASE_DIR)/$(ARCHIVE_FILE) already exists:";    \
269	  echo "Saving old version in $(RELEASE_DIR)/$(ARCHIVE_FILE)~";\
270	  mv $(RELEASE_DIR)/$(ARCHIVE_FILE) \
271	     $(RELEASE_DIR)/$(ARCHIVE_FILE)~;\
272	fi; \
273	mv ../$(ARCHIVE_FILE) $(RELEASE_DIR)$(END_ECHO)
274endif
275
276#
277# Tag the SVN source with the $(SVN_TAG_NAME)-$(VERTAG) tag
278#
279svn-tag-stable:
280	$(SVN) copy $(SVN_BASE_URL)/$(SVN_MODULE_NAME)/branches/stable $(SVN_BASE_URL)/$(SVN_MODULE_NAME)/tags/$(SVN_TAG_NAME)-$(VERTAG) -m "Tag version $(VERTAG)"
281
282svn-tag:
283	$(SVN) copy $(SVN_BASE_URL)/$(SVN_MODULE_NAME)/trunk $(SVN_BASE_URL)/$(SVN_MODULE_NAME)/tags/$(SVN_TAG_NAME)-$(VERTAG) -m "Tag version $(VERTAG)"
284
285#
286# Build a .tar.gz from the SVN sources using revision/tag
287# $(SVN_TAG_NAME)-$(VERTAG) as for a new release of the package.
288#
289svn-dist: EXPORT_SVN_URL = $(SVN_BASE_URL)/$(SVN_MODULE_NAME)/tags/$(SVN_TAG_NAME)-$(VERTAG)
290svn-dist: internal-svn-export
291
292#
293# Build a .tar.gz from the SVN source from the stable branch
294# as a bugfix release.
295#
296svn-bugfix: EXPORT_SVN_URL = $(SVN_BASE_URL)/$(SVN_MODULE_NAME)/branches/stable
297svn-bugfix: internal-svn-export
298
299#
300# Build a .tar.gz from the SVN source as they are now
301#
302svn-snapshot: EXPORT_SVN_URL = $(SVN_BASE_URL)/$(SVN_MODULE_NAME)/trunk
303svn-snapshot: internal-svn-export
304
305#
306# Build a .tar.gz from the local SVN tree
307#
308svn-export: EXPORT_SVN_URL = .
309svn-export: internal-svn-export
310
311internal-svn-export:
312	$(ECHO_NOTHING)echo "Exporting from module $(SVN_MODULE_NAME) on SVN..."; \
313	if [ -e $(VERSION_NAME) ]; then \
314	  echo "*Error* cannot export: $(VERSION_NAME) already exists"; \
315	  exit 1; \
316	fi; \
317	$(SVN) export $(EXPORT_SVN_URL) $(VERSION_NAME); \
318	echo "Generating $(ARCHIVE_FILE)"; \
319	if [ -f $(ARCHIVE_FILE) ]; then            \
320	  echo "$(ARCHIVE_FILE) already exists:";   \
321	  echo "Saving old version in $(ARCHIVE_FILE)~"; \
322	  mv $(ARCHIVE_FILE) $(ARCHIVE_FILE)~;    \
323	fi; \
324	if [ -f $(VERSION_NAME)/.dist-ignore ]; then \
325	  $(TAR) cfX - $(VERSION_NAME)/.dist-ignore $(VERSION_NAME) \
326	      | $(COMPRESSION_PROGRAM) > $(ARCHIVE_FILE); \
327	else \
328	  $(TAR) cf - $(VERSION_NAME) \
329	      | $(COMPRESSION_PROGRAM) > $(ARCHIVE_FILE); \
330	fi; \
331	rm -rf $(VERSION_NAME);                  \
332	if [ ! -f $(ARCHIVE_FILE) ]; then \
333	  echo "*Error* creating .tar$(COMPRESSION_EXT) archive"; \
334	  exit 1; \
335	fi;$(END_ECHO)
336ifneq ($(RELEASE_DIR),)
337	$(ECHO_NOTHING)echo "Moving $(ARCHIVE_FILE) to $(RELEASE_DIR)..."; \
338	if [ ! -d $(RELEASE_DIR) ]; then \
339	  $(MKDIRS) $(RELEASE_DIR); \
340	fi; \
341	if [ -f $(RELEASE_DIR)/$(ARCHIVE_FILE) ]; then \
342	  echo "$(RELEASE_DIR)/$(ARCHIVE_FILE) already exists:";    \
343	  echo "Saving old version in $(RELEASE_DIR)/$(ARCHIVE_FILE)~";\
344	  mv $(RELEASE_DIR)/$(ARCHIVE_FILE) \
345	     $(RELEASE_DIR)/$(ARCHIVE_FILE)~;\
346	fi; \
347	mv $(ARCHIVE_FILE) $(RELEASE_DIR)$(END_ECHO)
348endif
349
350#
351# Tag the CVS source with the $(CVS_TAG_NAME)-$(VERTAG) tag
352#
353cvs-tag:
354	$(CVS) $(CVS_FLAGS) rtag $(CVS_TAG_NAME)-$(VERTAG) $(CVS_MODULE_NAME)
355
356#
357# Build a .tar.gz from the CVS sources using revision/tag
358# $(CVS_TAG_NAME)-$(VERTAG)
359#
360cvs-dist: EXPORT_CVS_FLAGS = -r $(CVS_TAG_NAME)-$(VERTAG)
361cvs-dist: internal-cvs-export
362
363#
364# Build a .tar.gz from the CVS source as they are now
365#
366cvs-snapshot: EXPORT_CVS_FLAGS = -D now
367cvs-snapshot: internal-cvs-export
368
369internal-cvs-export:
370	$(ECHO_NOTHING)echo "Exporting from module $(CVS_MODULE_NAME) on CVS..."; \
371	if [ -e $(CVS_MODULE_NAME) ]; then \
372	  echo "*Error* cannot export: $(CVS_MODULE_NAME) already exists"; \
373	  exit 1; \
374	fi; \
375	$(CVS) $(CVS_FLAGS) export $(EXPORT_CVS_FLAGS) $(CVS_MODULE_NAME); \
376	echo "Generating $(ARCHIVE_FILE)"; \
377	mv $(CVS_MODULE_NAME) $(VERSION_NAME); \
378	if [ -f $(ARCHIVE_FILE) ]; then            \
379	  echo "$(ARCHIVE_FILE) already exists:";   \
380	  echo "Saving old version in $(ARCHIVE_FILE)~"; \
381	  mv $(ARCHIVE_FILE) $(ARCHIVE_FILE)~;    \
382	fi; \
383	if [ -f $(VERSION_NAME)/.dist-ignore ]; then \
384	  $(TAR) cfX - $(VERSION_NAME)/.dist-ignore $(VERSION_NAME) \
385	      | $(COMPRESSION_PROGRAM) > $(ARCHIVE_FILE); \
386	else \
387	  $(TAR) cf - $(VERSION_NAME) \
388	      | $(COMPRESSION_PROGRAM) > $(ARCHIVE_FILE); \
389	fi; \
390	rm -rf $(VERSION_NAME);                  \
391	if [ ! -f $(ARCHIVE_FILE) ]; then \
392	  echo "*Error* creating .tar$(COMPRESSION_EXT) archive"; \
393	  exit 1; \
394	fi;$(END_ECHO)
395ifneq ($(RELEASE_DIR),)
396	$(ECHO_NOTHING)echo "Moving $(ARCHIVE_FILE) to $(RELEASE_DIR)..."; \
397	if [ ! -d $(RELEASE_DIR) ]; then \
398	  $(MKDIRS) $(RELEASE_DIR); \
399	fi; \
400	if [ -f $(RELEASE_DIR)/$(ARCHIVE_FILE) ]; then \
401	  echo "$(RELEASE_DIR)/$(ARCHIVE_FILE) already exists:";    \
402	  echo "Saving old version in $(RELEASE_DIR)/$(ARCHIVE_FILE)~";\
403	  mv $(RELEASE_DIR)/$(ARCHIVE_FILE) \
404	     $(RELEASE_DIR)/$(ARCHIVE_FILE)~;\
405	fi; \
406	mv $(ARCHIVE_FILE) $(RELEASE_DIR)$(END_ECHO)
407endif
408
409#
410# Create an annotated Git tag with the $(GIT_TAG_NAME)-$(VERTAG) tag.
411#
412# New tag still needs to be published with git push --tags.
413#
414ifeq ($(GIT_TAG_ANNOUNCE_FILE),)
415git-tag:
416	$(GIT) tag \
417	  $(GIT_TAG_ANNOTATION_FLAGS) \
418	  $(GIT_TAG_NAME)-$(VERTAG) \
419	  -m "Release $(PACKAGE_VERSION)"
420else
421ifneq ($(GIT_TAG_ANNOUNCE_OMIT_PREFACE),yes)
422.INTERMEDIATE += git-tag-announce-file-$(VERTAG).tmp
423git-tag-announce-file-$(VERTAG).tmp: $(GIT_TAG_ANNOUNCE_FILE)
424	printf "Release $(PACKAGE_VERSION).\n\n" > $@
425	cat $(GIT_TAG_ANNOUNCE_FILE) >> $@
426
427git-tag: git-tag-announce-file-$(VERTAG).tmp
428	$(GIT) tag \
429	  $(GIT_TAG_ANNOTATION_FLAGS) \
430	  $(GIT_TAG_NAME)-$(VERTAG) \
431	  -F $<
432else
433git-tag:
434	$(GIT) tag \
435	  $(GIT_TAG_ANNOTATION_FLAGS) \
436	  $(GIT_TAG_NAME)-$(VERTAG) \
437	  -F $(GIT_TAG_ANNOUNCE_FILE)
438endif
439endif
440
441#
442# Build a .tar.gz from the Git sources using revision/tag
443# $(GIT_TAG_NAME)-$(VERTAG) as for a new release of the package.
444#
445# Note: .dist-ignore is unused at this time.
446#
447git-dist:
448	$(ECHO_NOTHING)echo "Exporting from branch or tag $(GIT_TAG_NAME)-$(VERTAG) on local Git repository..."; \
449	if $(GIT) show $(GIT_TAG_NAME)-$(VERTAG):.dist-ignore 2>/dev/null >/dev/null; then \
450          echo "*Error* cannot export: dist-ignore is currently unused"; \
451	else \
452	  $(GIT) archive --format=tar.gz $(GIT_TAG_NAME)-$(VERTAG) -o $(ARCHIVE_FILE) --prefix=$(VERSION_NAME)/ ; \
453        fi ; \
454	if [ ! -f $(ARCHIVE_FILE) ]; then \
455	  echo "*Error* creating .tar$(COMPRESSION_EXT) archive"; \
456	  exit 1; \
457	fi;$(END_ECHO)
458ifneq ($(RELEASE_DIR),)
459	$(ECHO_NOTHING)echo "Moving $(ARCHIVE_FILE) to $(RELEASE_DIR)..."; \
460	if [ ! -d $(RELEASE_DIR) ]; then \
461	  $(MKDIRS) $(RELEASE_DIR); \
462	fi; \
463	if [ -f $(RELEASE_DIR)/$(ARCHIVE_FILE) ]; then \
464	  echo "$(RELEASE_DIR)/$(ARCHIVE_FILE) already exists:";    \
465	  echo "Saving old version in $(RELEASE_DIR)/$(ARCHIVE_FILE)~";\
466	  mv $(RELEASE_DIR)/$(ARCHIVE_FILE) \
467	     $(RELEASE_DIR)/$(ARCHIVE_FILE)~;\
468	fi; \
469	mv $(ARCHIVE_FILE) $(RELEASE_DIR)$(END_ECHO)
470endif
471
472git-tag-stable:
473	$(ECHO_NOTHING)echo "*Error* tagging stable branch in Git is not supported at this time."$(END_ECHO)
474	exit 1
475
476git-bugfix:
477	$(ECHO_NOTHING)echo "*Error* creating a bugfix release from the stable branch in Git is not supported at this time."$(END_ECHO)
478	exit 1
479
480git-snapshot:
481	$(ECHO_NOTHING)echo "*Error* creating a snapshot tarball from the current Git master is not supported at this time."$(END_ECHO)
482	exit 1
483
484git-export:
485	$(ECHO_NOTHING)echo "*Error* creating a tarball from the current Git working copy is not supported at this time."$(END_ECHO)
486	exit 1
487
488#
489# Tag the Mercurial source with $(HG_TAG_NAME)-$(VERTAG) tag.
490#
491hg-tag:
492	$(HG) tag -m "Release $(PACKAGE_VERSION)" $(HG_TAG_NAME)-$(VERTAG)
493
494#
495# Build a .tar.gz from the Hg sources using revision/tag
496# $(HG_TAG_NAME)-$(VERTAG) as for a new release of the package.
497#
498hg-dist:
499	$(ECHO_NOTHING)echo "Exporting from branch or tag $(HG_TAG_NAME)-$(VERTAG) on local Mercurial repository..."; \
500	$(HG) archive -r $(HG_TAG_NAME)-$(VERTAG) -p $(VERSION_NAME)/ $(ARCHIVE_FILE); \
501	if [ ! -f $(ARCHIVE_FILE) ]; then \
502	  echo "*Error* creating .tar$(COMPRESSION_EXT) archive"; \
503	  exit 1; \
504	fi;$(END_ECHO)
505ifneq ($(RELEASE_DIR),)
506	$(ECHO_NOTHING)echo "Moving $(ARCHIVE_FILE) to $(RELEASE_DIR)..."; \
507	if [ ! -d $(RELEASE_DIR) ]; then \
508	  $(MKDIRS) $(RELEASE_DIR); \
509	fi; \
510	if [ -f $(RELEASE_DIR)/$(ARCHIVE_FILE) ]; then \
511	  echo "$(RELEASE_DIR)/$(ARCHIVE_FILE) already exists:";    \
512	  echo "Saving old version in $(RELEASE_DIR)/$(ARCHIVE_FILE)~";\
513	  mv $(RELEASE_DIR)/$(ARCHIVE_FILE) \
514	     $(RELEASE_DIR)/$(ARCHIVE_FILE)~;\
515	fi; \
516	mv $(ARCHIVE_FILE) $(RELEASE_DIR)$(END_ECHO)
517endif
518
519hg-tag-stable:
520	$(ECHO_NOTHING)echo "*Error* tagging stable branch in Mercurial is not supported at this time."$(END_ECHO)
521	exit 1
522
523hg-bugfix:
524	$(ECHO_NOTHING)echo "*Error* creating a bugfix release from the stable branch in Mercurial is not supported at this time."$(END_ECHO)
525	exit 1
526
527hg-snapshot:
528	$(ECHO_NOTHING)echo "*Error* creating a snapshot tarball from the current Mercurial master is not supported at this time."$(END_ECHO)
529	exit 1
530
531hg-export:
532	$(ECHO_NOTHING)echo "*Error* creating a tarball from the current Mercurial working copy is not supported at this time."$(END_ECHO)
533	exit 1
534