~ubuntu-branches/ubuntu/edgy/sope/edgy

« back to all changes in this revision

Viewing changes to gnustep-make/Master/source-distribution.make

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Ley
  • Date: 2005-08-19 16:53:31 UTC
  • Revision ID: james.westby@ubuntu.com-20050819165331-hs683wz1osm708pw
Tags: upstream-4.4rc.2
ImportĀ upstreamĀ versionĀ 4.4rc.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
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 2
 
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.LIB.
 
20
#   If not, write to the Free Software Foundation,
 
21
#   59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 CVS exports, you may want to define something like:
 
30
#
 
31
# CVS_MODULE_NAME = base
 
32
# CVS_FLAGS = -d :pserver:anoncvs@subversions.gnu.org:/cvsroot/gnustep
 
33
#
 
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
 
36
#
 
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"
 
39
#
 
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 
 
43
# current directory.
 
44
#
 
45
#
 
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 - 
 
49
#
 
50
#  none (no compression used)
 
51
#  gzip (gzip, it's the default)
 
52
#  bzip2 (bzip2)
 
53
#
 
54
# For example, 'make dist COMPRESSION=bzip2' creates a .tar.bz2 for
 
55
# distribution.
 
56
#
 
57
#
 
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.
 
61
#
 
62
 
 
63
ifeq ($(CVS_MODULE_NAME),)
 
64
  CVS_MODULE_NAME = $(PACKAGE_NAME)
 
65
endif
 
66
ifeq ($(CVS_TAG_NAME),)
 
67
  CVS_TAG_NAME = $(CVS_MODULE_NAME)
 
68
endif
 
69
 
 
70
ifeq ($(CVS_FLAGS),)
 
71
  CVS_FLAGS = -z3
 
72
endif
 
73
 
 
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'
 
78
ifeq ($(CVS),)
 
79
  CVS = cvs
 
80
endif
 
81
 
 
82
#
 
83
# You can set COMPRESSION_PROGRAM and COMPRESSION_EXT by hand if your 
 
84
# COMPRESSION type is not listed here.
 
85
#
 
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.
 
89
#
 
90
 
 
91
ifeq ($(COMPRESSION_PROGRAM),)
 
92
 
 
93
ifeq ($(COMPRESSION), none)
 
94
  COMPRESSION_PROGRAM = cat
 
95
  COMPRESSION_EXT =
 
96
else 
 
97
ifeq ($(COMPRESSION), bzip2)
 
98
  COMPRESSION_PROGRAM = bzip2
 
99
  COMPRESSION_EXT = .bz2
 
100
else 
 
101
ifeq ($(COMPRESSION),)
 
102
  COMPRESSION_PROGRAM = gzip
 
103
  COMPRESSION_EXT = .gz
 
104
else 
 
105
ifeq ($(COMPRESSION), gzip)
 
106
  COMPRESSION_PROGRAM = gzip
 
107
  COMPRESSION_EXT = .gz
 
108
else
 
109
  $(warning "Unrecognized COMPRESSION - available are 'none', 'gzip', 'bzip2'")
 
110
  $(warning "Unrecognized COMPRESSION - using gzip")
 
111
  COMPRESSION_PROGRAM = gzip
 
112
  COMPRESSION_EXT = .gz
 
113
endif
 
114
endif
 
115
endif
 
116
endif
 
117
 
 
118
endif # COMPRESSION
 
119
 
 
120
VERSION_NAME = $(PACKAGE_NAME)-$(PACKAGE_VERSION)
 
121
 
 
122
ARCHIVE_FILE = $(VERSION_NAME).tar$(COMPRESSION_EXT)
 
123
 
 
124
VERTAG = $(subst .,_,$(PACKAGE_VERSION))
 
125
 
 
126
.PHONY: dist cvs-tag cvs-dist cvs-snapshot internal-cvs-export
 
127
 
 
128
#
 
129
# Build a .tar.gz with the whole directory tree
 
130
#
 
131
dist: distclean
 
132
        @echo "Generating $(ARCHIVE_FILE) in the parent directory..."; \
 
