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. */
19 # Last Mod Mon Nov 11 01:53:12 PST 1991, by rich@rtl.cygnus.com
26 ddestdir = $(idestdir)
34 BISON = `if [ -d $(unsubdir)/../bison ] ; \
35 then echo \`pwd\`/$(unsubdir)/../bison$(subdir)/bison -L \`pwd\`/$(unsubdir)/../bison$(subdir)/ ; \
38 #\`(cd $(srcdir)/bison ; \\`pwd\\`)\`
39 SUBDIRS = libiberty readline bfd gdb binutils ld gas gcc gnulib clib
43 INSTALL_HEADERS = install-headers
44 INSTALL_FIXED_INCLUDES = install-fixed-includes
49 #### host and target specific makefile fragments come in here.
55 $(MAKE) subdir_do DO=all "DODIRS=$(SUBDIRS) $(OTHERS)"
59 if [ -d clib ] ; then \
60 (cd clib ; $(MAKE)) ; \
64 for i in $(DODIRS); do \
65 if [ -f $(unsubdir)/$$i/localenv ] ; then \
66 if (cd $(unsubdir)/$$i$(subdir); \
68 "against=$(against)" \
69 "BISON=$(BISON)" $(DO)) ; then true ; \
71 else if [ -d $(unsubdir)/$$i ] ; then \
72 if (cd $(unsubdir)/$$i$(subdir); \
74 "against=$(against)" \
77 "AR_FLAGS=$(AR_FLAGS)" \
79 "LOADLIBES=$(LOADLIBES)" \
80 "LDFLAGS=$(LDFLAGS)" \
81 "BISON=$(BISON)" $(DO)) ; then true ; \
92 $(MAKE) pass "stagepass=stage1"
94 $(MAKE) pass "stagepass=stage2"
98 $(MAKE) pass "stagepass=stage1"
100 $(MAKE) pass "stagepass=stage2"
104 $(MAKE) pass "stagepass=stage2"
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 \
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)/"
125 $(MAKE) subdir_do DO=stage1 "DODIRS=$(SUBDIRS)"
128 $(MAKE) subdir_do DO=stage2 "DODIRS=$(SUBDIRS)"
131 $(MAKE) subdir_do DO=stage3 "DODIRS=$(SUBDIRS)"
134 $(MAKE) subdir_do DO=stage4 "DODIRS=$(SUBDIRS)"
138 comparison:; $(MAKE) subdir_do DO=comparison against=$(against) "DODIRS=$(SUBDIRS)"
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)"
146 rm -rf *.a TEMP errs core *.o *~ \#* TAGS *.E
147 $(MAKE) subdir_do DO=clean "DODIRS=$(SUBDIRS) $(OTHERS)"
149 install: install-no-fixincludes $(INSTALL_FIXED_INCLUDES)
151 install-no-fixincludes: install-dirs $(INSTALL_HEADERS)
152 $(MAKE) subdir_do DO=install "DODIRS=$(SUBDIRS) $(OTHERS)"
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.
161 $(ddestdir)/include \
163 $(ddestdir)/lib/emacs \
168 $(idestdir)/man/man1 \
172 for i in $(MAKEDIRS) ; do \
173 if [ -d $$i ] ; then true ; else mkdir $$i ; fi ; \
177 if [ -d $(unsubdir)/gcc$(subdir) ] ; then \
178 (cd $(unsubdir)/gcc$(subdir) ; \
179 $(MAKE) install-dir) ; \
183 install-fixed-includes: force
184 if [ -d $(unsubdir)/gcc$(subdir) ] ; then \
185 (cd $(unsubdir)/gcc$(subdir) ; \
186 $(MAKE) install-fixed-includes) ; \
197 @for i in $(SUBDIRS); \
201 wd=`basename $$pwd`; \
202 for j in `$(MAKE) ls`; \
210 # with the gnu make, this is done automatically.
212 Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
213 $(SHELL) ./config.status
216 # Build GDB distributions that contain BFD, Include, Libiberty, Readline, etc
218 DEVO_SUPPORT= README README.configure Makefile.in configure configure.in \
220 GDB_SUPPORT_DIRS= bfd include libiberty readline
221 GDB_SUPPORT_FILES= $(GDB_SUPPORT_DIRS) texinfo/fsf/texinfo.tex
223 setup-dirs: force_update
227 chmod og=u `find $(DEVO_SUPPORT) $(GDB_SUPPORT_FILES) -print`
229 bfd.ilrt.tar.Z: setup-dirs
231 tar cf - $(DEVO_SUPPORT) $(GDB_SUPPORT_FILES) \
232 | compress -v >bfd.ilrt.tar.Z
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
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 \
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)