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