*** empty log message ***
[platform/upstream/binutils.git] / Makefile.in
1 #
2 # Makefile for directory with subdirs to build.
3 #   Copyright (C) 1990, 1991 Cygnus Support
4 #
5 # This file is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
18 #
19 # Last Mod Tue Nov 5 12:18:34 PST 1991, by rich@rtl.cygnus.com
20 #
21 # $Id$
22
23 srcdir = .
24
25 idestdir = /usr/local
26 ddestdir = $(idestdir)
27
28 SHELL=/bin/sh
29
30 RANLIB = ranlib
31 AR = ar
32 AR_FLAGS = cq
33
34 BISON = `if [ -d $(unsubdir)/../bison ] ; \
35         then echo \`pwd\`/$(unsubdir)/../bison$(subdir)/bison -L \`pwd\`/$(unsubdir)/../bison$(subdir)/ ; \
36         else echo yacc ; fi`
37
38 SUBDIRS = libiberty readline bfd gdb binutils ld gas gcc gnulib clib
39 OTHERS = 
40
41 ALL = all.normal
42
43 #### host and target specific makefile fragments come in here.
44 ###
45
46 all:    $(ALL)
47
48 all.normal:
49         $(MAKE) subdir_do DO=all "DODIRS=$(SUBDIRS) $(OTHERS)"
50
51 # this is a bad hack.
52 all.xclib:      all.normal
53         if [ -d clib ] ; then \
54                 (cd clib ; $(MAKE)) ; \
55         fi
56
57 subdir_do: force
58         for i in $(DODIRS); do \
59                 if [ -f $(unsubdir)/$$i/localenv -o -f $(unsubdir)/$$i.$(target)/localenv ] ; then \
60                         if (cd $(unsubdir)/$$i`if [ -d $(unsubdir)/$$i.$(target) ] ; \
61                                 then echo .$(target) ; fi`$(subdir); \
62                                 $(MAKE) \
63                                         "against=$(against)" \
64                                         "BISON=$(BISON)" $(DO)) ; then true ; \
65                                 else exit 1 ; fi ; \
66                 else if [ -d $(unsubdir)/$$i -o -d $(unsubdir)/$$i.$(target) ] ; then \
67                         if (cd $(unsubdir)/$$i`if [ -d $(unsubdir)/$$i.$(target) ] ; \
68                                 then echo .$(target) ; fi`$(subdir); \
69                                 $(MAKE) \
70                                         "against=$(against)" \
71                                         "AR=$(AR)" \
72                                         "CC=$(CC)" \
73                                         "AR_FLAGS=$(AR_FLAGS)" \
74                                         "RANLIB=$(RANLIB)" \
75                                         "LOADLIBES=$(LOADLIBES)" \
76                                         "LDFLAGS=$(LDFLAGS)" \
77                                         "BISON=$(BISON)" $(DO)) ; then true ; \
78                         else exit 1 ; fi ; \
79                 else true ; fi ; \
80         fi ; \
81         done
82
83
84
85 bootstrap:
86         $(MAKE) all
87         $(MAKE) stage1
88         $(MAKE) pass "stagepass=stage1"
89         $(MAKE) stage2
90         $(MAKE) pass "stagepass=stage2"
91         $(MAKE) comparison
92
93 bootstrap2:
94         $(MAKE) pass "stagepass=stage1"
95         $(MAKE) stage2
96         $(MAKE) pass "stagepass=stage2"
97         $(MAKE) comparison
98
99 bootstrap3:
100         $(MAKE) pass "stagepass=stage2"
101         $(MAKE) comparison
102
103 pass:
104         cp $(srcdir)/gcc/gstdarg.h $(unsubdir)/gas$(subdir)/stdarg.h
105         $(MAKE) subdir_do DO=all "DODIRS=$(SUBDIRS)" \
106                 "CC=`pwd`/$(unsubdir)/gcc`if [ -d $(unsubdir)/gcc.$(target) ] ; \
107                 then echo .$(target) ; fi`$(subdir)/$(stagepass)/gcc \
108                 -O \
109                 -B`pwd`/$(unsubdir)/gcc`if [ -d $(unsubdir)/gcc.$(target) ] ; \
110                 then echo .$(target) ; fi`$(subdir)/$(stagepass)/ \
111                 -B`pwd`/$(unsubdir)/gas`if [ -d $(unsubdir)/gas.$(target) ] ; \
112                 then echo .$(target) ; fi`$(subdir)/$(stagepass)/ \
113                 -B`pwd`/$(unsubdir)/ld`if [ -d $(unsubdir)/ld.$(target) ] ; \
114                 then echo .$(target) ; fi`$(subdir)/$(stagepass)/" \
115                 "AR=`pwd`/$(unsubdir)/binutils`if [ -d $(unsubdir)/binutils.$(target) ] ; \
116                 then echo .$(target) ; fi`$(subdir)/$(stagepass)/ar" \
117                 "RANLIB=`pwd`/$(unsubdir)/binutils`if [ -d $(unsubdir)/binutils.$(target) ] ; \
118                 then echo .$(target) ; fi`$(subdir)/$(stagepass)/ranlib" \
119                 "LOADLIBES=`pwd`/$(unsubdir)/gnulib`if [ -d $(unsubdir)/binutils.$(target) ] ; \
120                 then echo .$(target) ; fi`$(subdir)/$(stagepass)/gnulib.a /lib/libc.a" \
121                 "LDFLAGS=-nostdlib /lib/crt0.o \
122                 -L`pwd`/$(unsubdir)/gnulib`if [ -d $(unsubdir)/gnulib.$(target) ] ; \
123                 then echo .$(target) ; fi`$(subdir)/$(stagepass)/ \
124                 -B`pwd`/$(unsubdir)/ld`if [ -d $(unsubdir)/ld.$(target) ] ; \
125                 then echo .$(target) ; fi`$(subdir)/$(stagepass)/"
126
127
128 stage1:
129         $(MAKE) subdir_do DO=stage1 "DODIRS=$(SUBDIRS)"
130
131 stage2:
132         $(MAKE) subdir_do DO=stage2 "DODIRS=$(SUBDIRS)"
133
134 stage3:
135         $(MAKE) subdir_do DO=stage3 "DODIRS=$(SUBDIRS)"
136
137 stage4:
138         $(MAKE) subdir_do DO=stage4 "DODIRS=$(SUBDIRS)"
139
140 against=stage2
141
142 comparison:; $(MAKE) subdir_do DO=comparison against=$(against) "DODIRS=$(SUBDIRS)"
143
144 de-stage1:; $(MAKE) subdir_do DO=de-stage1 "DODIRS=$(SUBDIRS)"
145 de-stage2:; $(MAKE) subdir_do DO=de-stage2 "DODIRS=$(SUBDIRS)"
146 de-stage3:; $(MAKE) subdir_do DO=de-stage3 "DODIRS=$(SUBDIRS)"
147 de-stage4:; $(MAKE) subdir_do DO=de-stage4 "DODIRS=$(SUBDIRS)"
148
149 clean:
150         rm -rf *.a TEMP errs core *.o *~ \#* TAGS *.E
151         $(MAKE) subdir_do DO=clean "DODIRS=$(SUBDIRS) $(OTHERS)"
152
153 install: install-dirs install-fixed-includes
154         $(MAKE) subdir_do DO=install "DODIRS=$(SUBDIRS) $(OTHERS)"
155
156 # The "else true" stuff is for Ultrix; the shell returns the exit code
157 # of the "if" command, if no commands are run in the "then" or "else" part,
158 # causing Make to quit.
159 install-dirs: force
160         - mkdir $(ddestdir)
161         - mkdir $(ddestdir)/include
162         - mkdir $(ddestdir)/lib
163         - mkdir $(ddestdir)/lib/emacs
164         - mkdir $(ddestdir)/bin
165         - mkdir $(ddestdir)/lib
166         - mkdir $(ddestdir)
167         - mkdir $(ddestdir)/bin
168         - mkdir $(ddestdir)/lib
169         - mkdir $(idestdir)
170         - mkdir $(idestdir)include
171         - mkdir $(idestdir)/doc
172         - mkdir $(idestdir)/man
173         - mkdir $(idestdir)/man/man1
174         - mkdir $(idestdir)/man/man2
175         - mkdir $(idestdir)/man/man3
176         - mkdir $(idestdir)/man/man4
177         - mkdir $(idestdir)/man/man5
178         - mkdir $(idestdir)/man/man6
179         - mkdir $(idestdir)/man/man7
180         - mkdir $(idestdir)/man/man8
181         if [ -d $(unsubdir)/gcc`if [ -d $(unsubdir)/gcc.$(target) ] ; \
182                 then echo .$(target) ; fi`$(subdir) ] ; then \
183                 (cd  $(unsubdir)/gcc`if [ -d $(unsubdir)/gcc.$(target) ] ; \
184                         then echo .$(target) ; fi`$(subdir) ; \
185                                 $(MAKE) install-dir) ; \
186         else true; \
187         fi
188
189 install-fixed-includes: force
190         if [ -d $(unsubdir)/gcc`if [ -d $(unsubdir)/gcc.$(target) ] ; \
191                 then echo .$(target) ; fi`$(subdir) ] ; then \
192                 (cd  $(unsubdir)/gcc`if [ -d $(unsubdir)/gcc.$(target) ] ; \
193                         then echo .$(target) ; fi`$(subdir) ; \
194                                 $(MAKE) install-fixed-includes) ; \
195         else true; \
196         fi
197
198 etags tags: TAGS
199
200 TAGS: FORCE
201         etags `$(MAKE) ls`
202
203 ls:
204         @echo Makefile
205         @for i in $(SUBDIRS); \
206         do \
207                 (cd $$i; \
208                         pwd=`pwd`; \
209                         wd=`basename $$pwd`; \
210                         for j in `$(MAKE) ls`; \
211                         do \
212                                 echo $$wd/$$j; \
213                         done) \
214         done
215
216 force:
217
218 # with the gnu make, this is done automatically.
219
220 Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
221         $(SHELL) ./config.status
222
223 #
224 # Build GDB distributions that contain BFD, Include, Libiberty, Readline, etc
225
226 DEVO_SUPPORT= README README.configure Makefile.in configure configure.in \
227         config.sub config
228 GDB_SUPPORT_DIRS= bfd include libiberty readline
229 GDB_SUPPORT_FILES= $(GDB_SUPPORT_DIRS) texinfo/fsf/texinfo.tex
230
231 setup-dirs: force_update
232         ./configure sun4
233         make clean
234         ./configure -rm sun4
235         chmod og=u `find $(DEVO_SUPPORT) $(GDB_SUPPORT_FILES) -print`
236
237 bfd.ilrt.tar.Z: setup-dirs
238         rm -f bfd.ilrt.tar.Z
239         tar cf - $(DEVO_SUPPORT) $(GDB_SUPPORT_FILES) \
240                 | compress -v >bfd.ilrt.tar.Z
241
242 gdb.tar.Z: setup-dirs
243         (cd gdb; $(MAKE) -f Makefile.in make-proto-gdb.dir)
244         $(MAKE) $(MFLAGS) -f Makefile.in make-gdb.tar.Z
245
246 make-gdb.tar.Z: $(DEVO_SUPPORT) $(GDB_SUPPORT_DIRS) gdb texinfo/fsf/texinfo.tex
247         rm -rf proto-toplev; mkdir proto-toplev
248         ln -s ../gdb/proto-gdb.dir proto-toplev/gdb
249         (cd proto-toplev; for i in $(DEVO_SUPPORT) $(GDB_SUPPORT_DIRS); do \
250                 ln -s ../$$i . ; \
251         done)
252         mkdir proto-toplev/texinfo
253         mkdir proto-toplev/texinfo/fsf
254         ln -s ../../../texinfo/fsf/texinfo.tex proto-toplev/texinfo/fsf/
255         chmod og=u `find proto-toplev -print`
256         (VER=`sed <gdb/Makefile.in -n 's/VERSION = //p'`; \
257                 echo "==> Making gdb-$$VER.tar.Z"; \
258                 ln -s proto-toplev gdb-$$VER; \
259                 tar cfh - gdb-$$VER \
260                 | compress -v >gdb-$$VER.tar.Z)
261
262 force_update:
263
264 # end of Makefile.in