* build-all.mk: Document all useful targets.
[external/binutils.git] / build-all.mk
1 #  Build all of the targets for any given host.....
2 #
3 #  This file is going to be ugly.  It will be VERY specific to the
4 #  Cygnus environment and build-process.
5 #
6 # Useful targets (rt = recursion target):
7 # (please correct or expand on this)
8 # FIXME: Might some of these be superfluous?
9 #
10 # all-emacs
11 # all-cygnus    - set up install directories, build 3stage native and all
12 #               supported cross targets, then check 3stage'd native
13 #               (rt = $(canonhost)-stamp-3stage-done, do-cygnus for cross)
14 # native        - set up install directories, build 3stage native
15 #               (rt = $(canonhost)-stamp-3stage-1)
16 # build-cygnus  - build 3stage native and all supported cross targets
17 #               (rt = $(canonhost)-stamp-3stage-done, build-cygnus for cross)
18 # build-latest  - build native and all supported cross targets
19 #               (rt = build-latest)
20 # all-native    - set up install directories, build native
21 #               (rt = do-native)
22 # all-cross     - set up install directories, build all targets
23 #               (rt = do-cygnus)
24 # config        - configure native and all supported cross targets
25 #               (rt = do1-config, do-native-config for cross)
26 # build         - build native and all supported cross targets
27 #               (rt = do1-build, build-native for cross)
28 # 3build        - build 3stage native and all supported cross targets
29 #               (rt = all, build-cygnus for cross)
30 # build-all-latest - build 3stage native and all supported cross targets
31 #               (rt = $(canonhost)-stamp-3stage-done, build-latest for cross)
32 #
33 # To configure/build for fewer targets, specify TARGETS="native cross1 ...".
34   
35 TREE    = devo
36 include $(TREE)/release-info
37
38 TEST_INSTALL_DISK = /tug
39
40 INSTALLDIR = $(TEST_INSTALL_DISK)/$(TREE)-test/$(RELEASE_TAG)
41
42 ifndef host
43 host := $(shell $(TREE)/config.guess)
44 endif
45
46 NATIVE  = native
47
48 GCC      = gcc -O 
49 CFLAGS   = -g
50 CXXFLAGS = -g -O
51 MAKEINFOFLAGS =
52
53 log     = 1>$(canonhost)-build-log 2>&1
54 clog    = 1>$(canonhost)-check-log 2>&1
55 cyglog    = 1> $(canonhost)-x-$$i-cygnus-build-log 2>&1
56 latestlog = 1> $(canonhost)-x-$$i-latest-build-log 2>&1
57 natlog    = 1> $(canonhost)-x-$$i-native-build-log 2>&1
58
59 canonhost := $(shell $(TREE)/config.sub $(host))
60
61 # Convert config.guess results to a simpler form.
62 ifeq ($(canonhost),sparc-sun-solaris2.1)
63 canonhost := sparc-sun-solaris2
64 endif
65 ifeq ($(canonhost),sparc-sun-solaris2.3)
66 canonhost := sparc-sun-solaris2
67 endif
68 ifeq ($(canonhost),mips-dec-ultrix4.2)
69 canonhost := mips-dec-ultrix
70 endif
71 ifeq ($(canonhost),mips-sgi-irix4.0.1)
72 canonhost := mips-sgi-irix4
73 endif
74 ifeq ($(canonhost),mips-sgi-irix4.0.5H)
75 canonhost := mips-sgi-irix4
76 endif
77 ifeq ($(canonhost),rs6000-ibm-aix3.2)
78 canonhost := rs6000-ibm-aix
79 endif
80 ifeq ($(canonhost),i486-unknown-sco3.2v4.0)
81 canonhost := i386-sco3.2v4
82 endif
83 ifeq ($(canonhost),i386-unknown-sco3.2v4.0)
84 canonhost := i386-sco3.2v4
85 endif
86 ifeq ($(canonhost),i386-unknown-sco3.2v4)
87 canonhost := i386-sco3.2v4
88 endif
89 ifeq ($(canonhost),i386-unknown-go32)
90 canonhost := i386-go32
91 endif
92 ifeq ($(canonhost),i386-unknown-sysv4.2)
93 canonhost := i386-sysv4.2
94 endif
95 ifeq ($(canonhost),i386-lynx-lynxos)
96 canonhost := i386-lynxos
97 endif
98 ifeq ($(canonhost),m68k-lynx-lynxos)
99 canonhost := m68k-lynxos
100 endif
101
102 ifeq ($(canonhost),sparc-sun-sunos4.1.3)
103 TARGETS = $(NATIVE) \
104         i386-go32       \
105         a29k-amd-udi    \
106         h8300-hms       \
107         i386-aout       \
108         i386-lynx       \
109         i386-netware    \
110         i960-vxworks    i960-intel-nindy \
111         mips-idt-ecoff  \
112         m68k-aout       m68k-vxworks    m68k-coff \
113         m68k-lynx       \
114         sh-hms          \
115         sparc-aout      sparc-vxworks   \
116         sparclite-aout  sparclite-vxworks \
117         z8k-coff
118 GCC = gcc -O -pipe
119 all: all-cygnus
120 endif
121
122 ifeq ($(canonhost),m68k-sun-sunos4.1.1)
123 TARGETS = $(NATIVE) \
124         m68k-aout       m68k-coff       i960-intel-nindy 
125 GCC = gcc -O -msoft-float
126 CC = cc -J
127 all: all-cygnus
128 endif
129
130 ifeq ($(canonhost),sparc-sun-solaris2)
131 TARGETS = $(NATIVE) \
132         a29k-amd-udi \
133         i386-aout \
134         i960-vxworks    i960-intel-nindy \
135         m68k-aout       m68k-coff       m68k-vxworks \
136         m88k-coff       \
137         mips-idt-ecoff  mipsel-idt-ecoff \
138         sparc-aout      sparc-vxworks   sparclite-aout
139 CC = cc -Xs
140 GCC = gcc -O -pipe
141 all: all-cygnus
142 endif
143
144 ifeq ($(canonhost),mips-dec-ultrix)
145 TARGETS = $(NATIVE) m68k-aout
146 CC = cc -Wf,-XNg1000
147 all: all-cygnus
148 endif
149
150 ifeq ($(canonhost),mips-sgi-irix4)
151 TARGETS = $(NATIVE) \
152         mips-idt-ecoff  sh-hms
153 CC = cc -cckr -Wf,-XNg1500 -Wf,-XNk1000 -Wf,-XNh1500
154 all: all-cygnus
155 endif
156
157 ifeq ($(canonhost),rs6000-ibm-aix)
158 TARGETS = $(NATIVE) \
159         i960-vxworks    i960-intel-nindy \
160         m68k-vxworks
161 all: all-cygnus
162 endif
163
164 ifeq ($(canonhost),m68k-hp-hpux)
165 TARGETS = $(NATIVE)     m68k-aout
166 TMPDIR := $(shell mkdir $(canonhost)-tmpdir; cd $(canonhost)-tmpdir ; pwd)
167 CC = cc -Wp,-P 
168 #CFLAGS = +O1000 
169 CFLAGS = 
170 all: all-cygnus
171 endif
172
173 ifeq ($(canonhost),hppa1.1-hp-hpux)
174 TARGETS = \
175         $(NATIVE) \
176         i960-vxworks \
177         m68k-aout       m68k-vxworks
178 CC = cc 
179 #CFLAGS = +Obb2000
180 CFLAGS = -g
181 all: all-native
182 endif
183
184 ifeq ($(canonhost),i386-sco3.2v4)
185 TARGETS = $(NATIVE) i386-aout
186 all: all-cygnus
187 endif
188
189 ifeq ($(canonhost),i386-go32)
190 TARGETS = \
191         a29k-amd-udi \
192         h8300-hms       \
193         i386-aout       \
194         m68k-aout       m68k-coff \
195         mips-idt-ecoff  \
196         sh-hms          \
197         sparclite-aout
198 CC = i386-go32-gcc
199 GCC = i386-go32-gcc -O
200 CFLAGS =
201 CXXFLAGS = -O
202 MAKEINFOFLAGS = --no-split
203 all: all-cross
204 endif
205
206 ifeq ($(canonhost),i386-sysv4.2)
207 TARGETS = $(NATIVE) 
208 CC = cc
209 all: all-cygnus
210 endif
211
212 ifeq ($(canonhost),i386-lynxos)
213 TARGETS = $(NATIVE)
214 CC = /bin/gcc
215 all: all-cygnus
216 SHELL=/bin/bash
217 endif
218
219 ifeq ($(canonhost),m68k-lynxos)
220 TARGETS = $(NATIVE)
221 CC = /bin/gcc
222 all: all-cygnus
223 SHELL=/bin/bash
224 endif
225
226
227 FLAGS_TO_PASS := \
228         "GCC=$(GCC)" \
229         "CC=$(CC)" \
230         "CFLAGS=$(CFLAGS)" \
231         "CXXFLAGS=$(CXXFLAGS)" \
232         "host=$(canonhost)" \
233         "MAKEINFOFLAGS=$(MAKEINFOFLAGS)" \
234         "RELEASE_TAG=$(RELEASE_TAG)" \
235         "SHELL=$(SHELL)"
236
237 # set GNU_MAKE and CONFIG_SHELL correctly in sub-builds
238 ifeq ($(patsubst %-lynxos,lynxos,$(canonhost)),lynxos)
239 FLAGS_TO_PASS := $(FLAGS_TO_PASS) "GNU_MAKE=$(MAKE)" "CONFIG_SHELL=/bin/bash"
240 endif
241
242 all-emacs:
243         @echo build started at `date`
244         [ -d $(INSTALLDIR) ] || mkdir $(INSTALLDIR)
245         -rm -f $(ROOTING)/$(RELEASE_TAG)
246         ln -s $(INSTALLDIR) $(ROOTING)/$(RELEASE_TAG) 
247         $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) do1 > $(canonhost)-emacs-native-log 2>&1 
248         $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) do-latest > $(canonhost)-emacs-latest-log 2>&1 
249         @echo done at `date`
250
251 all-cygnus:
252         @echo build started at `date`
253         [ -d $(INSTALLDIR) ] || mkdir $(INSTALLDIR)
254         -rm -f $(ROOTING)/$(RELEASE_TAG) && ln -s $(INSTALLDIR) $(ROOTING)/$(RELEASE_TAG) 
255         @for i in $(TARGETS) ; do \
256           if [ "$$i" = "native" ] ; then \
257             if [ ! -f $(canonhost)-stamp-3stage-done ] ; then \
258               echo "3staging $(canonhost) native" ; \
259               $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) $(canonhost)-stamp-3stage-done $(log) && \
260                  echo "     completed successfully" ; \
261             else \
262               true ; \
263             fi ; \
264           else \
265             echo "building $(canonhost) cross to $$i" ; \
266             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i do-cygnus $(cyglog) && \
267                echo "     completed successfully" ; \
268           fi ; \
269         done
270         @if [ ! -f $(canonhost)-stamp-3stage-checked ] ; then \
271           echo checking $(canonhost) native ; \
272           $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) $(canonhost)-check-3stage $(clog) ; \
273           touch $(canonhost)-stamp-3stage-checked ; \
274         else \
275           true ; \
276         fi
277         @echo done at `date`
278
279 native:
280         @echo build started at `date`
281         [ -d $(INSTALLDIR) ] || mkdir $(INSTALLDIR)
282         rm -f $(ROOTING)/$(RELEASE_TAG)
283         ln -s $(INSTALLDIR) $(ROOTING)/$(RELEASE_TAG) 
284         $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) $(canonhost)-stamp-3stage-done $(log)
285         @echo done at `date`
286
287 build-cygnus:
288         @echo build started at `date`
289         @for i in $(TARGETS) ; do \
290           if [ "$$i" = "native" ] ; then \
291             if [ ! -f $(canonhost)-3stage-done ] ; then \
292               echo "3staging $(canonhost) native" ; \
293               $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) $(canonhost)-stamp-3stage-done $(log) && \
294                  echo "     completed successfully" ; \
295             fi ; \
296           else \
297             echo "building $(canonhost) cross to $$i:" `date` ; \
298             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i build-cygnus $(cyglog) && \
299                echo "     completed successfully" ; \
300           fi ; \
301         done
302         @echo done at `date`
303
304 build-latest:
305         @echo build started at `date`
306         @for i in $(TARGETS) ; do \
307           if [ "$$i" != "native" ] ; then \
308             echo "building $(canonhost) cross to $$i:" `date` ; \
309             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i build-latest $(latestlog) && \
310                echo "     completed successfully" ; \
311           fi ; \
312         done
313         @echo done at `date`
314
315 all-native:
316         [ -d $(INSTALLDIR) ] || mkdir $(INSTALLDIR)
317         rm -f $(ROOTING)/$(RELEASE_TAG)
318         ln -s $(INSTALLDIR) $(ROOTING)/$(RELEASE_TAG)
319         @for i in $(TARGETS) ; do \
320             echo "building $(canonhost) cross to $$i" ; \
321             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i do-native $(natlog) && \
322                echo "     completed successfully" ; \
323         done
324
325 all-cross:
326         [ -d $(INSTALLDIR) ] || mkdir $(INSTALLDIR)
327         rm -f $(ROOTING)/$(RELEASE_TAG)
328         ln -s $(INSTALLDIR) $(ROOTING)/$(RELEASE_TAG)
329         @for i in $(TARGETS) ; do \
330             echo "building $(canonhost) cross to $$i" ; \
331             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i build=$(build) do-cygnus $(cyglog) && \
332                echo "     completed successfully" ; \
333         done
334
335 config:
336         @for i in $(TARGETS) ; do \
337           if [ "$$i" = "native" ] ; then \
338             echo "config stage1 for $(canonhost)" ; \
339             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) do1-config $(log) && \
340                echo "     completed successfully" ; \
341           else \
342             echo "config $(canonhost) cross to $$i" ; \
343             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i do-native-config $(cyglog) && \
344                echo "     completed successfully" ;  \
345           fi ; \
346         done
347
348
349 build:
350         @for i in $(TARGETS) ; do \
351           if [ "$$i" = "native" ] ; then \
352             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) do1-build $(log) && \
353                echo "     completed successfully" ; \
354           else \
355             echo "building $(canonhost) cross to $$i" ; \
356             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i build-native $(natlog) && \
357                echo "     completed successfully" ; \
358           fi ; \
359         done
360
361
362 3build:
363         @for i in $(TARGETS) ; do \
364           if [ "$$i" = "native" ] ; then \
365             echo "building 3stage for $(canonhost)" ; \
366             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) all $(log) && \
367                echo "     completed successfully" ; \
368           else \
369             echo "building $(canonhost) cross to $$i" ; \
370             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i build-cygnus $(cyglog) && \
371                echo "     completed successfully" ; \
372           fi ; \
373         done
374
375 build-all-latest:
376         @for i in $(TARGETS) ; do \
377           if [ "$$i" = "native" ] ; then \
378             echo "building 3stage for $(canonhost)" ; \
379             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) $(canonhost)-stamp-3stage-done $(log) && \
380                echo "     completed successfully" ; \
381           else \
382             echo "building $(canonhost) cross to $$i" ; \
383             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i build-latest $(cyglog) && \
384                echo "     completed successfully" ; \
385           fi ; \
386         done
387
388 ### Local Variables:
389 ### fill-column: 131
390 ### End: