2
# source-distribution.make
4
# Makefile rules to build snapshots from cvs, source .tar.gz etc
6
# Copyright (C) 2000, 2001 Free Software Foundation, Inc.
8
# Author: Adam Fedor <fedor@gnu.org>
9
# Author: Nicola Pero <n.pero@mi.flashnet.it>
11
# This file is part of the GNUstep Makefile Package.
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 2
16
# of the License, or (at your option) any later version.
18
# You should have received a copy of the GNU General Public
19
# License along with this library; see the file COPYING.LIB.
20
# If not, write to the Free Software Foundation,
21
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24
# Interesting variables to define in your GNUmakefile:
26
# PACKAGE_NAME = gnustep-base
27
# PACKAGE_VERSION = 1.0.0
29
# For CVS exports, you may want to define something like:
31
# CVS_MODULE_NAME = base
32
# CVS_FLAGS = -d :pserver:anoncvs@subversions.gnu.org:/cvsroot/gnustep
34
# CVS_TAG_NAME is the same as CVS_MODULE_NAME if not set and is used to
35
# tag and retreive a module version
37
# You can also pass/override them on the command line if you want,
38
# make cvs-snapshot CVS_FLAGS="-d :pserver:anoncvs@subversions.gnu.org:/cvsroot/gnustep -z9"
40
# If you set the RELEASE_DIR variable, all generated .tar.gz files will
41
# be automatically moved to that directory after having being created.
42
# RELEASE_DIR is either an absolute path, or a relative path to the
46
# By default, .tar.gz archives will be created for distributions.
47
# You can change the compression mechanism used by setting COMPRESSION
48
# to any of the following variables -
50
# none (no compression used)
51
# gzip (gzip, it's the default)
54
# For example, 'make dist COMPRESSION=bzip2' creates a .tar.bz2 for
58
# If you want to omit some files from the distribution archive, add a
59
# .dist-ignore file in the top-level directory of your package, listing
60
# all files (/directories) you want to exclude from distribution.
63
ifeq ($(CVS_MODULE_NAME),)
64
CVS_MODULE_NAME = $(PACKAGE_NAME)
66
ifeq ($(CVS_TAG_NAME),)
67
CVS_TAG_NAME = $(CVS_MODULE_NAME)
74
# Set the cvs command we use. Most of the times, this is 'cvs' and
75
# you need to do nothing. But you can override 'cvs' with something
76
# else. Useful for example when you need cvs to go through runsocks
77
# you can do make cvs-snapshot CVS='runsocks cvs'
83
# You can set COMPRESSION_PROGRAM and COMPRESSION_EXT by hand if your
84
# COMPRESSION type is not listed here.
86
# Otherwise, set COMPRESSION to '' or 'gzip' (for gzip), to 'none'
87
# (for no compression), to 'bzip2' (for bzip2), and
88
# COMPRESSION_PROGRAM, COMPRESSION_EXT is set for you.
91
ifeq ($(COMPRESSION_PROGRAM),)
93
ifeq ($(COMPRESSION), none)
94
COMPRESSION_PROGRAM = cat
97
ifeq ($(COMPRESSION), bzip2)
98
COMPRESSION_PROGRAM = bzip2
99
COMPRESSION_EXT = .bz2
101
ifeq ($(COMPRESSION),)
102
COMPRESSION_PROGRAM = gzip
103
COMPRESSION_EXT = .gz
105
ifeq ($(COMPRESSION), gzip)
106
COMPRESSION_PROGRAM = gzip
107
COMPRESSION_EXT = .gz
109
$(warning "Unrecognized COMPRESSION - available are 'none', 'gzip', 'bzip2'")
110
$(warning "Unrecognized COMPRESSION - using gzip")
111
COMPRESSION_PROGRAM = gzip
112
COMPRESSION_EXT = .gz
120
VERSION_NAME = $(PACKAGE_NAME)-$(PACKAGE_VERSION)
122
ARCHIVE_FILE = $(VERSION_NAME).tar$(COMPRESSION_EXT)
124
VERTAG = $(subst .,_,$(PACKAGE_VERSION))
126
.PHONY: dist cvs-tag cvs-dist cvs-snapshot internal-cvs-export
129
# Build a .tar.gz with the whole directory tree
132
@echo "Generating $(ARCHIVE_FILE) in the parent directory..."; \
133
SNAPSHOT_DIR=`basename $$(pwd)`; \
135
if [ "$$SNAPSHOT_DIR" != "$(VERSION_NAME)" ]; then \
136
if [ -d "$(VERSION_NAME)" ]; then \
137
echo "$(VERSION_NAME) already exists in parent directory (?):"; \
138
echo "Saving old version in $(VERSION_NAME)~"; \
139
mv $(VERSION_NAME) $(VERSION_NAME)~; \
141
mv $$SNAPSHOT_DIR $(VERSION_NAME);\
143
if [ -f $(ARCHIVE_FILE) ]; then \
144
echo "$(ARCHIVE_FILE) already exists:"; \
145
echo "Saving old version in $(ARCHIVE_FILE)~"; \
146
mv $(ARCHIVE_FILE) $(ARCHIVE_FILE)~; \
148
if [ -f $(VERSION_NAME)/.dist-ignore ]; then \
149
tar cfX - $(VERSION_NAME)/.dist-ignore $(VERSION_NAME) \
150
| $(COMPRESSION_PROGRAM) > $(ARCHIVE_FILE); \
152
tar cf - $(VERSION_NAME) \
153
| $(COMPRESSION_PROGRAM) > $(ARCHIVE_FILE); \
155
if [ "$$SNAPSHOT_DIR" != "$(VERSION_NAME)" ]; then \
156
mv $(VERSION_NAME) $$SNAPSHOT_DIR; \
158
if [ ! -f $(ARCHIVE_FILE) ]; then \
159
echo "*Error* creating .tar$(COMPRESSION_EXT) archive"; \
162
ifneq ($(RELEASE_DIR),)
163
@echo "Moving $(ARCHIVE_FILE) to $(RELEASE_DIR)..."; \
164
if [ ! -d $(RELEASE_DIR) ]; then \
165
$(MKDIRS) $(RELEASE_DIR); \
167
if [ -f $(RELEASE_DIR)/$(ARCHIVE_FILE) ]; then \
168
echo "$(RELEASE_DIR)/$(ARCHIVE_FILE) already exists:"; \
169
echo "Saving old version in $(RELEASE_DIR)/$(ARCHIVE_FILE)~";\
170
mv $(RELEASE_DIR)/$(ARCHIVE_FILE) \
171
$(RELEASE_DIR)/$(ARCHIVE_FILE)~;\
173
mv ../$(ARCHIVE_FILE) $(RELEASE_DIR)
177
# Tag the CVS source with the $(CVS_TAG_NAME)-$(VERTAG) tag
180
$(CVS) $(CVS_FLAGS) rtag $(CVS_TAG_NAME)-$(VERTAG) $(CVS_MODULE_NAME)
183
# Build a .tar.gz from the CVS sources using revision/tag
184
# $(CVS_TAG_NAME)-$(VERTAG)
186
cvs-dist: EXPORT_CVS_FLAGS = -r $(CVS_TAG_NAME)-$(VERTAG)
187
cvs-dist: internal-cvs-export
190
# Build a .tar.gz from the CVS source as they are now
192
cvs-snapshot: EXPORT_CVS_FLAGS = -D now
193
cvs-snapshot: internal-cvs-export
196
@echo "Exporting from module $(CVS_MODULE_NAME) on CVS..."; \
197
if [ -e $(CVS_MODULE_NAME) ]; then \
198
echo "*Error* cannot export: $(CVS_MODULE_NAME) already exists"; \
201
$(CVS) $(CVS_FLAGS) export $(EXPORT_CVS_FLAGS) $(CVS_MODULE_NAME); \
202
echo "Generating $(ARCHIVE_FILE)"; \
203
mv $(CVS_MODULE_NAME) $(VERSION_NAME); \
204
if [ -f $(ARCHIVE_FILE) ]; then \
205
echo "$(ARCHIVE_FILE) already exists:"; \
206
echo "Saving old version in $(ARCHIVE_FILE)~"; \
207
mv $(ARCHIVE_FILE) $(ARCHIVE_FILE)~; \
209
if [ -f $(VERSION_NAME)/.dist-ignore ]; then \
210
tar cfX - $(VERSION_NAME)/.dist-ignore $(VERSION_NAME) \
211
| $(COMPRESSION_PROGRAM) > $(ARCHIVE_FILE); \
213
tar cf - $(VERSION_NAME) \
214
| $(COMPRESSION_PROGRAM) > $(ARCHIVE_FILE); \
216
rm -rf $(VERSION_NAME); \
217
if [ ! -f $(ARCHIVE_FILE) ]; then \
218
echo "*Error* creating .tar$(COMPRESSION_EXT) archive"; \
221
ifneq ($(RELEASE_DIR),)
222
@echo "Moving $(ARCHIVE_FILE) to $(RELEASE_DIR)..."; \
223
if [ ! -d $(RELEASE_DIR) ]; then \
224
$(MKDIRS) $(RELEASE_DIR); \
226
if [ -f $(RELEASE_DIR)/$(ARCHIVE_FILE) ]; then \
227
echo "$(RELEASE_DIR)/$(ARCHIVE_FILE) already exists:"; \
228
echo "Saving old version in $(RELEASE_DIR)/$(ARCHIVE_FILE)~";\
229
mv $(RELEASE_DIR)/$(ARCHIVE_FILE) \
230
$(RELEASE_DIR)/$(ARCHIVE_FILE)~;\
232
mv $(ARCHIVE_FILE) $(RELEASE_DIR)