Get the BIT/MASK/ROT/... macros to work with any 32/64/MSB0/MSBn target.
[platform/upstream/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 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 # clean         - remove objdir directories, stamp files
33 #               (rt = clean)
34 #
35 # To configure/build for fewer targets, specify TARGETS="native cross1 ...".
36   
37 TREE = devo
38 include $(TREE)/release-info
39
40 TEST_INSTALL_DISK = /dumbo
41
42 INSTALLDIR = $(TEST_INSTALL_DISK)/$(TREE)-test/$(RELEASE_TAG)
43
44 ifndef host
45 host := $(shell $(TREE)/config.guess)
46 endif
47
48 NATIVE  = native
49
50 GCC      = gcc
51 CFLAGS   = -g
52 GNUCFLAGS= -g -O2
53 CXXFLAGS = -g -O2
54 MAKEINFOFLAGS =
55
56 log     = 1>$(canonhost)-build-log 2>&1
57 clog    = 1>$(canonhost)-check-log 2>&1
58 cyglog    = 1> $(canonhost)-x-$$i-cygnus-build-log 2>&1
59 latestlog = 1> $(canonhost)-x-$$i-latest-build-log 2>&1
60 natlog    = 1> $(canonhost)-x-$$i-native-build-log 2>&1
61
62 canonhost := $(shell $(TREE)/config.sub $(host))
63
64 # Convert config.guess results to a simpler form.
65 ifeq ($(canonhost),sparc-sun-solaris2.1)
66 canonhost := sparc-sun-solaris2
67 endif
68 ifeq ($(canonhost),sparc-sun-solaris2.3)
69 canonhost := sparc-sun-solaris2
70 endif
71 ifeq ($(canonhost),mips-dec-ultrix4.2)
72 canonhost := mips-dec-ultrix
73 endif
74 ifeq ($(canonhost),mips-dec-ultrix4.4)
75 canonhost := mips-dec-ultrix
76 endif
77 ifeq ($(canonhost),mips-sgi-irix4.0.1)
78 canonhost := mips-sgi-irix4
79 endif
80 ifeq ($(canonhost),mips-sgi-irix4.0.5H)
81 canonhost := mips-sgi-irix4
82 endif
83 ifeq ($(canonhost),mips-sgi-irix5.2)
84 canonhost := mips-sgi-irix5
85 endif
86 ifeq ($(canonhost),rs6000-ibm-aix3.2)
87 canonhost := rs6000-ibm-aix
88 endif
89 ifeq ($(canonhost),i486-unknown-sco3.2v4.0)
90 canonhost := i386-sco3.2v4
91 endif
92 ifeq ($(canonhost),i386-unknown-sco3.2v4.0)
93 canonhost := i386-sco3.2v4
94 endif
95 ifeq ($(canonhost),i386-unknown-sco3.2v4)
96 canonhost := i386-sco3.2v4
97 endif
98 ifeq ($(canonhost),i386-unknown-go32)
99 canonhost := i386-go32
100 endif
101 ifeq ($(canonhost),i386-unknown-sysv4.2)
102 canonhost := i386-sysv4.2
103 endif
104 ifeq ($(canonhost),i386-lynx-lynxos)
105 canonhost := i386-lynx
106 endif
107 ifeq ($(canonhost),m68k-lynx-lynxos)
108 canonhost := m68k-lynx
109 endif
110 ifeq ($(canonhost),sparc-lynx-lynxos)
111 canonhost := sparc-lynx
112 endif
113 ifeq ($(canonhost),rs6000-lynx-lynxos)
114 canonhost := rs6000-lynx
115 endif
116 ifeq ($(canonhost),i386-unknown-linux)
117 canonhost := i386-linux
118 endif
119 ifeq ($(canonhost),i486-unknown-linux)
120 canonhost := i486-linux
121 endif
122 ifeq ($(canonhost),i586-unknown-linux)
123 canonhost := i486-linux
124 endif
125 ifeq ($(canonhost),i386-unknown-linuxaout)
126 canonhost := i386-linuxaout
127 endif
128 ifeq ($(canonhost),i486-unknown-linuxaout)
129 canonhost := i486-linuxaout
130 endif
131 ifeq ($(canonhost),i586-unknown-linuxaout)
132 canonhost := i486-linuxaout
133 endif
134
135 #
136 # The following TARGETS variable settings probably ought to
137 # be made automatically from the 
138 # /s1/cygnus/progressive/host-target-pairs.tbl file, using
139 # the /s1/cygnus/progressive/targets script.  But, be sure
140 # that the native is spelled 'native'.
141 #
142
143 ifeq ($(canonhost),sparc-sun-sunos4.1)
144 TARGETS = $(NATIVE) \
145         i386-go32 \
146         a29k-amd-udi a29k-vxworks5.1 \
147         sh-hms h8300-hms \
148         powerpc-eabi hppa1.1-hp-proelf \
149         i386-aout i386-elf \
150         i960-nindy-coff i960-vxworks5.0 i960-vxworks5.1 \
151         m68k-aout m68k-coff m68k-elf m68k-vxworks5.1 \
152         mips-elf mips-idt-ecoff mips64-elf \
153         sparc-aout sparclite-aout sparclite-coff \
154         z8k-coff i386-unixware mips-ncd-elf \
155         OSE68000 OSE68k
156 GCC = gcc -O2 -pipe
157 all: all-cygnus
158 endif
159
160 ifeq ($(canonhost),sparc-sun-sunos4.1.3)
161 TARGETS = $(NATIVE) \
162         i386-go32       \
163         a29k-amd-udi    \
164         h8300-hms       h8500-hms \
165         hppa1.1-hp-proelf \
166         i386-aout       i386-elf \
167         i960-nindy-coff i960-vxworks5.0 i960-vxworks5.1 \
168         m68k-aout       m68k-coff       m68k-elf        m68k-vxworks5.1 \
169         mips-idt-ecoff  mips64-elf      mips-elf \
170         sh-hms  \
171         sparc-aout      sparc64-aout    sparc-vxworks \
172         sparclite-aout  sparclite-coff  sparclite-vxworks \
173         z8k-coff \
174         OSE68000 OSE68k mips-ncd-elf i386-unixware
175 # The OSE68000 and OSE68k targets are for Ericsson only.
176 GCC = gcc -O2 -pipe
177 all: all-cygnus
178 endif
179
180 ifeq ($(canonhost),m68k-sun-sunos4.1.1)
181 TARGETS = $(NATIVE)
182 GCC = gcc -O2 -msoft-float
183 CC = cc -J
184 all: all-cygnus
185 endif
186
187 ifeq ($(canonhost),sparc-sun-solaris2)
188 TARGETS = $(NATIVE) \
189         a29k-amd-udi \
190         h8300-hms       h8500-hms \
191         hppa1.1-hp-proelf \
192         i960-vxworks5.0 i960-vxworks5.1 \
193         m68k-aout       m68k-coff       m68k-vxworks5.1 m88k-coff \
194         mips-idt-ecoff  mips-elf \
195         sparc64-elf     sparclite-aout sparclite-coff \
196         OSE68000 OSE68k \
197         sparc-sun-sunos4.1.3
198 # The latter assures that BNR's special build (which they now
199 # do for themselves from sources) hasn't developed bit-rot.
200 # The OSE68000 and OSE68k targets are for Ericsson only.
201
202 CC = cc
203 GCC = gcc -O2 -pipe
204 all: all-cygnus
205 endif
206
207 ifeq ($(canonhost),mips-dec-ultrix)
208 TARGETS = $(NATIVE)
209 CC = cc -Wf,-XNg1000
210 all: all-cygnus
211 SHELL = /usr/unsupported/bin/bash
212 CONFIG_SHELL = /usr/unsupported/bin/bash
213 TMPDIR = $(shell mkdir $(canonhost)-tmpdir; cd $(canonhost)-tmpdir ; pwd)
214 endif
215
216 ifeq ($(patsubst alpha-dec-osf%,alpha,$(canonhost)),alpha)
217 TARGETS = $(NATIVE)
218 CC = cc
219 all: all-cygnus
220 endif
221
222 ifeq ($(canonhost),mips-sgi-irix4)
223 TARGETS = $(NATIVE) \
224         mips-idt-ecoff \
225         mips-elf mips64-elf \
226         sh-hms
227 CC = cc -cckr -Wf,-XNg1500 -Wf,-XNk1000 -Wf,-XNh2000
228 all: all-cygnus
229 endif
230
231 ifeq ($(canonhost),mips-sgi-irix5)
232 TARGETS = $(NATIVE) \
233         mips-idt-ecoff \
234         mips-elf mips64-elf \
235         sh-hms
236 CC = cc -cckr -Wf,-XNg1500 -Wf,-XNk1000 -Wf,-XNh2000
237 all: all-cygnus
238 endif
239
240 ifeq ($(canonhost),powerpc-ibm-aix4.1)
241 TARGETS = $(NATIVE)
242 all: all-cygnus
243 endif
244
245 ifeq ($(canonhost),rs6000-ibm-aix)
246 TARGETS = $(NATIVE) \
247         i960-vxworks5.0 i960-vxworks5.1 \
248         m68k-aout
249 all: all-cygnus
250 endif
251
252 ifeq ($(canonhost),rs6000-ibm-aix3.2.5)
253 TARGETS = $(NATIVE) \
254         i960-vxworks5.0 i960-vxworks5.1 \
255         m68k-aout
256 all: all-cygnus
257 endif
258
259 ifeq ($(canonhost),rs6000-ibm-aix4.1)
260 TARGETS = $(NATIVE)
261 all: all-cygnus
262 endif
263
264 ifeq ($(canonhost),m68k-hp-hpux9)
265 TARGETS = $(NATIVE)
266 TMPDIR := $(shell mkdir $(canonhost)-tmpdir; cd $(canonhost)-tmpdir ; pwd)
267 CC = cc -Wp,-P,-H256000
268 #CFLAGS = +O1000 
269 CFLAGS = -g
270 all: all-cygnus
271 endif
272
273 ifeq ($(canonhost),hppa1.1-hp-hpux9)
274 TARGETS = \
275         $(NATIVE) \
276         h8300-hms \
277         hppa1.1-hp-proelf \
278         i960-vxworks5.0 i960-vxworks5.1 \
279         m68k-aout  m68k-coff  m68k-vxworks5.1
280 CC = cc -Wp,-H256000
281 #CFLAGS = +Obb2000
282 CFLAGS = -g
283 all: all-cygnus
284 endif
285
286 #ifeq ($(canonhost),hppa1.1-hp-hpux10)
287 ifeq ($(patsubst hppa1.1-hp-hpux10%,hpux10,$(canonhost)),hpux10)
288 TARGETS = $(NATIVE)
289 CC = cc -Wp,-H256000
290 #CFLAGS = +Obb2000
291 CFLAGS = -g
292 all: all-cygnus
293 endif
294
295 ifeq ($(canonhost),i386-sco3.2v4)
296 TARGETS = $(NATIVE)
297 all: all-cygnus
298 endif
299
300 ifeq ($(canonhost),i386-go32)
301 TARGETS = \
302         a29k-amd-udi \
303         h8300-hms       hppa1.1-hp-proelf \
304         i386-aout       \
305         m68k-aout       m68k-coff \
306         mips-elf        mips-idt-ecoff  mips64-elf \
307         sh-hms          \
308         sparc-aout      sparclite-aout  sparclite-coff
309 CC = i386-go32-gcc
310 GCC = i386-go32-gcc -O2
311 CFLAGS =
312 CXXFLAGS = -O2
313 MAKEINFOFLAGS = --no-split
314 all: all-dos
315 endif
316
317 ifeq ($(canonhost),i386-sysv4.2)
318 TARGETS = $(NATIVE) i386-netware
319 CC = cc
320 all: all-cygnus
321 endif
322
323 ifeq ($(canonhost),i386-ncr-sysv4.3)
324 TARGETS = $(NATIVE)
325 CC = cc -Hnocopyr
326 SHELL = /usr/unsupported/bin/bash
327 CONFIG_SHELL = /usr/unsupported/bin/bash
328 all: all-cygnus
329 endif
330
331 ifeq ($(canonhost),i386-lynx)
332 TARGETS = $(NATIVE)
333 CC = /usr/cygnus/progressive/bin/gcc
334 all: all-cygnus
335 SHELL=/bin/bash
336 endif
337
338 ifeq ($(canonhost),m68k-lynx)
339 TARGETS = $(NATIVE)
340 CC = /usr/cygnus/progressive/bin/gcc
341 all: all-cygnus
342 SHELL=/bin/bash
343 endif
344
345 ifeq ($(canonhost),sparc-lynx)
346 TARGETS = $(NATIVE)
347 CC = /usr/cygnus/progressive/bin/gcc
348 all: all-cygnus
349 SHELL=/bin/bash
350 endif
351
352 ifeq ($(canonhost),rs6000-lynx)
353 TARGETS = $(NATIVE)
354 CC = /usr/cygnus/progressive/bin/gcc
355 all: all-cygnus
356 SHELL=/bin/bash
357 endif
358
359 ifeq ($(patsubst %-linux,linux,$(patsubst %-linuxaout,linux,$(canonhost))),linux)
360 TARGETS = $(NATIVE)
361 all: all-cygnus
362 endif
363
364 FLAGS_TO_PASS := \
365         "GCC=$(GCC)" \
366         "CC=$(CC)" \
367         "CFLAGS=$(CFLAGS)" \
368         "GNUCFLAGS=$(GNUCFLAGS)" \
369         "CXXFLAGS=$(CXXFLAGS)" \
370         "host=$(canonhost)" \
371         "MAKEINFOFLAGS=$(MAKEINFOFLAGS)" \
372         "RELEASE_TAG=$(RELEASE_TAG)" \
373         "SHELL=$(SHELL)"
374
375 # set GNU_MAKE and CONFIG_SHELL correctly in sub-builds
376 ifeq ($(patsubst %-lynx,lynx,$(canonhost)),lynx)
377 FLAGS_TO_PASS := $(FLAGS_TO_PASS) "GNU_MAKE=$(MAKE)" "CONFIG_SHELL=/bin/bash"
378 endif
379
380 ifeq ($(patsubst %-linux,linux,$(patsubst %-linuxaout,linux,$(canonhost))),linux)
381 FLAGS_TO_PASS := $(FLAGS_TO_PASS) "GNU_MAKE=$(MAKE)"
382 endif
383
384 ifeq ($(patsubst %i386-ncr-sysv4.3,ncr,$(canonhost)),ncr)
385 FLAGS_TO_PASS := $(FLAGS_TO_PASS) "CONFIG_SHELL=/usr/unsupported/bin/bash"
386 endif
387
388 all-emacs:
389         @echo build started at `date`
390         test -d $(INSTALLDIR) || mkdir $(INSTALLDIR)
391         -rm -f $(ROOTING)/$(RELEASE_TAG)
392         ln -s $(INSTALLDIR) $(ROOTING)/$(RELEASE_TAG) 
393         $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) do1 > $(canonhost)-emacs-native-log 2>&1 
394         $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) do-latest > $(canonhost)-emacs-latest-log 2>&1 
395         @echo done at `date`
396
397 all-cygnus:
398         @echo build started at `date`
399         test -d $(INSTALLDIR) || mkdir $(INSTALLDIR)
400         -rm -f $(ROOTING)/$(RELEASE_TAG) && ln -s $(INSTALLDIR) $(ROOTING)/$(RELEASE_TAG) 
401 #
402 #      The following line to be used during regular progressive builds
403 #      to help developers test, but should be commented out for final
404 #      progressive build.
405 #
406 #      -rm -f $(ROOTING)/progressive-beta && ln -s $(RELEASE_TAG) $(ROOTING)/progresssive
407         @for i in $(TARGETS) ; do \
408           if [ "$$i" = "native" ] ; then \
409             if [ ! -f $(canonhost)-stamp-3stage-done ] ; then \
410               echo "3staging $(canonhost) native" ; \
411               echo Flags passed to make: $(FLAGS_TO_PASS) ; \
412               if $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) $(canonhost)-stamp-3stage-done $(log); then \
413                 echo "     completed successfully" ; \
414               else \
415                 exit 1; \
416               fi; \
417             else \
418               true ; \
419             fi ; \
420           else \
421             echo "building $(canonhost) cross to $$i" ; \
422             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i do-cygnus $(cyglog) && \
423                echo "     completed successfully" ; \
424           fi ; \
425         done
426         @if [ ! -f $(canonhost)-stamp-3stage-checked ] ; then \
427           echo checking $(canonhost) native ; \
428           $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) $(canonhost)-check-3stage $(clog) ; \
429           touch $(canonhost)-stamp-3stage-checked ; \
430         else \
431           true ; \
432         fi
433         @echo done at `date`
434
435 native:
436         @echo build started at `date`
437         test -d $(INSTALLDIR) || mkdir $(INSTALLDIR)
438         -rm -f $(ROOTING)/$(RELEASE_TAG) && ln -s $(INSTALLDIR) $(ROOTING)/$(RELEASE_TAG)
439 #       -rm -f $(ROOTING)/progressive-beta && ln -s $(RELEASE_TAG) $(ROOTING)/progressive-beta
440         $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) $(canonhost)-stamp-3stage-done $(log)
441         @echo done at `date`
442
443 build-cygnus:
444         @echo build started at `date`
445         @for i in $(TARGETS) ; do \
446           if [ "$$i" = "native" ] ; then \
447             if [ ! -f $(canonhost)-3stage-done ] ; then \
448               echo "3staging $(canonhost) native" ; \
449               $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) $(canonhost)-stamp-3stage-done $(log) && \
450                  echo "     completed successfully" ; \
451             fi ; \
452           else \
453             echo "building $(canonhost) cross to $$i:" `date` ; \
454             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i build-cygnus $(cyglog) && \
455                echo "     completed successfully" ; \
456           fi ; \
457         done
458         @echo done at `date`
459
460 build-latest:
461         @echo build started at `date`
462         @for i in $(TARGETS) ; do \
463           if [ "$$i" != "native" ] ; then \
464             echo "building $(canonhost) cross to $$i:" `date` ; \
465             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i build-latest $(latestlog) && \
466                echo "     completed successfully" ; \
467           fi ; \
468         done
469         @echo done at `date`
470
471 all-native:
472         test -d $(INSTALLDIR) || mkdir $(INSTALLDIR)
473         rm -f $(ROOTING)/$(RELEASE_TAG)
474         ln -s $(INSTALLDIR) $(ROOTING)/$(RELEASE_TAG)
475         @for i in $(TARGETS) ; do \
476             echo "building $(canonhost) cross to $$i" ; \
477             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i do-native $(natlog) && \
478                echo "     completed successfully" ; \
479         done
480
481 all-cross:
482         test -d $(INSTALLDIR) || mkdir $(INSTALLDIR)
483         rm -f $(ROOTING)/$(RELEASE_TAG)
484         ln -s $(INSTALLDIR) $(ROOTING)/$(RELEASE_TAG)
485         @for i in $(TARGETS) ; do \
486             echo "building $(canonhost) cross to $$i" ; \
487             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i build=$(build) do-cygnus $(cyglog) && \
488                echo "     completed successfully" ; \
489         done
490
491 do-dos:
492         $(MAKE) -f build-all.mk build=$(host) host=i386-go32 all-dos
493 all-dos:
494         @for i in $(TARGETS) ; do \
495             echo "building $(canonhost) cross to $$i" ; \
496             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) host=$(host) target=$$i do-dos $(cyglog) && \
497                echo "     completed successfully at `date`" ; \
498         done
499
500 config:
501         @for i in $(TARGETS) ; do \
502           if [ "$$i" = "native" ] ; then \
503             echo "config stage1 for $(canonhost)" ; \
504             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) do1-config $(log) && \
505                echo "     completed successfully" ; \
506           else \
507             echo "config $(canonhost) cross to $$i" ; \
508             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i do-native-config $(cyglog) && \
509                echo "     completed successfully" ;  \
510           fi ; \
511         done
512
513
514 build:
515         @for i in $(TARGETS) ; do \
516           if [ "$$i" = "native" ] ; then \
517             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) do1-build $(log) && \
518                echo "     completed successfully" ; \
519           else \
520             echo "building $(canonhost) cross to $$i" ; \
521             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i build-native $(natlog) && \
522                echo "     completed successfully" ; \
523           fi ; \
524         done
525
526
527 3build:
528         @for i in $(TARGETS) ; do \
529           if [ "$$i" = "native" ] ; then \
530             echo "building 3stage for $(canonhost)" ; \
531             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) all $(log) && \
532                echo "     completed successfully" ; \
533           else \
534             echo "building $(canonhost) cross to $$i" ; \
535             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i build-cygnus $(cyglog) && \
536                echo "     completed successfully" ; \
537           fi ; \
538         done
539
540 build-all-latest:
541         @for i in $(TARGETS) ; do \
542           if [ "$$i" = "native" ] ; then \
543             echo "building 3stage for $(canonhost)" ; \
544             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) $(canonhost)-stamp-3stage-done $(log) && \
545                echo "     completed successfully" ; \
546           else \
547             echo "building $(canonhost) cross to $$i" ; \
548             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i build-latest $(cyglog) && \
549                echo "     completed successfully" ; \
550           fi ; \
551         done
552
553 clean:
554         $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) clean $(log)
555
556 ### Local Variables:
557 ### fill-column: 131
558 ### End: