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