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