133
        SNAPSHOT_DIR=`basename $$(pwd)`; \
 
134
        cd ..;                           \
 
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)~; \
 
140
          fi; \
 
141
          mv $$SNAPSHOT_DIR $(VERSION_NAME);\
 
142
        fi; \
 
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)~;    \
 
147
        fi; \
 
148
        if [ -f $(VERSION_NAME)/.dist-ignore ]; then \
 
149
          tar cfX - $(VERSION_NAME)/.dist-ignore $(VERSION_NAME) \
 
150
              | $(COMPRESSION_PROGRAM) > $(ARCHIVE_FILE); \
 
151
        else \
 
152
          tar cf - $(VERSION_NAME) \
 
153
              | $(COMPRESSION_PROGRAM) > $(ARCHIVE_FILE); \
 
154
        fi; \
 
155
        if [ "$$SNAPSHOT_DIR" != "$(VERSION_NAME)" ]; then \
 
156
          mv $(VERSION_NAME) $$SNAPSHOT_DIR;               \
 
157
        fi; \
 
158
        if [ ! -f $(ARCHIVE_FILE) ]; then \
 
159
          echo "*Error* creating .tar$(COMPRESSION_EXT) archive"; \
 
160
          exit 1; \
 
161
        fi;
 
162
ifneq ($(RELEASE_DIR),)
 
163
        @echo "Moving $(ARCHIVE_FILE) to $(RELEASE_DIR)..."; \
 
164
        if [ ! -d $(RELEASE_DIR) ]; then \
 
165
          $(MKDIRS) $(RELEASE_DIR); \
 
166
        fi; \
 
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)~;\
 
172
        fi; \
 
173
        mv ../$(ARCHIVE_FILE) $(RELEASE_DIR)
 
174
endif
 
175
 
 
176
#
 
177
# Tag the CVS source with the $(CVS_TAG_NAME)-$(VERTAG) tag
 
178
#
 
179
cvs-tag:
 
180
        $(CVS) $(CVS_FLAGS) rtag $(CVS_TAG_NAME)-$(VERTAG) $(CVS_MODULE_NAME)
 
181
 
 
182
#
 
183
# Build a .tar.gz from the CVS sources using revision/tag 
 
184
# $(CVS_TAG_NAME)-$(VERTAG)
 
185
#
 
186
cvs-dist: EXPORT_CVS_FLAGS = -r $(CVS_TAG_NAME)-$(VERTAG) 
 
187
cvs-dist: internal-cvs-export
 
188
 
 
189
#
 
190
# Build a .tar.gz from the CVS source as they are now
 
191
#
 
192
cvs-snapshot: EXPORT_CVS_FLAGS = -D now
 
193
cvs-snapshot: internal-cvs-export
 
194
 
 
195
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"; \
 
199
          exit 1; \
 
200
        fi; \
 
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)~;    \
 
208
        fi; \
 
209
        if [ -f $(VERSION_NAME)/.dist-ignore ]; then \
 
210
          tar cfX - $(VERSION_NAME)/.dist-ignore $(VERSION_NAME) \
 
211
              | $(COMPRESSION_PROGRAM) > $(ARCHIVE_FILE); \
 
212
        else \
 
213
          tar cf - $(VERSION_NAME) \
 
214
              | $(COMPRESSION_PROGRAM) > $(ARCHIVE_FILE); \
 
215
        fi; \
 
216
        rm -rf $(VERSION_NAME);                  \
 
217
        if [ ! -f $(ARCHIVE_FILE) ]; then \
 
218
          echo "*Error* creating .tar$(COMPRESSION_EXT) archive"; \
 
219
          exit 1; \
 
220
        fi;
 
221
ifneq ($(RELEASE_DIR),)
 
222
        @echo "Moving $(ARCHIVE_FILE) to $(RELEASE_DIR)..."; \
 
223
        if [ ! -d $(RELEASE_DIR) ]; then \
 
224
          $(MKDIRS) $(RELEASE_DIR); \
 
225
        fi; \
 
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)~;\
 
231
        fi; \
 
232
        mv $(ARCHIVE_FILE) $(RELEASE_DIR)
 
233
endif