* build-all.mk: If host not specified, use config.guess. Pass TAG
[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 #
7
8 TREE    = devo
9
10 NATIVE  = native
11
12 DATE    = 930401
13
14 TAG     = latest-$(DATE)
15
16 INSTALLDIR = /build/ian/devo-test/$(TAG)
17
18 ifndef host
19 host := $(shell $(TREE)/config.guess)
20 endif
21
22 GCC = gcc -O 
23 CFLAGS = -g
24
25 log     = 1>$(canonhost)-build-log 2>&1
26 tlog    = 1> $(canonhost)-x-$$i-build-log 2>&1
27
28 canonhost := $(shell $(TREE)/config.sub $(host))
29
30 # Convert config.guess results to a simpler form.
31 ifeq ($(canonhost),mips-dec-ultrix4.2)
32 canonhost := mips-dec-ultrix
33 endif
34 ifeq ($(canonhost),mips-sgi-irix4.0.1)
35 canonhost := mips-sgi-irix4
36 endif
37 ifeq ($(canonhost),i486-unknown-sco3.2v4.0)
38 canonhost := i386-sco3.2v4
39 endif
40
41 ifeq ($(canonhost),sparc-sun-sunos4.1.1)
42 TARGETS = $(NATIVE) m68k-aout   i386-aout       a29k-amd-udi \
43         i960-vxworks            m68k-coff       m68k-vxworks \
44         i960-intel-nindy        sparc-aout      sparc-vxworks \
45         sparclite-aout          sparclitefrwcompat-aout
46 all: all-cygnus
47 endif
48
49 ifeq ($(canonhost),m68k-sun-sunos4.1.1)
50 TARGETS = $(NATIVE) m68k-vxworks m68k-aout i386-aout
51 GCC = gcc -O -msoft-float
52 CC = cc -J
53 all: all-cygnus
54 endif
55
56 ifeq ($(canonhost),sparc-sun-solaris2)
57 TARGETS = $(NATIVE) m68k-aout sparc-aout a29k-amd-udi
58 CC = cc -Xs
59 all: all-cygnus
60 endif
61
62 ifeq ($(canonhost),mips-dec-ultrix)
63 TARGETS = $(NATIVE) m68k-vxworks m68k-aout i960-vxworks \
64           sparc-vxworks m68k-coff i386-aout sparc-aout i960-intel-nindy
65 CC = cc -Wf,-XNg1000
66 all: all-cygnus
67 endif
68
69 ifeq ($(canonhost),mips-sgi-irix4)
70 TARGETS = $(NATIVE) m68k-vxworks a29k-amd-udi
71 CC = cc -cckr -Wf,-XNg1500 -Wf,-XNk1000 -Wf,-XNh1500
72 all: all-cygnus
73 endif
74
75 ifeq ($(canonhost),rs6000-ibm-aix)
76 TARGETS = $(NATIVE) m68k-vxworks i960-vxworks m68k-aout
77 all: all-cygnus
78 endif
79
80 ifeq ($(canonhost),m68k-hp-hpux)
81 TARGETS = m68k-vxworks
82 TMPDIR := $(shell mkdir $(canonhost)-tmpdir; cd $(canonhost)-tmpdir ; pwd)
83 CC = cc +O1000 -Wp,-P
84 CFLAGS = 
85 all: all-native
86 endif
87
88 ifeq ($(canonhost),hppa1.1-hp-hpux)
89 #TARGETS        = m68k-aout m68k-coff m68k-vxworks i960-vxworks a29k-amd-udi
90 TARGETS = m68k-aout     i386-aout       a29k-amd-udi \
91           i960-vxworks  m68k-coff       m68k-vxworks \
92           sparc-aout                    sparc-vxworks \
93           sparclite-aout                sparclitefrwcompat-aout
94 CC = cc 
95 all: all-native
96 endif
97
98 ifeq ($(canonhost),i386-sco3.2v4)
99 TARGETS = $(NATIVE) i386-aout
100 all: all-cygnus
101 endif
102
103 FLAGS_TO_PASS := \
104         "GCC=$(GCC)" \
105         "CC=$(CC)" \
106         "CFLAGS=$(CFLAGS)" \
107         "host=$(canonhost)" \
108         "RELEASE_TAG=$(TAG)"
109
110 all-cygnus:
111         @echo build started at `date`
112         [ -d $(INSTALLDIR) ] || mkdir $(INSTALLDIR)
113         rm -f /usr/cygnus/$(TAG)
114         ln -s $(INSTALLDIR) /usr/cygnus/$(TAG) 
115         @for i in $(TARGETS) ; do \
116           if [ "$$i" = "native" ] ; then \
117             if [ ! -f $(canonhost)-3stage-done ] ; then \
118               echo "3staging $(canonhost) native" ; \
119               $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) $(canonhost)-stamp-3stage-done $(log) && \
120                  echo "     completed successfully" ; \
121             fi \
122           else \
123             echo "building $(canonhost) cross to $$i" ; \
124             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i do-cygnus $(tlog) && \
125                echo "     completed successfully" ; \
126           fi ; \
127         done
128         @echo done at `date`
129
130 native:
131         @echo build started at `date`
132         [ -d $(INSTALLDIR) ] || mkdir $(INSTALLDIR)
133         rm -f /usr/cygnus/$(TAG)
134         ln -s $(INSTALLDIR) /usr/cygnus/$(TAG) 
135         $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) $(canonhost)-stamp-3stage-done $(log)
136         @echo done at `date`
137
138 build-cygnus:
139         @echo build started at `date`
140         @for i in $(TARGETS) ; do \
141           if [ "$$i" = "native" ] ; then \
142             if [ ! -f $(canonhost)-3stage-done ] ; then \
143               echo "3staging $(canonhost) native" ; \
144               $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) $(canonhost)-stamp-3stage-done $(log) && \
145                  echo "     completed successfully" ; \
146             fi \
147           else \
148             echo "building $(canonhost) cross to $$i:" `date` ; \
149             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i build-cygnus $(tlog) && \
150                echo "     completed successfully" ; \
151           fi ; \
152         done
153         @echo done at `date`
154
155 all-native:
156         [ -d $(INSTALLDIR) ] || mkdir $(INSTALLDIR)
157         rm -f /usr/cygnus/$(TAG)
158         ln -s $(INSTALLDIR) /usr/cygnus/$(TAG)
159         @for i in $(TARGETS) ; do \
160             echo "building $(canonhost) cross to $$i" ; \
161             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i do-native $(tlog) && \
162                echo "     completed successfully" ; \
163         done
164
165 config:
166         @for i in $(TARGETS) ; do \
167           if [ "$$i" = "native" ] ; then \
168             echo "config stage1 for $(canonhost)" ; \
169             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) do1-config $(log) && \
170                echo "     completed successfully" ; \
171           else \
172             echo "config $(canonhost) cross to $$i" ; \
173             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i do-native-config $(tlog) && \
174                echo "     completed successfully" ;  \
175           fi ; \
176         done
177
178
179 build:
180         @for i in $(TARGETS) ; do \
181           if [ "$$i" = "native" ] ; then \
182             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) do1-build $(log) && \
183                echo "     completed successfully" ; \
184           else \
185             echo "building $(canonhost) cross to $$i" ; \
186             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i build-native $(tlog) && \
187                echo "     completed successfully" ; \
188           fi ; \
189         done
190
191
192 3build:
193         @for i in $(TARGETS) ; do \
194           if [ "$$i" = "native" ] ; then \
195             echo "building 3stage for $(canonhost)" ; \
196             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) all $(log) && \
197                echo "     completed successfully" ; \
198           else \
199             echo "building $(canonhost) cross to $$i" ; \
200             $(MAKE) -f test-build.mk $(FLAGS_TO_PASS) target=$$i build-cygnus $(tlog) && \
201                echo "     completed successfully" ; \
202           fi ; \
203         done
204
205 ### Local Variables:
206 ### fill-column: 131
207 ### End: