2 # Makefile for directory with subdirs to build.
3 # Copyright (C) 1990, 1991 Cygnus Support
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.
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.
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. */
32 BISON = `if [ -d $(unsubdir)/../bison ] ; \
33 then echo \`pwd\`/$(unsubdir)/../bison$(subdir)/bison -L \`pwd\`/$(unsubdir)/../bison/ ; \
36 SUBDIRS = libiberty readline bfd gdb binutils ld gas gcc gnulib
41 #### host and target specific makefile fragments come in here.
47 $(MAKE) subdir_do DO=all "DODIRS=$(SUBDIRS) $(OTHERS)"
51 if [ -d clib ] ; then \
52 (cd clib ; $(MAKE)) ; \
56 for i in $(DODIRS); do \
57 if [ -f $(unsubdir)/$$i/localenv -o -f $(unsubdir)/$$i.$(target)/localenv ] ; then \
58 if (cd $(unsubdir)/$$i`if [ -d $(unsubdir)/$$i.$(target) ] ; \
59 then echo .$(target) ; fi`$(subdir); \
61 "against=$(against)" \
62 "BISON=$(BISON)" $(DO)) ; then true ; \
64 else if [ -d $(unsubdir)/$$i -o -d $(unsubdir)/$$i.$(target) ] ; then \
65 if (cd $(unsubdir)/$$i`if [ -d $(unsubdir)/$$i.$(target) ] ; \
66 then echo .$(target) ; fi`$(subdir); \
68 "against=$(against)" \
71 "AR_FLAGS=$(AR_FLAGS)" \
73 "LOADLIBES=$(LOADLIBES)" \
74 "LDFLAGS=$(LDFLAGS)" \
75 "BISON=$(BISON)" $(DO)) ; then true ; \
86 $(MAKE) pass "stagepass=stage1"
88 $(MAKE) pass "stagepass=stage2"
92 $(MAKE) pass "stagepass=stage1"
94 $(MAKE) pass "stagepass=stage2"
98 $(MAKE) pass "stagepass=stage2"
102 cp $(unsubdir)/gcc`if [ -d $(unsubdir)/gcc.$(target) ] ; \
103 then echo .$(target) ; fi`/gstdarg.h $(unsubdir)/gas/stdarg.h
104 $(MAKE) subdir_do DO=all "DODIRS=$(SUBDIRS)" \
105 "CC=`pwd`/$(unsubdir)/gcc`if [ -d $(unsubdir)/gcc.$(target) ] ; \
106 then echo .$(target) ; fi`$(subdir)/$(stagepass)/gcc \
108 -B`pwd`/$(unsubdir)/gcc`if [ -d $(unsubdir)/gcc.$(target) ] ; \
109 then echo .$(target) ; fi`$(subdir)/$(stagepass)/ \
110 -B`pwd`/$(unsubdir)/gas`if [ -d $(unsubdir)/gas.$(target) ] ; \
111 then echo .$(target) ; fi`$(subdir)/$(stagepass)/ \
112 -B`pwd`/$(unsubdir)/ld`if [ -d $(unsubdir)/ld.$(target) ] ; \
113 then echo .$(target) ; fi`$(subdir)/$(stagepass)/" \
114 "AR=`pwd`/$(unsubdir)/binutils`if [ -d $(unsubdir)/binutils.$(target) ] ; \
115 then echo .$(target) ; fi`$(subdir)/$(stagepass)/ar" \
116 "RANLIB=`pwd`/$(unsubdir)/binutils`if [ -d $(unsubdir)/binutils.$(target) ] ; \
117 then echo .$(target) ; fi`$(subdir)/$(stagepass)/ranlib" \
118 "LOADLIBES=`pwd`/$(unsubdir)/gnulib`if [ -d $(unsubdir)/binutils.$(target) ] ; \
119 then echo .$(target) ; fi`$(subdir)/$(stagepass)/gnulib.a /lib/libc.a" \
120 "LDFLAGS=-nostdlib /lib/crt0.o \
121 -L`pwd`/$(unsubdir)/gnulib`if [ -d $(unsubdir)/gnulib.$(target) ] ; \
122 then echo .$(target) ; fi`$(subdir)/$(stagepass)/ \
123 -B`pwd`/$(unsubdir)/ld`if [ -d $(unsubdir)/ld.$(target) ] ; \
124 then echo .$(target) ; fi`$(subdir)/$(stagepass)/"
128 $(MAKE) subdir_do DO=stage1 "DODIRS=$(SUBDIRS)"
131 $(MAKE) subdir_do DO=stage2 "DODIRS=$(SUBDIRS)"
134 $(MAKE) subdir_do DO=stage3 "DODIRS=$(SUBDIRS)"
137 $(MAKE) subdir_do DO=stage4 "DODIRS=$(SUBDIRS)"
141 comparison:; $(MAKE) subdir_do DO=comparison against=$(against) "DODIRS=$(SUBDIRS)"
143 de-stage1:; $(MAKE) subdir_do DO=de-stage1 "DODIRS=$(SUBDIRS)"
144 de-stage2:; $(MAKE) subdir_do DO=de-stage2 "DODIRS=$(SUBDIRS)"
145 de-stage3:; $(MAKE) subdir_do DO=de-stage3 "DODIRS=$(SUBDIRS)"
146 de-stage4:; $(MAKE) subdir_do DO=de-stage4 "DODIRS=$(SUBDIRS)"
149 rm -rf *.a TEMP errs core *.o *~ \#* TAGS *.E
150 $(MAKE) subdir_do DO=clean "DODIRS=$(SUBDIRS) $(OTHERS)"
152 install: install-dirs install-fixed-includes
153 $(MAKE) subdir_do DO=install "DODIRS=$(SUBDIRS) $(OTHERS)"
155 # The "else true" stuff is for Ultrix; the shell returns the exit code
156 # of the "if" command, if no commands are run in the "then" or "else" part,
157 # causing Make to quit.
160 - mkdir $(destdir)/H-$(host_alias)
161 - mkdir $(destdir)/H-$(host_alias)/T-independent
162 - mkdir $(destdir)/H-$(host_alias)/T-independent/bin
163 - mkdir $(destdir)/H-$(host_alias)/T-independent/lib
164 - mkdir $(destdir)/H-$(host_alias)/T-$(target_alias)
165 - mkdir $(destdir)/H-$(host_alias)/T-$(target_alias)/bin
166 - mkdir $(destdir)/H-$(host_alias)/T-$(target_alias)/lib
167 - mkdir $(destdir)/H-independent
168 - mkdir $(destdir)/H-independent/include
169 - mkdir $(destdir)/H-independent/doc
170 - mkdir $(destdir)/H-independent/man
171 - mkdir $(destdir)/H-independent/man/man1
172 - mkdir $(destdir)/H-independent/man/man2
173 - mkdir $(destdir)/H-independent/man/man3
174 - mkdir $(destdir)/H-independent/man/man4
175 - mkdir $(destdir)/H-independent/man/man5
176 - mkdir $(destdir)/H-independent/man/man6
177 - mkdir $(destdir)/H-independent/man/man7
178 - mkdir $(destdir)/H-independent/man/man8
179 if [ -d $(unsubdir)/gcc`if [ -d $(unsubdir)/gcc.$(target) ] ; \
180 then echo .$(target) ; fi`$(subdir) ] ; then \
181 (cd $(unsubdir)/gcc`if [ -d $(unsubdir)/gcc.$(target) ] ; \
182 then echo .$(target) ; fi`$(subdir) ; \
183 $(MAKE) install-dir) ; \
187 install-fixed-includes: force
188 if [ -d $(unsubdir)/gcc`if [ -d $(unsubdir)/gcc.$(target) ] ; \
189 then echo .$(target) ; fi`$(subdir) ] ; then \
190 (cd $(unsubdir)/gcc`if [ -d $(unsubdir)/gcc.$(target) ] ; \
191 then echo .$(target) ; fi`$(subdir) ; \
192 $(MAKE) install-fixed-includes) ; \
203 @for i in $(SUBDIRS); \
207 wd=`basename $$pwd`; \
208 for j in `$(MAKE) ls`; \
216 # with the gnu make, this is done automatically.
218 Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
219 $(SHELL) ./config.status
222 # Build GDB distributions that contain BFD, Include, Libiberty, Readline, etc
224 DEVO_SUPPORT= README README.configure Makefile.in configure configure.in \
226 GDB_SUPPORT_DIRS= bfd include libiberty readline
227 GDB_SUPPORT_FILES= $(GDB_SUPPORT_DIRS) texinfo/fsf/texinfo.tex
229 setup-dirs: force_update
233 chmod og=u `find $(DEVO_SUPPORT) $(GDB_SUPPORT_FILES) -print`
235 bfd.ilrt.tar.Z: setup-dirs
237 tar cf - $(DEVO_SUPPORT) $(GDB_SUPPORT_FILES) \
238 | compress -v >bfd.ilrt.tar.Z
240 gdb.tar.Z: setup-dirs
241 (cd gdb; $(MAKE) -f Makefile.in make-proto-gdb.dir)
242 $(MAKE) $(MFLAGS) -f Makefile.in make-gdb.tar.Z
244 make-gdb.tar.Z: $(DEVO_SUPPORT) $(GDB_SUPPORT_DIRS) gdb texinfo/fsf/texinfo.tex
245 rm -rf proto-toplev; mkdir proto-toplev
246 ln -s ../gdb/proto-gdb.dir proto-toplev/gdb
247 (cd proto-toplev; for i in $(DEVO_SUPPORT) $(GDB_SUPPORT_DIRS); do \
250 mkdir proto-toplev/texinfo
251 mkdir proto-toplev/texinfo/fsf
252 ln -s ../../../texinfo/fsf/texinfo.tex proto-toplev/texinfo/fsf/
253 chmod og=u `find proto-toplev -print`
254 (VER=`sed <gdb/Makefile.in -n 's/VERSION = //p'`; \
255 echo "==> Making gdb-$$VER.tar.Z"; \
256 ln -s proto-toplev gdb-$$VER; \
257 tar cfh - gdb-$$VER \
258 | compress -v >gdb-$$VER.tar.Z)