add GCCVERBOSE flag for debugging
[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 Mon Nov 11 01:53:12 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 #\`(cd $(srcdir)/bison ; \\`pwd\\`)\`
39 SUBDIRS = libiberty readline bfd gdb binutils ld gas gcc gnulib clib
40 OTHERS = 
41
42 ALL = all.normal
43 INSTALL_HEADERS = install-headers
44 INSTALL_FIXED_INCLUDES = install-fixed-includes
45
46 ### for debugging
47 #GCCVERBOSE=-v
48
49 #### host and target specific makefile fragments come in here.
50 ###
51
52 all:    $(ALL)
53
54 all.normal:
55         $(MAKE) subdir_do DO=all "DODIRS=$(SUBDIRS) $(OTHERS)"
56
57 # this is a bad hack.
58 all.xclib:      all.normal
59         if [ -d clib ] ; then \
60                 (cd clib ; $(MAKE)) ; \
61         fi
62
63 subdir_do: force
64         for i in $(DODIRS); do \
65                 if [ -f $(unsubdir)/$$i/localenv ] ; then \
66                         if (cd $(unsubdir)/$$i$(subdir); \
67                                 $(MAKE) \
68                                         "against=$(against)" \
69                                         "BISON=$(BISON)" $(DO)) ; then true ; \
70                                 else exit 1 ; fi ; \
71                 else if [ -d $(unsubdir)/$$i ] ; then \
72                         if (cd $(unsubdir)/$$i$(subdir); \
73                                 $(MAKE) \
74                                         "against=$(against)" \
75                                         "AR=$(AR)" \
76                                         "CC=$(CC)" \
77                                         "AR_FLAGS=$(AR_FLAGS)" \
78                                         "RANLIB=$(RANLIB)" \
79                                         "LOADLIBES=$(LOADLIBES)" \
80                                         "LDFLAGS=$(LDFLAGS)" \
81                                         "BISON=$(BISON)" $(DO)) ; then true ; \
82                         else exit 1 ; fi ; \
83                 else true ; fi ; \
84         fi ; \
85         done
86
87
88
89 bootstrap:
90         $(MAKE) all
91         $(MAKE) stage1
92         $(MAKE) pass "stagepass=stage1"
93         $(MAKE) stage2
94         $(MAKE) pass "stagepass=stage2"
95         $(MAKE) comparison
96
97 bootstrap2:
98         $(MAKE) pass "stagepass=stage1"
99         $(MAKE) stage2
100         $(MAKE) pass "stagepass=stage2"
101         $(MAKE) comparison
102
103 bootstrap3:
104         $(MAKE) pass "stagepass=stage2"
105         $(MAKE) comparison
106
107 pass:
108         cp $(srcdir)/gcc/gstdarg.h $(unsubdir)/gas$(subdir)/stdarg.h
109         $(MAKE) subdir_do DO=all "DODIRS=$(SUBDIRS)" \
110                 "CC=`pwd`/$(unsubdir)/gcc$(subdir)/$(stagepass)/gcc \
111                 -O $(GCCVERBOSE) \
112                 -B`pwd`/$(unsubdir)/gcc$(subdir)/$(stagepass)/ \
113                 -B`pwd`/$(unsubdir)/gas$(subdir)/$(stagepass)/ \
114                 -B`pwd`/$(unsubdir)/ld$(subdir)/$(stagepass)/" \
115                 "AR=`pwd`/$(unsubdir)/binutils$(subdir)/$(stagepass)/ar" \
116                 "LD=`pwd`/$(unsubdir)/ld$(subdir)/$(stagepass)/ld $(GCCVERBOSE)" \
117                 "RANLIB=`pwd`/$(unsubdir)/binutils$(subdir)/$(stagepass)/ranlib" \
118                 "LOADLIBES=`pwd`/$(unsubdir)/gnulib$(subdir)/$(stagepass)/gnulib.a /lib/libc.a" \
119                 "LDFLAGS=-nostdlib /lib/crt0.o \
120                 -L`pwd`/$(unsubdir)/gnulib$(subdir)/$(stagepass)/ \
121                 -B`pwd`/$(unsubdir)/ld$(subdir)/$(stagepass)/"
122
123
124 stage1:
125         $(MAKE) subdir_do DO=stage1 "DODIRS=$(SUBDIRS)"
126
127 stage2:
128         $(MAKE) subdir_do DO=stage2 "DODIRS=$(SUBDIRS)"
129
130 stage3:
131         $(MAKE) subdir_do DO=stage3 "DODIRS=$(SUBDIRS)"
132
133 stage4:
134         $(MAKE) subdir_do DO=stage4 "DODIRS=$(SUBDIRS)"
135
136 against=stage2
137
138 comparison:; $(MAKE) subdir_do DO=comparison against=$(against) "DODIRS=$(SUBDIRS)"
139
140 de-stage1:; $(MAKE) subdir_do DO=de-stage1 "DODIRS=$(SUBDIRS)"
141 de-stage2:; $(MAKE) subdir_do DO=de-stage2 "DODIRS=$(SUBDIRS)"
142 de-stage3:; $(MAKE) subdir_do DO=de-stage3 "DODIRS=$(SUBDIRS)"
143 de-stage4:; $(MAKE) subdir_do DO=de-stage4 "DODIRS=$(SUBDIRS)"
144
145 clean:
146         rm -rf *.a TEMP errs core *.o *~ \#* TAGS *.E
147         $(MAKE) subdir_do DO=clean "DODIRS=$(SUBDIRS) $(OTHERS)"
148
149 install: install-no-fixincludes $(INSTALL_FIXED_INCLUDES)
150
151 install-no-fixincludes: install-dirs $(INSTALL_HEADERS)
152         $(MAKE) subdir_do DO=install "DODIRS=$(SUBDIRS) $(OTHERS)"
153
154 # The "else true" stuff is for Ultrix; the shell returns the exit code
155 # of the "if" command, if no commands are run in the "then" or "else" part,
156 # causing Make to quit.
157
158 MAKEDIRS= \
159         $(ddestdir) \
160         $(ddestdir)/bin \
161         $(ddestdir)/include \
162         $(ddestdir)/lib \
163         $(ddestdir)/lib/emacs \
164         $(idestdir) \
165         $(idestdir)/lib \
166         $(idestdir)/doc \
167         $(idestdir)/man \
168         $(idestdir)/man/man1 \
169         $(idestdir)/man/man5
170
171 install-dirs: force
172         for i in $(MAKEDIRS) ; do \
173                 if [ -d $$i ] ; then true ; else mkdir $$i ; fi ; \
174         done
175
176 install-headers:
177         if [ -d $(unsubdir)/gcc$(subdir) ] ; then \
178                 (cd  $(unsubdir)/gcc$(subdir) ; \
179                                 $(MAKE) install-dir) ; \
180         else true; \
181         fi
182
183 install-fixed-includes: force
184         if [ -d $(unsubdir)/gcc$(subdir) ] ; then \
185                 (cd  $(unsubdir)/gcc$(subdir) ; \
186                                 $(MAKE) install-fixed-includes) ; \
187         else true; \
188         fi
189
190 etags tags: TAGS
191
192 TAGS: FORCE
193         etags `$(MAKE) ls`
194
195 ls:
196         @echo Makefile
197         @for i in $(SUBDIRS); \
198         do \
199                 (cd $$i; \
200                         pwd=`pwd`; \
201                         wd=`basename $$pwd`; \
202                         for j in `$(MAKE) ls`; \
203                         do \
204                                 echo $$wd/$$j; \
205                         done) \
206         done
207
208 force:
209
210 # with the gnu make, this is done automatically.
211
212 Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
213         $(SHELL) ./config.status
214
215 #
216 # Build GDB distributions that contain BFD, Include, Libiberty, Readline, etc
217
218 DEVO_SUPPORT= README README.configure Makefile.in configure configure.in \
219         config.sub config
220 GDB_SUPPORT_DIRS= bfd include libiberty readline
221 GDB_SUPPORT_FILES= $(GDB_SUPPORT_DIRS) texinfo/fsf/texinfo.tex
222
223 setup-dirs: force_update
224         ./configure sun4
225         make clean
226         ./configure -rm sun4
227         chmod og=u `find $(DEVO_SUPPORT) $(GDB_SUPPORT_FILES) -print`
228
229 bfd.ilrt.tar.Z: setup-dirs
230         rm -f bfd.ilrt.tar.Z
231         tar cf - $(DEVO_SUPPORT) $(GDB_SUPPORT_FILES) \
232                 | compress -v >bfd.ilrt.tar.Z
233
234 gdb.tar.Z: setup-dirs
235         (cd gdb; $(MAKE) -f Makefile.in make-proto-gdb.dir)
236         $(MAKE) $(MFLAGS) -f Makefile.in make-gdb.tar.Z
237
238 make-gdb.tar.Z: $(DEVO_SUPPORT) $(GDB_SUPPORT_DIRS) gdb texinfo/fsf/texinfo.tex
239         rm -rf proto-toplev; mkdir proto-toplev
240         ln -s ../gdb/proto-gdb.dir proto-toplev/gdb
241         (cd proto-toplev; for i in $(DEVO_SUPPORT) $(GDB_SUPPORT_DIRS); do \
242                 ln -s ../$$i . ; \
243         done)
244         mkdir proto-toplev/texinfo
245         mkdir proto-toplev/texinfo/fsf
246         ln -s ../../../texinfo/fsf/texinfo.tex proto-toplev/texinfo/fsf/
247         chmod og=u `find proto-toplev -print`
248         (VER=`sed <gdb/Makefile.in -n 's/VERSION = //p'`; \
249                 echo "==> Making gdb-$$VER.tar.Z"; \
250                 ln -s proto-toplev gdb-$$VER; \
251                 tar cfh - gdb-$$VER \
252                 | compress -v >gdb-$$VER.tar.Z)
253
254 force_update:
255
256 nothing:
257
258 # end of Makefile.in