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