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