src-release revision 130804
1#   Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
2#   1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation
3#
4# This file is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 2 of the License, or
7# (at your option) any later version.
8# 
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12# GNU General Public License for more details.
13# 
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, write to the Free Software
16# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17#
18
19# This Makefile contains release scripts for gdb, binutils, and other
20# packages which live in src.  It used to be part of the top level Makefile,
21# but that turned out to be very messy and hard to maintain.
22
23# This stuff really ought to be cleaned up and turned into something other
24# than a Makefile.  As it is it's heavily recursive.
25
26# This is the name of this script (!).  Needed due to horrible recursion.
27SELF = src-release
28
29SHELL = /bin/sh
30
31BZIPPROG = bzip2
32MD5PROG = md5sum
33
34# pwd command to use.  Allow user to override default by setting PWDCMD in
35# the environment to account for automounters.  The make variable must not
36# be called PWDCMD, otherwise the value set here is passed to make
37# subprocesses and overrides the setting from the user's environment.
38PWD = $${PWDCMD-pwd}
39
40#
41# Support for building net releases
42
43# Files in devo used in any net release.
44# ChangeLog omitted because it may refer to files which are not in this
45# distribution (perhaps it would be better to include it anyway).
46DEVO_SUPPORT= README Makefile.in configure configure.in \
47	config.guess config.if config.sub config move-if-change \
48	COPYING COPYING.LIB install-sh config-ml.in symlink-tree \
49	mkinstalldirs ltconfig ltmain.sh missing ylwrap \
50	libtool.m4 gettext.m4 ltcf-c.sh ltcf-cxx.sh ltcf-gcj.sh \
51	Makefile.def Makefile.tpl src-release
52
53# Files in devo/etc used in any net release.
54# ChangeLog omitted because it may refer to files which are not in this
55# distribution (perhaps it would be better to include it anyway).
56ETC_SUPPORT= Makefile.in configure configure.in standards.texi \
57	make-stds.texi standards.info* configure.texi configure.info* \
58	configbuild.* configdev.* fdl.texi texi2pod.pl
59
60
61# When you use `make setup-dirs' or `make taz' you should always redefine
62# this macro.
63SUPPORT_FILES = list-of-support-files-for-tool-in-question
64
65# NOTE: No double quotes in the below.  It is used within shell script
66# as VER="$(VER)"
67VER = `	if grep 'AM_INIT_AUTOMAKE.*BFD_VERSION' $(TOOL)/configure.in >/dev/null 2>&1; then \
68	  sed < bfd/configure.in -n 's/AM_INIT_AUTOMAKE[^,]*, *\([^)]*\))/\1/p'; \
69	elif grep AM_INIT_AUTOMAKE $(TOOL)/configure.in >/dev/null 2>&1; then \
70	  sed < $(TOOL)/configure.in -n 's/AM_INIT_AUTOMAKE[^,]*, *\([^)]*\))/\1/p'; \
71	elif test -f $(TOOL)/version.in; then \
72	  head -1 $(TOOL)/version.in; \
73	elif grep VERSION $(TOOL)/Makefile.in > /dev/null 2>&1; then \
74	  sed < $(TOOL)/Makefile.in -n 's/^VERSION *= *//p'; \
75	else \
76	  echo VERSION; \
77	fi`
78PACKAGE = $(TOOL)
79
80.PHONY: taz
81taz: $(DEVO_SUPPORT) $(SUPPORT_FILES) texinfo/texinfo.tex
82	$(MAKE) -f $(SELF) do-proto-toplev \
83		TOOL=$(TOOL) PACKAGE="$(PACKAGE)" VER="$(VER)" \
84		MD5PROG="$(MD5PROG)" \
85		SUPPORT_FILES="$(SUPPORT_FILES)"
86	$(MAKE) -f $(SELF) do-md5sum \
87		TOOL=$(TOOL) PACKAGE="$(PACKAGE)" VER="$(VER)" \
88		MD5PROG="$(MD5PROG)" \
89		SUPPORT_FILES="$(SUPPORT_FILES)"
90	$(MAKE) -f $(SELF) do-tar \
91		TOOL=$(TOOL) PACKAGE="$(PACKAGE)" VER="$(VER)" \
92		MD5PROG="$(MD5PROG)" \
93		SUPPORT_FILES="$(SUPPORT_FILES)"
94	$(MAKE) -f $(SELF) do-bz2 \
95		TOOL=$(TOOL) PACKAGE="$(PACKAGE)" VER="$(VER)" \
96		MD5PROG="$(MD5PROG)" \
97		SUPPORT_FILES="$(SUPPORT_FILES)"
98
99.PHONY: gdb-tar
100gdb-tar: $(DEVO_SUPPORT) $(SUPPORT_FILES) texinfo/texinfo.tex
101	$(MAKE) -f $(SELF) do-proto-toplev \
102		TOOL=$(TOOL) PACKAGE="$(PACKAGE)" VER="$(VER)" \
103		MD5PROG="$(MD5PROG)" \
104		SUPPORT_FILES="$(SUPPORT_FILES)"
105	$(MAKE) -f $(SELF) do-md5sum \
106		TOOL=$(TOOL) PACKAGE="$(PACKAGE)" VER="$(VER)" \
107		MD5PROG="$(MD5PROG)" \
108		SUPPORT_FILES="$(SUPPORT_FILES)"
109	$(MAKE) -f $(SELF) do-djunpack \
110		TOOL=$(TOOL) PACKAGE="$(PACKAGE)" VER="$(VER)" \
111		MD5PROG="$(MD5PROG)" \
112		SUPPORT_FILES="$(SUPPORT_FILES)"
113	$(MAKE) -f $(SELF) do-tar \
114		TOOL=$(TOOL) PACKAGE="$(PACKAGE)" VER="$(VER)" \
115		MD5PROG="$(MD5PROG)" \
116		SUPPORT_FILES="$(SUPPORT_FILES)"
117
118.PHONY: gdb-taz
119gdb-taz: gdb-tar $(DEVO_SUPPORT) $(SUPPORT_FILES) texinfo/texinfo.tex
120	$(MAKE) -f $(SELF) gdb-tar \
121		TOOL=$(TOOL) PACKAGE="$(PACKAGE)" VER="$(VER)" \
122		MD5PROG="$(MD5PROG)" \
123		SUPPORT_FILES="$(SUPPORT_FILES)"
124	$(MAKE) -f $(SELF) do-bz2 \
125		TOOL=$(TOOL) PACKAGE="$(PACKAGE)" VER="$(VER)" \
126		MD5PROG="$(MD5PROG)" \
127		SUPPORT_FILES="$(SUPPORT_FILES)"
128
129.PHONY: do-proto-toplev
130do-proto-toplev: $(DEVO_SUPPORT) $(SUPPORT_FILES) texinfo/texinfo.tex
131	echo "==> Making $(PACKAGE)-$(VER)/"
132	# Take out texinfo from a few places.
133	sed -e '/^all\.normal: /s/\all-texinfo //' \
134	    -e '/^	install-texinfo /d' \
135	<Makefile.in >tmp
136	mv -f tmp Makefile.in
137	#
138	./configure i686-pc-linux-gnu
139	$(MAKE) configure-host configure-target \
140	    ALL_GCC="" ALL_GCC_C="" ALL_GCC_CXX="" \
141	    CC_FOR_TARGET="$(CC)" CXX_FOR_TARGET="$(CXX)"
142	# Make links, and run "make diststuff" or "make info" when needed.
143	rm -rf proto-toplev ; mkdir proto-toplev
144	set -e ; dirs="$(TOOL) $(DEVO_SUPPORT) $(SUPPORT_FILES)" ; \
145	for d in $$dirs ; do \
146	  if [ -d $$d ]; then \
147	    if [ ! -f $$d/Makefile ] ; then true ; \
148	    elif grep '^diststuff:' $$d/Makefile >/dev/null ; then \
149		(cd $$d ; $(MAKE) diststuff ) || exit 1 ; \
150	    elif grep '^info:' $$d/Makefile >/dev/null ; then \
151	        (cd $$d ; $(MAKE) info ) || exit 1 ; \
152	    fi ; \
153	    if [ -d $$d/proto-$$d.dir ]; then \
154	      ln -s ../$$d/proto-$$d.dir proto-toplev/$$d ; \
155	    else \
156	      ln -s ../$$d proto-toplev/$$d ; \
157	    fi ; \
158	  else ln -s ../$$d proto-toplev/$$d ; fi ; \
159	done
160	cd etc && $(MAKE) info
161	$(MAKE) distclean
162	# Kludge for pr gdb/708.  'configure' configures in
163	# dejagnu/example/calc, but 'make distclean' does not clean in
164	# dejagnu/example.  Someday somebody might fix this in dejagnu,
165	# and then import a new dejagnu into sourceware.  Right now, a
166	# couple of 'rm' commands will get the gdb snapshots working
167	# again.  -- chastain 2003-08-15
168	rm -f dejagnu/example/calc/config.status
169	rm -f dejagnu/example/calc/config.log
170	# Kludge for pr gdb/857.  intl/Makefile.in lacks a couple
171	# of files in the distclean rule.  Zack W is planning to make
172	# the gcc version of intl/ the master version and then push
173	# that version to src soon.  See:
174	#   http://sources.redhat.com/ml/binutils/2003-07/msg00032.html
175	# After the src version of intl/ is upgraded, we can look at
176	# moving this logic into intl/Makefile.in distclean rule
177	# if it is still needed.  -- chastain 2003-09-12
178	rm -f intl/config.cache
179	rm -f intl/config.status
180	rm -f intl/config.h
181	rm -f intl/stamp-h
182	#
183	mkdir proto-toplev/etc
184	(cd proto-toplev/etc; \
185	 for i in $(ETC_SUPPORT); do \
186		ln -s ../../etc/$$i . ; \
187	 done)
188	#
189	# Take out texinfo from configurable dirs
190	rm proto-toplev/configure.in
191	sed -e '/^host_tools=/s/texinfo //' \
192	    <configure.in >proto-toplev/configure.in
193	#
194	mkdir proto-toplev/texinfo
195	ln -s ../../texinfo/texinfo.tex		proto-toplev/texinfo/
196	if test -r texinfo/util/tex3patch ; then \
197	  mkdir proto-toplev/texinfo/util && \
198	  ln -s ../../../texinfo/util/tex3patch	proto-toplev/texinfo/util ; \
199	else true; fi
200	chmod -R og=u . || chmod og=u `find . -print`
201	#
202	# Create .gmo files from .po files.
203	for f in `find . -name '*.po' -type f -print`; do \
204	     msgfmt -o `echo $$f | sed -e 's/\.po$$/.gmo/'` $$f ; \
205	done
206	#
207	-rm -f $(PACKAGE)-$(VER)
208	ln -s proto-toplev $(PACKAGE)-$(VER)
209
210CVS_NAMES= \( -name CVS -o -name '.cvsignore' \)
211
212.PHONY: do-tar
213do-tar:
214	echo "==> Making $(PACKAGE)-$(VER).tar"
215	-rm -f $(PACKAGE)-$(VER).tar
216	find $(PACKAGE)-$(VER) -follow $(CVS_NAMES) -prune \
217			-o -type f -print \
218		| tar cTfh - $(PACKAGE)-$(VER).tar
219
220.PHONY: do-bz2
221do-bz2:
222	echo "==> Bzipping $(PACKAGE)-$(VER).tar.bz2"
223	-rm -f $(PACKAGE)-$(VER).tar.bz2
224	$(BZIPPROG) -v -9 $(PACKAGE)-$(VER).tar
225
226.PHONY: do-md5sum
227do-md5sum:
228	echo "==> Adding md5 checksum to top-level directory"
229	cd proto-toplev && find * -follow $(CVS_NAMES) -prune \
230			-o -type f -print \
231		| xargs $(MD5PROG) > ../md5.sum
232	mv md5.sum proto-toplev
233
234.PHONY: do-djunpack
235do-djunpack:
236	echo "==> Adding updated djunpack.bat to top-level directory"
237	echo - 's /gdb-[0-9\.]*/$(PACKAGE)-'"$(VER)"'/'
238	sed < djunpack.bat > djunpack.new \
239		-e 's/gdb-[0-9][0-9\.]*/$(PACKAGE)-'"$(VER)"'/'
240	mv djunpack.new djunpack.bat
241	-rm -f proto-toplev/djunpack.bat
242	ln -s ../djunpack.bat proto-toplev/djunpack.bat
243
244TEXINFO_SUPPORT= texinfo/texinfo.tex
245DIST_SUPPORT= $(DEVO_SUPPORT) $(TEXINFO_SUPPORT)
246
247.PHONY: gas.tar.bz2
248GAS_SUPPORT_DIRS= bfd include libiberty opcodes intl setup.com makefile.vms mkdep
249gas.tar.bz2: $(DIST_SUPPORT) $(GAS_SUPPORT_DIRS) gas
250	$(MAKE) -f $(SELF) taz TOOL=gas \
251		MD5PROG="$(MD5PROG)" \
252		SUPPORT_FILES="$(GAS_SUPPORT_DIRS)"
253
254# The FSF "binutils" release includes gprof and ld.
255.PHONY: binutils.tar.bz2
256BINUTILS_SUPPORT_DIRS= bfd gas include libiberty opcodes ld gprof intl setup.com makefile.vms mkdep cpu
257binutils.tar.bz2: $(DIST_SUPPORT) $(BINUTILS_SUPPORT_DIRS) binutils
258	$(MAKE) -f $(SELF) taz TOOL=binutils \
259		MD5PROG="$(MD5PROG)" \
260		SUPPORT_FILES="$(BINUTILS_SUPPORT_DIRS)"
261
262.PHONY: gas+binutils.tar.bz2
263GASB_SUPPORT_DIRS= $(GAS_SUPPORT_DIRS) binutils ld gprof
264gas+binutils.tar.bz2: $(DIST_SUPPORT) $(GASB_SUPPORT_DIRS) gas
265	$(MAKE) -f $(SELF) taz TOOL=gas \
266		MD5PROG="$(MD5PROG)" \
267		SUPPORT_FILES="$(GASB_SUPPORT_DIRS)"
268
269GNATS_SUPPORT_DIRS=include libiberty send-pr
270gnats.tar.bz2: $(DIST_SUPPORT) $(GNATS_SUPPORT_DIRS) gnats
271	$(MAKE) -f  $(SELF) taz TOOL=gnats \
272		MD5PROG="$(MD5PROG)" \
273		SUPPORT_FILES="$(GNATS_SUPPORT_DIRS)"
274
275.PHONY: gdb.tar.bz2
276GDB_SUPPORT_DIRS= bfd include libiberty mmalloc opcodes readline sim utils intl
277gdb.tar.bz2: $(DIST_SUPPORT) $(GDB_SUPPORT_DIRS) gdb
278	$(MAKE) -f $(SELF) gdb-taz TOOL=gdb \
279		MD5PROG="$(MD5PROG)" \
280		SUPPORT_FILES="$(GDB_SUPPORT_DIRS)"
281.PHONY: gdb.tar
282gdb.tar: $(DIST_SUPPORT) $(GDB_SUPPORT_DIRS) gdb
283	$(MAKE) -f $(SELF) gdb-tar TOOL=gdb \
284		MD5PROG="$(MD5PROG)" \
285		SUPPORT_FILES="$(GDB_SUPPORT_DIRS)"
286
287DEJAGNU_SUPPORT_DIRS=  tcl expect libiberty
288.PHONY: dejagnu.tar.bz2
289dejagnu.tar.bz2: $(DIST_SUPPORT) $(DEJAGNU_SUPPORT_DIRS) dejagnu
290	$(MAKE) -f $(SELF) gdb-taz TOOL=dejagnu \
291		MD5PROG="$(MD5PROG)" \
292		SUPPORT_FILES="$(DEJAGNU_SUPPORT_DIRS)"
293.PHONY: dejagnu.tar
294dejagnu.tar: $(DIST_SUPPORT) $(DEJAGNU_SUPPORT_DIRS) dejagnu
295	$(MAKE) -f $(SELF) gdb-tar TOOL=dejagnu \
296		MD5PROG="$(MD5PROG)" \
297		SUPPORT_FILES="$(DEJAGNU_SUPPORT_DIRS)"
298
299.PHONY: gdb+dejagnu.tar.bz2
300GDBD_SUPPORT_DIRS= $(GDB_SUPPORT_DIRS) tcl expect dejagnu
301gdb+dejagnu.tar.bz2: $(DIST_SUPPORT) $(GDBD_SUPPORT_DIRS) gdb
302	$(MAKE) -f $(SELF) gdb-taz TOOL=gdb PACKAGE=gdb+dejagnu \
303		MD5PROG="$(MD5PROG)" \
304		SUPPORT_FILES="$(GDBD_SUPPORT_DIRS)"
305.PHONY: gdb+dejagnu.tar
306gdb+dejagnu.tar: $(DIST_SUPPORT) $(GDBD_SUPPORT_DIRS) gdb
307	$(MAKE) -f $(SELF) gdb-tar TOOL=gdb PACKAGE=gdb+dejagnu \
308		MD5PROG="$(MD5PROG)" \
309		SUPPORT_FILES="$(GDBD_SUPPORT_DIRS)"
310
311.PHONY: insight.tar.bz2
312INSIGHT_SUPPORT_DIRS= $(GDB_SUPPORT_DIRS) tcl tk itcl tix libgui
313insight.tar.bz2: $(DIST_SUPPORT) $(GDB_SUPPORT_DIRS) gdb
314	$(MAKE) -f $(SELF) gdb-taz TOOL=gdb PACKAGE=insight \
315		MD5PROG="$(MD5PROG)" \
316		SUPPORT_FILES="$(INSIGHT_SUPPORT_DIRS)"
317.PHONY: insight.tar
318insight.tar: $(DIST_SUPPORT) $(GDB_SUPPORT_DIRS) gdb
319	$(MAKE) -f $(SELF) gdb-tar TOOL=gdb PACKAGE=insight \
320		MD5PROG="$(MD5PROG)" \
321		SUPPORT_FILES="$(INSIGHT_SUPPORT_DIRS)"
322
323.PHONY: insight+dejagnu.tar.bz2
324INSIGHTD_SUPPORT_DIRS= $(INSIGHT_SUPPORT_DIRS) expect dejagnu
325insight+dejagnu.tar.bz2: $(DIST_SUPPORT) $(INSIGHTD_SUPPORT_DIRS) gdb
326	$(MAKE) -f $(SELF) gdb-taz TOOL=gdb PACKAGE="insight+dejagnu" \
327		MD5PROG="$(MD5PROG)" \
328		SUPPORT_FILES="$(INSIGHTD_SUPPORT_DIRS)"
329.PHONY: insight+dejagnu.tar
330insight+dejagnu.tar: $(DIST_SUPPORT) $(INSIGHTD_SUPPORT_DIRS) gdb
331	$(MAKE) -f $(SELF) gdb-tar TOOL=gdb PACKAGE="insight+dejagnu" \
332		MD5PROG="$(MD5PROG)" \
333		SUPPORT_FILES="$(INSIGHTD_SUPPORT_DIRS)"
334
335.NOEXPORT:
336MAKEOVERRIDES=
337