Linux configuration name fixes
[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 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 = /abc
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-sgi-irix4.0.1)
75 canonhost := mips-sgi-irix4
76 endif
77 ifeq ($(canonhost),mips-sgi-irix4.0.5H)
78 canonhost := mips-sgi-irix4
79 endif
80 ifeq ($(canonhost),mips-sgi-irix5.2)
81 canonhost := mips-sgi-irix5
82 endif
83 ifeq ($(canonhost),rs6000-ibm-aix3.2)
84 canonhost := rs6000-ibm-aix
85 endif
86 ifeq ($(canonhost),i486-unknown-sco3.2v4.0)
87 canonhost := i386-sco3.2v4
88 endif
89 ifeq ($(canonhost),i386-unknown-sco3.2v4.0)
90 canonhost := i386-sco3.2v4
91 endif
92 ifeq ($(canonhost),i386-unknown-sco3.2v4)
93 canonhost := i386-sco3.2v4
94 endif
95 ifeq ($(canonhost),i386-unknown-go32)
96 canonhost := i386-go32
97 endif
98 ifeq ($(canonhost),i386-unknown-sysv4.2)
99 canonhost := i386-sysv4.2
100 endif
101 ifeq ($(canonhost),i386-lynx-lynxos)
102 canonhost := i386-lynx
103 endif
104 ifeq ($(canonhost),m68k-lynx-lynxos)
105 canonhost := m68k-lynx
106 endif
107 ifeq ($(canonhost),sparc-lynx-lynxos)
108 canonhost := sparc-lynx
109 endif
110 ifeq ($(canonhost),rs6000-lynx-lynxos)
111 canonhost := rs6000-lynx
112 endif
113 ifeq ($(canonhost),i386-unknown-linux)
114 canonhost := i386-linux
115 endif
116 ifeq ($(canonhost),i486-unknown-linux)
117 canonhost := i486-linux
118 endif
119 ifeq ($(canonhost),i586-unknown-linux)
120 canonhost := i486-linux
121 endif
122 ifeq ($(canonhost),i386-unknown-linuxaout)
123 canonhost := i386-linuxaout
124 endif
125 ifeq ($(canonhost),i486-unknown-linuxaout)
126 canonhost := i486-linuxaout
127 endif
128 ifeq ($(canonhost),i586-unknown-linuxaout)
129 canonhost := i486-linuxaout
130 endif
131
132 #
133 # The following TARGETS variable settings probably ought to
134 # be made automatically from the 
135 # /s1/cygnus/progressive/host-target-pairs.tbl file, using
136 # the /s1/cygnus/progressive/targets script.  But, be sure
137 # that the native is spelled 'native'.
138 #
139
140 ifeq ($(canonhost),sparc-sun-sunos4.1.3)
141 TARGETS = $(NATIVE) \
142         i386-go32       \
143         a29k-amd-udi    \
144         h8300-hms       \
145         i386-aout       \
146         i386-lynx       \
147         i960-vxworks5.0 i960-vxworks5.1 \
148         mips-idt-ecoff  mips64-elf      mips-elf \
149         m68k-aout       m68k-vxworks    m68k-coff \
150         m68k-lynx       \
151         sh-hms          \
152         sparc-aout      sparc-lynx      sparc-vxworks   \
153         sparclite-aout  sparclite-vxworks \
154         sparclite-coff  z8k-coff \
155         OSE68000 OSE68k mips-ncd-elf
156 # The OSE68000 and OSE68k targets are for Ericsson only;
157 # the mips-ncd-elf target is for NCD only.
158 GCC = gcc -O2 -pipe
159 all: all-cygnus
160 endif
161
162 ifeq ($(canonhost),m68k-sun-sunos4.1.1)
163 TARGETS = $(NATIVE) \
164         m68k-coff 
165 GCC = gcc -O2 -msoft-float
166 CC = cc -J
167 all: all-cygnus
168 endif
169
170 ifeq ($(canonhost),sparc-sun-solaris2)
171 TARGETS = $(NATIVE) \
172         a29k-amd-udi \
173         i960-vxworks5.0 i960-vxworks5.1 \
174         m68k-aout       m68k-coff       m68k-vxworks \
175         mipsel-idt-ecoff sparc-lynx \
176         sparclite-aout sparclite-coff m88k-coff z8k-coff \
177         OSE68000 OSE68k \
178         sparc-sun-sunos4.1.3
179 # The latter assures that BNR's special build (which they now
180 # do for themselves from sources) hasn't developed bit-rot.
181 # The OSE68000 and OSE68k targets are for Ericsson only.
182
183 CC = cc
184 GCC = gcc -O2 -pipe
185 all: all-cygnus
186 endif
187
188 ifeq ($(canonhost),mips-dec-ultrix)
189 TARGETS = $(NATIVE) m68k-aout
190 CC = cc -Wf,-XNg1000
191 all: all-cygnus
192 endif
193
194 ifeq ($(patsubst alpha-dec-osf%,alpha,$(canonhost)),alpha)
195 TARGETS = $(NATIVE)
196 CC = cc
197 all: all-cygnus
198 endif
199
200 ifeq ($(canonhost),mips-sgi-irix4)
201 TARGETS = $(NATIVE) \
202         mips-idt-ecoff  sh-hms \
203         mips64-elf
204 CC = cc -cckr -Wf,-XNg1500 -Wf,-XNk1000 -Wf,-XNh2000
205 all: all-cygnus
206 endif
207
208 ifeq ($(canonhost),mips-sgi-irix5)
209 TARGETS = $(NATIVE) \
210         mips-idt-ecoff  sh-hms \
211         mips64-elf
212 CC = cc -cckr -Wf,-XNg1500 -Wf,-XNk1000 -Wf,-XNh2000
213 all: all-cygnus
214 endif
215
216 ifeq ($(canonhost),rs6000-ibm-aix)
217 TARGETS = $(NATIVE) \
218         i960-vxworks5.0 i960-vxworks5.1 \
219         m68k-aout
220 all: all-cygnus
221 endif
222
223 ifeq ($(canonhost),m68k-hp-hpux)
224 TARGETS = $(NATIVE)     m68k-aout
225 TMPDIR := $(shell mkdir $(canonhost)-tmpdir; cd $(canonhost)-tmpdir ; pwd)
226 CC = cc -Wp,-P 
227 #CFLAGS = +O1000 
228 CFLAGS = -g
229 all: all-cygnus
230 endif
231
232 ifeq ($(canonhost),hppa1.1-hp-hpux)
233 TARGETS = \
234         $(NATIVE) \
235         i960-vxworks5.0 i960-vxworks5.1 \
236         m68k-aout  m68k-coff  m68k-vxworks \
237         z8k-coff
238 CC = cc -Wp,-H256000
239 #CFLAGS = +Obb2000
240 CFLAGS = -g
241 all: all-cygnus
242 endif
243
244 ifeq ($(canonhost),i386-sco3.2v4)
245 TARGETS = $(NATIVE) i386-aout
246 all: all-cygnus
247 endif
248
249 ifeq ($(canonhost),i386-go32)
250 TARGETS = \
251         a29k-amd-udi \
252         h8300-hms       \
253         i386-aout       \
254         m68k-aout       m68k-coff \
255         mips-idt-ecoff  \
256         sh-hms          \
257         sparclite-aout
258 CC = i386-go32-gcc
259 GCC = i386-go32-gcc -O2
260 CFLAGS =
261 CXXFLAGS = -O2
262 MAKEINFOFLAGS = --no-split
263 all: all-dos
264 endif
265
266 ifeq ($(canonhost),i386-sysv4.2)
267 TARGETS = $(NATIVE) i386-netware
268 CC = cc
269 all: all-cygnus
270 endif
271
272 ifeq ($(canonhost),i386-lynx)
273 TARGETS = $(NATIVE)
274 CC = /usr/cygnus/progressive/bin/gcc
275 all: all-cygnus
276 SHELL=/bin/bash
277 endif
278
279 ifeq ($(canonhost),m68k-lynx)
280 TARGETS = $(NATIVE)
281 CC = /usr/cygnus/progressive/bin/gcc
282 all: all-cygnus
283 SHELL=/bin/bash
284 endif
285
286 ifeq ($(canonhost),sparc-lynx)
287 TARGETS = $(NATIVE)
288 CC = /usr/cygnus/progressive/bin/gcc
289 all: all-cygnus
290 SHELL=/bin/bash
291 endif
292
293 ifeq ($(canonhost),rs6000-lynx)
294 TARGETS = $(NATIVE)
295 CC = /usr/cygnus/progressive/bin/gcc
296 all: all-cygnus
297 SHELL=/bin/bash
298 endif
299
300 ifeq ($(patsubst %-linux,linux,$(patsubst %-linuxaout,linux,$(canonhost))),linux)
301 TARGETS = $(NATIVE)
302 all: all-cygnus
303 endif
304
305 FLAGS_TO_PASS := \
306         "GCC=$(GCC)" \
307         "CC=$(CC)" \
308         "CFLAGS=$(CFLAGS)" \
309         "GNUCFLAGS=$(GNUCFLAGS)" \
310         "CXXFLAGS=$(CXXFLAGS)" \
311         "host=$(canonhost)" \
312         "MAKEINFOFLAGS=$(MAKEINFOFLAGS)" \
313         "RELEASE_TAG=$(RELEASE_TAG)" \
314         "SHELL=$(SHELL)"
315
316 # set GNU_MAKE and CONFIG_SHELL correctly in sub-builds
317 ifeq ($(patsubst %-lynx,lynx,$(canonhost)),lynx)
318 FLAGS_TO_PASS := $(FLAGS_TO_PASS) "GNU_MAKE=$(MAKE)" "CONFIG_SHELL=/bin/bash"
319 endif
320
321 ifeq ($(patsubst %-linux,linux,$(patsubst %-linuxaout,linux,$(canonhost))),linux)
322 FLAGS_TO_PASS := $(FLAGS_TO_PASS) "GNU_MAKE=$(MAKE)"
323 endif
324
325 all-emacs:
326         @echo build started at `date`
327         [ -d $(INSTALLDIR) ] || mkdir $(INSTALLDIR)
328         -rm -f $(ROOTING)/$(RELEASE_TAG)
329         ln -s $(INSTALLDIR) $(ROOTING)/$(RELEASE_TAG) 
330         $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) do1 > $(canonhost)-emacs-native-log 2>&1 
331         $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) do-latest > $(canonhost)-emacs-latest-log 2>&1 
332         @echo done at `date`
333
334 all-cygnus:
335         @echo build started at `date`
336         [ -d $(INSTALLDIR) ] || mkdir $(INSTALLDIR)
337         -rm -f $(ROOTING)/$(RELEASE_TAG) && ln -s $(INSTALLDIR) $(ROOTING)/$(RELEASE_TAG) 
338 #
339 #      The following line to be used during regular progressive builds
340 #      to help developers test, but should be commented out for final
341 #      progressive build.
342 #
343 #      -rm -f $(ROOTING)/progressive-beta && ln -s $(RELEASE_TAG) $(ROOTING)/progresssive
344         @for i in $(TARGETS) ; do \
345           if [ "$$i" = "native" ] ; then \
346             if [ ! -f $(canonhost)-stamp-3stage-done ] ; then \
347               echo "3staging $(canonhost) native" ; \
348               echo Flags passed to make: $(FLAGS_TO_PASS) ; \
349               $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) $(canonhost)-stamp-3stage-done $(log) && \
350                  echo "     completed successfully" ; \
351             else \
352               true ; \
353             fi ; \
354           else \
355             echo "building $(canonhost) cross to $$i" ; \
356             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i do-cygnus $(cyglog) && \
357                echo "     completed successfully" ; \
358           fi ; \
359         done
360         @if [ ! -f $(canonhost)-stamp-3stage-checked ] ; then \
361           echo checking $(canonhost) native ; \
362           $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) $(canonhost)-check-3stage $(clog) ; \
363           touch $(canonhost)-stamp-3stage-checked ; \
364         else \
365           true ; \
366         fi
367         @echo done at `date`
368
369 native:
370         @echo build started at `date`
371         [ -d $(INSTALLDIR) ] || mkdir $(INSTALLDIR)
372         -rm -f $(ROOTING)/$(RELEASE_TAG) && ln -s $(INSTALLDIR) $(ROOTING)/$(RELEASE_TAG)
373 #       -rm -f $(ROOTING)/progressive-beta && ln -s $(RELEASE_TAG) $(ROOTING)/progressive-beta
374         $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) $(canonhost)-stamp-3stage-done $(log)
375         @echo done at `date`
376
377 build-cygnus:
378         @echo build started at `date`
379         @for i in $(TARGETS) ; do \
380           if [ "$$i" = "native" ] ; then \
381             if [ ! -f $(canonhost)-3stage-done ] ; then \
382               echo "3staging $(canonhost) native" ; \
383               $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) $(canonhost)-stamp-3stage-done $(log) && \
384                  echo "     completed successfully" ; \
385             fi ; \
386           else \
387             echo "building $(canonhost) cross to $$i:" `date` ; \
388             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i build-cygnus $(cyglog) && \
389                echo "     completed successfully" ; \
390           fi ; \
391         done
392         @echo done at `date`
393
394 build-latest:
395         @echo build started at `date`
396         @for i in $(TARGETS) ; do \
397           if [ "$$i" != "native" ] ; then \
398             echo "building $(canonhost) cross to $$i:" `date` ; \
399             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i build-latest $(latestlog) && \
400                echo "     completed successfully" ; \
401           fi ; \
402         done
403         @echo done at `date`
404
405 all-native:
406         [ -d $(INSTALLDIR) ] || mkdir $(INSTALLDIR)
407         rm -f $(ROOTING)/$(RELEASE_TAG)
408         ln -s $(INSTALLDIR) $(ROOTING)/$(RELEASE_TAG)
409         @for i in $(TARGETS) ; do \
410             echo "building $(canonhost) cross to $$i" ; \
411             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i do-native $(natlog) && \
412                echo "     completed successfully" ; \
413         done
414
415 all-cross:
416         [ -d $(INSTALLDIR) ] || mkdir $(INSTALLDIR)
417         rm -f $(ROOTING)/$(RELEASE_TAG)
418         ln -s $(INSTALLDIR) $(ROOTING)/$(RELEASE_TAG)
419         @for i in $(TARGETS) ; do \
420             echo "building $(canonhost) cross to $$i" ; \
421             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i build=$(build) do-cygnus $(cyglog) && \
422                echo "     completed successfully" ; \
423         done
424
425 do-dos:
426         $(MAKE) -f build-all.mk build=$(host) host=i386-go32 all-dos
427 all-dos:
428         @for i in $(TARGETS) ; do \
429             echo "building $(canonhost) cross to $$i" ; \
430             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) host=$(host) target=$$i do-dos $(cyglog) && \
431                echo "     completed successfully at `date`" ; \
432         done
433
434 config:
435         @for i in $(TARGETS) ; do \
436           if [ "$$i" = "native" ] ; then \
437             echo "config stage1 for $(canonhost)" ; \
438             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) do1-config $(log) && \
439                echo "     completed successfully" ; \
440           else \
441             echo "config $(canonhost) cross to $$i" ; \
442             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i do-native-config $(cyglog) && \
443                echo "     completed successfully" ;  \
444           fi ; \
445         done
446
447
448 build:
449         @for i in $(TARGETS) ; do \
450           if [ "$$i" = "native" ] ; then \
451             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) do1-build $(log) && \
452                echo "     completed successfully" ; \
453           else \
454             echo "building $(canonhost) cross to $$i" ; \
455             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i build-native $(natlog) && \
456                echo "     completed successfully" ; \
457           fi ; \
458         done
459
460
461 3build:
462         @for i in $(TARGETS) ; do \
463           if [ "$$i" = "native" ] ; then \
464             echo "building 3stage for $(canonhost)" ; \
465             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) all $(log) && \
466                echo "     completed successfully" ; \
467           else \
468             echo "building $(canonhost) cross to $$i" ; \
469             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i build-cygnus $(cyglog) && \
470                echo "     completed successfully" ; \
471           fi ; \
472         done
473
474 build-all-latest:
475         @for i in $(TARGETS) ; do \
476           if [ "$$i" = "native" ] ; then \
477             echo "building 3stage for $(canonhost)" ; \
478             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) $(canonhost)-stamp-3stage-done $(log) && \
479                echo "     completed successfully" ; \
480           else \
481             echo "building $(canonhost) cross to $$i" ; \
482             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i build-latest $(cyglog) && \
483                echo "     completed successfully" ; \
484           fi ; \
485         done
486
487 clean:
488         $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) clean $(log)
489
490 ### Local Variables:
491 ### fill-column: 131
492 ### End: