Commit | Line | Data |
---|---|---|
c12d9b4c RP |
1 | ### |
2 | ### Makefile used to three-stage build a tree of source code. Also used to | |
3 | ### compile other bundles, first with cc, then with gcc. | |
4 | ### | |
5 | ||
5ba00487 DZ |
6 | ### |
7 | ### USE OF THIS FILE REQUIRES GNU MAKE!!! | |
8 | ### | |
9 | ||
10 | ### The first versions of the file were written by Rich Pixley (rich@cygnus.com). | |
11 | ### Many subsequent additions (and current maintainance by) david d `zoo' zuhn, | |
12 | ### (zoo@cygnus.com). | |
c12d9b4c RP |
13 | |
14 | ### Every invocation of this Makefile needs to have a variable set (host), | |
15 | ### which is the named used for ./configure, and also the prefix for the | |
16 | ### various files and directories used in a three stage. | |
17 | ||
18 | ifndef host | |
5ba00487 DZ |
19 | error: |
20 | @echo You must set the variable \"host\" to use this Makefile ; exit 1 | |
c12d9b4c RP |
21 | else |
22 | ||
23 | ### from here to very near the end of the file is the real guts of this | |
24 | ### Makefile, and it is not seen if the variable 'host' is not set | |
25 | ||
26 | ### | |
27 | ### START EDITTING HERE!!! | |
28 | ### These things will need to be set differently for each release. | |
29 | ### | |
30 | ||
31 | ### from which cvs tree are we working? | |
8b510607 | 32 | TREE := devo |
c12d9b4c RP |
33 | |
34 | ### binaries should be installed into? | |
35 | ROOTING := /usr/cygnus | |
36 | ||
37 | ### When working from a tagged set of source, this should be the tag. If not, | |
38 | ### then set the macro to be empty. | |
5ba00487 | 39 | CVS_TAG := |
c12d9b4c RP |
40 | |
41 | ### The name of the cvs module for this release. The intersection of | |
42 | ### CVS_MODULE and CVS_TAG defines the source files in this release. | |
5ba00487 | 43 | CVS_MODULE := latest |
c12d9b4c RP |
44 | |
45 | ### Historically, this was identical to CVS_TAG. This is changing. | |
af5874bd | 46 | RELEASE_TAG := latest-930202 |
c12d9b4c RP |
47 | |
48 | ### Historically, binaries were installed here. This is changing. | |
49 | release_root := $(ROOTING)/$(RELEASE_TAG) | |
50 | ||
51 | ### STOP EDITTING HERE!!! | |
52 | ### With luck, eventually, nothing else will need to be editted. | |
53 | ||
5ba00487 DZ |
54 | TIME := time |
55 | GCC := gcc -O -g | |
56 | GNUC := "CC=$(GCC)" | |
57 | CFLAGS := -g | |
58 | GNU_MAKE := /usr/latest/bin/make -w | |
c12d9b4c | 59 | |
5ba00487 DZ |
60 | override MAKE := make |
61 | override MFLAGS := | |
62 | #override MAKEFLAGS := | |
c12d9b4c | 63 | |
5ba00487 | 64 | SHELL := /bin/sh |
c12d9b4c RP |
65 | |
66 | FLAGS_TO_PASS := \ | |
41a88234 | 67 | "CC=$(CC)" \ |
c12d9b4c | 68 | "GCC=$(GCC)" \ |
5ba00487 | 69 | "CFLAGS=$(CFLAGS)" \ |
c12d9b4c | 70 | "TIME=$(TIME)" \ |
5ba00487 DZ |
71 | "MF=$(MF)" \ |
72 | "host=$(host)" | |
73 | ||
74 | ||
41a88234 | 75 | prefixes = --prefix=$(release_root) --exec_prefix=$(release_root)/H-$(host) |
5ba00487 DZ |
76 | relbindir = $(release_root)/H-$(host)/bin |
77 | ||
c12d9b4c RP |
78 | |
79 | ### general config stuff | |
5ba00487 DZ |
80 | WORKING_DIR := $(host)-objdir |
81 | STAGE1DIR := $(WORKING_DIR).1 | |
82 | STAGE2DIR := $(WORKING_DIR).2 | |
83 | STAGE3DIR := $(WORKING_DIR).3 | |
84 | INPLACEDIR := $(host)-in-place | |
85 | HOLESDIR := $(host)-holes | |
c12d9b4c | 86 | |
41a88234 ILT |
87 | SET_HOLES := SHELL=sh ; PATH=`pwd`/$(HOLESDIR) ; export PATH ; export SHELL ; |
88 | SET_CYGNUS_PATH := SHELL=sh ; PATH=$(relbindir):`pwd`/$(HOLESDIR) ; export PATH ; export SHELL ; | |
89 | SET_LATEST_PATH := SHELL=sh ; PATH=/usr/latest/bin:`pwd`/$(HOLESDIR) ; export PATH ; export SHELL ; | |
90 | ||
91 | ||
92 | ||
c12d9b4c | 93 | .PHONY: all |
5ba00487 DZ |
94 | ifdef target |
95 | ## | |
96 | ## This is a cross compilation | |
97 | ## | |
98 | arch = $(host)-x-$(target) | |
99 | config = $(host) -target=$(target) | |
100 | NATIVEDIR := $(arch)-native-objdir | |
101 | CYGNUSDIR := $(arch)-cygnus-objdir | |
102 | LATESTDIR := $(arch)-latest-objdir | |
103 | FLAGS_TO_PASS := $(FLAGS_TO_PASS) "target=$(target)" | |
104 | ||
105 | all: do-native do-latest | |
106 | build-all: build-native build-latest | |
107 | ||
108 | else | |
109 | ## | |
110 | ## This is a native compilation | |
111 | ## | |
112 | all: $(host)-stamp-3stage-done | |
113 | #all: in-place do1 do2 do3 comparison | |
114 | endif | |
115 | ||
116 | everything: do-cross | |
117 | #everything: in-place do1 do2 do3 comparison do-cygnus | |
118 | ||
119 | .PHONY: do-native | |
120 | do-native: $(host)-stamp-holes $(arch)-stamp-native | |
121 | do-native-config: $(arch)-stamp-native-configured | |
122 | build-native: $(host)-stamp-holes $(arch)-stamp-native-checked | |
123 | config-native: $(host)-stamp-holes $(arch)-stamp-native-configured | |
124 | ||
41a88234 ILT |
125 | $(arch)-stamp-native: $(host)-stamp-holes |
126 | $(SET_HOLES) $(TIME) $(GNU_MAKE) -f test-build.mk $(arch)-stamp-native-installed $(FLAGS_TO_PASS) | |
5ba00487 DZ |
127 | if [ -f CLEAN_ALL ] ; then rm -rf $(NATIVEDIR) ; else true ; fi |
128 | touch $(arch)-stamp-native | |
129 | ||
41a88234 ILT |
130 | $(arch)-stamp-native-installed: $(host)-stamp-holes $(arch)-stamp-native-checked |
131 | $(SET_HOLES) cd $(NATIVEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) install | |
132 | $(SET_HOLES) cd $(NATIVEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) install-info | |
5ba00487 DZ |
133 | touch $@ |
134 | ||
135 | $(arch)-stamp-native-checked: $(arch)-stamp-native-built | |
136 | # cd $(NATIVEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) check | |
137 | touch $@ | |
138 | ||
41a88234 ILT |
139 | $(arch)-stamp-native-built: $(host)-stamp-holes $(arch)-stamp-native-configured |
140 | $(SET_HOLES) cd $(NATIVEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) all | |
141 | $(SET_HOLES) cd $(NATIVEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) info | |
5ba00487 DZ |
142 | touch $@ |
143 | ||
41a88234 | 144 | $(arch)-stamp-native-configured: $(host)-stamp-holes |
5ba00487 | 145 | [ -d $(NATIVEDIR) ] || mkdir $(NATIVEDIR) |
41a88234 | 146 | $(SET_HOLES) cd $(NATIVEDIR) ; $(TIME) ../$(TREE)/configure $(config) -v --srcdir=../$(TREE) $(prefixes) |
5ba00487 DZ |
147 | touch $@ |
148 | ||
149 | ||
150 | .PHONY: do-cygnus | |
151 | do-cygnus: $(host)-stamp-holes $(arch)-stamp-cygnus | |
152 | build-cygnus: $(host)-stamp-holes $(arch)-stamp-cygnus-checked | |
153 | config-cygnus: $(host)-stamp-holes $(arch)-stamp-cygnus-configured | |
154 | ||
155 | $(arch)-stamp-cygnus: | |
156 | [ -f $(relbindir)/gcc ] || (echo "must have gcc available"; exit 1) | |
41a88234 | 157 | $(SET_CYGNUS_PATH) $(TIME) $(GNU_MAKE) -f test-build.mk $(arch)-stamp-cygnus-installed $(FLAGS_TO_PASS) |
5ba00487 DZ |
158 | if [ -f CLEAN_ALL ] ; then rm -rf $(CYGNUSDIR) ; else true ; fi |
159 | touch $(arch)-stamp-cygnus | |
160 | ||
41a88234 ILT |
161 | $(arch)-stamp-cygnus-installed: $(host)-stamp-holes $(arch)-stamp-cygnus-checked |
162 | $(SET_CYGNUS_PATH) cd $(CYGNUSDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) install | |
163 | $(SET_CYGNUS_PATH) cd $(CYGNUSDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) install-info | |
5ba00487 DZ |
164 | touch $@ |
165 | ||
41a88234 | 166 | $(arch)-stamp-cygnus-checked: $(host)-stamp-holes $(arch)-stamp-cygnus-built |
5ba00487 DZ |
167 | # cd $(CYGNUSDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) check |
168 | touch $@ | |
169 | ||
41a88234 ILT |
170 | $(arch)-stamp-cygnus-built: $(host)-stamp-holes $(arch)-stamp-cygnus-configured |
171 | $(SET_CYGNUS_PATH) cd $(CYGNUSDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) all | |
172 | $(SET_CYGNUS_PATH) cd $(CYGNUSDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) info | |
5ba00487 DZ |
173 | touch $@ |
174 | ||
41a88234 | 175 | $(arch)-stamp-cygnus-configured: $(host)-stamp-holes |
5ba00487 | 176 | [ -d $(CYGNUSDIR) ] || mkdir $(CYGNUSDIR) |
41a88234 | 177 | $(SET_CYGNUS_PATH) cd $(CYGNUSDIR) ; $(TIME) ../$(TREE)/configure $(config) -v --srcdir=../$(TREE) $(prefixes) |
5ba00487 DZ |
178 | touch $@ |
179 | ||
180 | .PHONY: do-latest | |
181 | do-latest: $(host)-stamp-holes $(arch)-stamp-latest | |
182 | build-latest: $(host)-stamp-holes $(arch)-stamp-latest-checked | |
183 | ||
184 | $(arch)-stamp-latest: | |
41a88234 | 185 | $(SET_LATEST_PATH) $(TIME) $(GNU_MAKE) -f test-build.mk $(arch)-stamp-latest-installed $(FLAGS_TO_PASS) |
5ba00487 DZ |
186 | touch $(arch)-stamp-latest |
187 | ||
188 | $(arch)-stamp-latest-installed: $(arch)-stamp-latest-checked | |
41a88234 ILT |
189 | $(SET_LATEST_PATH) cd $(LATESTDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) install |
190 | $(SET_LATEST_PATH) cd $(LATESTDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) install-info | |
5ba00487 DZ |
191 | touch $@ |
192 | ||
193 | $(arch)-stamp-latest-checked: $(arch)-stamp-latest-built | |
41a88234 | 194 | # $(SET_LATEST_PATH) cd $(LATESTDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) check |
5ba00487 DZ |
195 | touch $@ |
196 | ||
197 | $(arch)-stamp-latest-built: $(arch)-stamp-latest-configured | |
41a88234 ILT |
198 | $(SET_LATEST_PATH) cd $(LATESTDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) all |
199 | $(SET_LATEST_PATH) cd $(LATESTDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) info | |
5ba00487 DZ |
200 | touch $@ |
201 | ||
202 | $(arch)-stamp-latest-configured: | |
203 | [ -d $(LATESTDIR) ] || mkdir $(LATESTDIR) | |
41a88234 ILT |
204 | $(SET_LATEST_PATH) cd $(LATESTDIR) ; \ |
205 | $(TIME) ../$(TREE)/configure $(config) -v --srcdir=../$(TREE) $(prefixes) | |
5ba00487 DZ |
206 | touch $@ |
207 | ||
7bea9148 RP |
208 | |
209 | .PHONY: in-place | |
210 | in-place: $(host)-stamp-in-place | |
211 | ||
5ba00487 | 212 | $(host)-stamp-in-place: |
7bea9148 | 213 | PATH=/bin:/usr/bin:/usr/ucb ; \ |
5ba00487 DZ |
214 | export PATH ; \ |
215 | SHELL=/bin/sh ; export SHELL ; \ | |
216 | $(TIME) $(GNU_MAKE) -f test-build.mk $(host)-stamp-in-place-installed host=$(host) $(FLAGS_TO_PASS) | |
7bea9148 | 217 | touch $@ |
5ba00487 DZ |
218 | if [ -f CLEAN_ALL ] ; then \ |
219 | rm -rf $(INPLACEDIR) ; \ | |
220 | else \ | |
221 | mv $(INPLACEDIR) $(STAGE1DIR) ; \ | |
222 | fi | |
7bea9148 RP |
223 | |
224 | $(host)-stamp-in-place-installed: $(host)-stamp-in-place-checked | |
41a88234 ILT |
225 | cd $(INPLACEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" install host=$(host) |
226 | cd $(INPLACEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" install-info host=$(host) | |
7bea9148 RP |
227 | touch $@ |
228 | ||
229 | $(host)-stamp-in-place-checked: $(host)-stamp-in-place-built | |
41a88234 | 230 | # cd $(INPLACEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" check host=$(host) |
7bea9148 RP |
231 | touch $@ |
232 | ||
233 | $(host)-stamp-in-place-built: $(host)-stamp-in-place-configured | |
41a88234 ILT |
234 | cd $(INPLACEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" all host=$(host) |
235 | cd $(INPLACEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" info host=$(host) | |
7bea9148 RP |
236 | touch $@ |
237 | ||
238 | $(host)-stamp-in-place-configured: $(host)-stamp-in-place-cp | |
5ba00487 | 239 | cd $(INPLACEDIR) ; $(TIME) ./configure $(host) -v $(prefixes) |
7bea9148 RP |
240 | touch $@ |
241 | ||
242 | $(host)-stamp-in-place-cp: | |
243 | rm -rf $(INPLACEDIR) | |
244 | mkdir $(INPLACEDIR) | |
245 | (cd $(TREE) ; tar cf - .) | (cd $(INPLACEDIR) ; tar xf -) | |
246 | touch $@ | |
c12d9b4c | 247 | |
5ba00487 DZ |
248 | $(host)-stamp-3stage-done: do1 do2 do3 comparison |
249 | touch $@ | |
250 | ||
251 | ||
c12d9b4c | 252 | .PHONY: do1 |
41a88234 ILT |
253 | do1: $(host)-stamp-holes $(host)-stamp-stage1 |
254 | do1-config: $(host)-stamp-holes $(host)-stamp-stage1-configured | |
255 | do1-build: $(host)-stamp-holes $(host)-stamp-stage1-checked | |
c12d9b4c RP |
256 | |
257 | $(host)-stamp-stage1: | |
258 | if [ -d $(STAGE1DIR) ] ; then \ | |
259 | mv $(STAGE1DIR) $(WORKING_DIR) ; \ | |
260 | else \ | |
261 | true ; \ | |
262 | fi | |
41a88234 | 263 | $(SET_HOLES) $(TIME) $(GNU_MAKE) -f test-build.mk $(FLAGS_TO_PASS) host=$(host) $(host)-stamp-stage1-installed |
7bea9148 | 264 | touch $@ |
5ba00487 DZ |
265 | if [ -f CLEAN_ALL ] ; then \ |
266 | rm -rf $(WORKING_DIR) ; \ | |
267 | else \ | |
268 | mv $(WORKING_DIR) $(STAGE1DIR) ; \ | |
269 | fi | |
c12d9b4c RP |
270 | |
271 | $(host)-stamp-stage1-installed: $(host)-stamp-stage1-checked | |
41a88234 ILT |
272 | $(SET_HOLES) cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" install host=$(host) |
273 | $(SET_HOLES) cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" install-info host=$(host) | |
fdfa2371 DZ |
274 | ifeq ($(host),rs6000-ibm-aix) |
275 | rm $(relbindir)/make | |
276 | endif | |
c12d9b4c RP |
277 | touch $@ |
278 | ||
279 | $(host)-stamp-stage1-checked: $(host)-stamp-stage1-built | |
41a88234 | 280 | # $(SET_HOLES) cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" check host=$(host) |
c12d9b4c RP |
281 | touch $@ |
282 | ||
283 | $(host)-stamp-stage1-built: $(host)-stamp-stage1-configured | |
41a88234 ILT |
284 | $(SET_HOLES) cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" all host=$(host) |
285 | $(SET_HOLES) cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" info host=$(host) | |
c12d9b4c RP |
286 | touch $@ |
287 | ||
288 | $(host)-stamp-stage1-configured: | |
289 | [ -d $(WORKING_DIR) ] || mkdir $(WORKING_DIR) | |
41a88234 ILT |
290 | $(SET_HOLES) cd $(WORKING_DIR) ; \ |
291 | $(TIME) ../$(TREE)/configure $(host) -v --srcdir=../$(TREE) $(prefixes) | |
c12d9b4c RP |
292 | touch $@ |
293 | ||
294 | .PHONY: do2 | |
295 | do2: $(HOLESDIR) $(host)-stamp-stage2 | |
296 | ||
297 | $(host)-stamp-stage2: | |
298 | if [ -d $(STAGE2DIR) ] ; then \ | |
299 | mv $(STAGE2DIR) $(WORKING_DIR) ; \ | |
300 | else \ | |
301 | true ; \ | |
302 | fi | |
41a88234 | 303 | $(SET_CYGNUS_PATH) $(TIME) $(GNU_MAKE) $(FLAGS_TO_PASS) -f test-build.mk -w $(host)-stamp-stage2-installed |
5ba00487 | 304 | mv $(WORKING_DIR) $(STAGE2DIR) |
7bea9148 | 305 | touch $@ |
c12d9b4c | 306 | |
c12d9b4c RP |
307 | |
308 | $(host)-stamp-stage2-installed: $(host)-stamp-stage2-checked | |
41a88234 ILT |
309 | $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" install host=$(host) |
310 | $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" install-info host=$(host) | |
c12d9b4c RP |
311 | touch $@ |
312 | ||
313 | $(host)-stamp-stage2-checked: $(host)-stamp-stage2-built | |
41a88234 | 314 | # $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" check host=$(host) |
c12d9b4c RP |
315 | touch $@ |
316 | ||
317 | $(host)-stamp-stage2-built: $(host)-stamp-stage2-configured | |
41a88234 ILT |
318 | $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" all host=$(host) |
319 | $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" info host=$(host) | |
c12d9b4c RP |
320 | touch $@ |
321 | ||
322 | $(host)-stamp-stage2-configured: | |
323 | [ -d $(WORKING_DIR) ] || mkdir $(WORKING_DIR) | |
41a88234 ILT |
324 | $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; \ |
325 | $(TIME) ../$(TREE)/configure $(host) -v --srcdir=../$(TREE) $(prefixes) | |
c12d9b4c RP |
326 | touch $@ |
327 | ||
328 | .PHONY: do3 | |
329 | do3: $(HOLESDIR) $(host)-stamp-stage3 | |
330 | ||
331 | $(host)-stamp-stage3: | |
5ba00487 DZ |
332 | if [ -d $(STAGE3DIR) ] ; then \ |
333 | mv $(STAGE3DIR) $(WORKING_DIR) ; \ | |
c12d9b4c RP |
334 | else \ |
335 | true ; \ | |
336 | fi | |
41a88234 | 337 | $(SET_CYGNUS_PATH) $(TIME) $(GNU_MAKE) $(FLAGS_TO_PASS) -f test-build.mk -w $(host)-stamp-stage3-checked |
5ba00487 | 338 | mv $(WORKING_DIR) $(STAGE3DIR) |
7bea9148 | 339 | touch $@ |
c12d9b4c | 340 | |
c12d9b4c RP |
341 | |
342 | $(host)-stamp-stage3-installed: $(host)-stamp-stage3-checked | |
41a88234 ILT |
343 | $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" install host=$(host) |
344 | $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" install-info host=$(host) | |
c12d9b4c RP |
345 | touch $@ |
346 | ||
347 | $(host)-stamp-stage3-checked: $(host)-stamp-stage3-built | |
41a88234 | 348 | # $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" check host=$(host) |
c12d9b4c RP |
349 | touch $@ |
350 | ||
351 | $(host)-stamp-stage3-built: $(host)-stamp-stage3-configured | |
41a88234 ILT |
352 | $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" all host=$(host) |
353 | $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" info host=$(host) | |
c12d9b4c RP |
354 | touch $@ |
355 | ||
356 | $(host)-stamp-stage3-configured: | |
357 | [ -d $(WORKING_DIR) ] || mkdir $(WORKING_DIR) | |
41a88234 ILT |
358 | $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; \ |
359 | $(TIME) ../$(TREE)/configure $(host) -v --srcdir=../$(TREE) $(prefixes) | |
c12d9b4c RP |
360 | touch $@ |
361 | ||
362 | # These things are needed by a three-stage, but are not included locally. | |
363 | ||
364 | HOLES := \ | |
365 | [ \ | |
366 | ar \ | |
367 | as \ | |
368 | awk \ | |
369 | basename \ | |
370 | cat \ | |
371 | cc \ | |
372 | chmod \ | |
373 | cmp \ | |
374 | cp \ | |
41a88234 | 375 | cpio \ |
c12d9b4c RP |
376 | date \ |
377 | diff \ | |
378 | echo \ | |
379 | egrep \ | |
380 | ex \ | |
381 | expr \ | |
382 | find \ | |
383 | grep \ | |
5ba00487 | 384 | head \ |
c12d9b4c RP |
385 | hostname \ |
386 | install \ | |
387 | ld \ | |
388 | lex \ | |
389 | ln \ | |
390 | ls \ | |
391 | make \ | |
392 | mkdir \ | |
393 | mv \ | |
394 | nm \ | |
395 | pwd \ | |
396 | ranlib \ | |
397 | rm \ | |
398 | rmdir \ | |
399 | sed \ | |
400 | sh \ | |
401 | sort \ | |
41a88234 | 402 | tar \ |
c12d9b4c RP |
403 | test \ |
404 | time \ | |
405 | touch \ | |
406 | tr \ | |
407 | true \ | |
41a88234 | 408 | uudecode \ |
40a75cc7 | 409 | wc \ |
c12d9b4c RP |
410 | whoami |
411 | ||
412 | ### so far only sun make supports VPATH | |
413 | ifeq ($(subst sun3,sun4,$(host)),sun4) | |
414 | MAKE_HOLE := | |
415 | else | |
416 | MAKE_HOLE := make | |
417 | endif | |
418 | ||
5ba00487 DZ |
419 | ### solaris 2 -- don't use /usr/ucb/cc |
420 | ifeq (sparc-sun-solaris2,$(host)) | |
af5874bd DZ |
421 | SET_HOLES := SHELL=sh ; PATH=/opt/SUNWspro/bin:`pwd`/$(HOLESDIR) ; export PATH ; export SHELL ; |
422 | HOLE_DIRS := /usr/ccs/bin | |
423 | PARTIAL_HOLE_DIRS := /opt/SUNWspro/bin | |
424 | CC_HOLE := | |
5ba00487 DZ |
425 | endif |
426 | ||
c12d9b4c | 427 | ### rs6000 as is busted. We cache a patched version in unsupported. |
5ba00487 | 428 | ifeq ($(host),rs6000-ibm-aix) |
c12d9b4c RP |
429 | AS_HOLE := as |
430 | else | |
431 | AS_HOLE := | |
432 | endif | |
433 | ||
434 | ### These things are also needed by a three-stage, but in this case, the GNU version of the tool is required. | |
435 | PARTIAL_HOLES := \ | |
436 | $(AS_HOLE) \ | |
437 | $(MAKE_HOLE) \ | |
5ba00487 | 438 | $(CC_HOLE) \ |
c12d9b4c RP |
439 | flex \ |
440 | m4 | |
441 | ||
442 | ### look in these directories for things missing from a three-stage | |
443 | HOLE_DIRS := \ | |
fdfa2371 | 444 | $(HOLE_DIRS) \ |
c12d9b4c RP |
445 | /bin \ |
446 | /usr/bin \ | |
447 | /usr/ucb \ | |
448 | /usr/unsupported/bin | |
449 | ||
450 | ### look in these directories for alternate versions of some tools. | |
451 | PARTIAL_HOLE_DIRS := \ | |
452 | /usr/latest/bin \ | |
453 | /usr/progressive/bin \ | |
fdfa2371 | 454 | $(PARTIAL_HOLE_DIRS) \ |
c12d9b4c RP |
455 | /usr/vintage/bin \ |
456 | /usr/unsupported/bin | |
457 | ||
458 | $(HOLESDIR): $(host)-stamp-holes | |
459 | ||
460 | $(host)-stamp-holes: | |
461 | -rm -rf $(HOLESDIR) | |
462 | -mkdir $(HOLESDIR) | |
5ba00487 | 463 | @for i in $(HOLES) ; do \ |
c12d9b4c RP |
464 | found= ; \ |
465 | for j in $(HOLE_DIRS) ; do \ | |
466 | if [ -x $$j/$$i ] ; then \ | |
21412832 | 467 | ln -s $$j/$$i $(HOLESDIR) || cp $$j/$$i $(HOLESDIR) ; \ |
c12d9b4c RP |
468 | echo $$i from $$j ; \ |
469 | found=t ; \ | |
470 | break ; \ | |
471 | fi ; \ | |
472 | done ; \ | |
473 | case "$$found" in \ | |
474 | t) ;; \ | |
475 | *) echo $$i is NOT found ;; \ | |
476 | esac ; \ | |
477 | done | |
5ba00487 | 478 | @for i in $(PARTIAL_HOLES) ; do \ |
c12d9b4c RP |
479 | found= ; \ |
480 | for j in $(PARTIAL_HOLE_DIRS) ; do \ | |
481 | if [ -x $$j/$$i ] ; then \ | |
482 | rm -f $(HOLESDIR)/$$i ; \ | |
483 | cp $$j/$$i $(HOLESDIR)/$$i || exit 1; \ | |
484 | echo $$i from $$j ; \ | |
485 | found=t ; \ | |
486 | break ; \ | |
487 | fi ; \ | |
488 | done ; \ | |
489 | case "$$found" in \ | |
490 | t) ;; \ | |
491 | *) echo $$i is NOT found ;; \ | |
492 | esac ; \ | |
493 | done | |
7bea9148 | 494 | touch $@ |
c12d9b4c RP |
495 | |
496 | .PHONY: comparison | |
5ba00487 DZ |
497 | comparison: $(host)-stamp-3stage-compared |
498 | ||
499 | $(host)-stamp-3stage-compared: | |
500 | rm -f .bad-compare | |
21412832 | 501 | ifeq ($(subst i386-sco3.2v4,mips-sgi-irix4,$(subst rs6000-ibm-aix,mips-sgi-irix4,$(subst mips-dec-ultrix,mips-sgi-irix4,$(host)))),mips-sgi-irix4) |
5ba00487 DZ |
502 | for i in `cd $(STAGE3DIR) ; find . -name \*.o -print` ; do \ |
503 | tail +10c $(STAGE2DIR)/$$i > foo1 ; \ | |
504 | tail +10c $(STAGE3DIR)/$$i > foo2 ; \ | |
505 | if cmp foo1 foo2 ; then \ | |
506 | true ; \ | |
507 | else \ | |
508 | echo $$i ; \ | |
509 | touch .bad-compare ; \ | |
510 | fi ; \ | |
511 | done | |
512 | rm -f foo1 foo2 | |
c12d9b4c | 513 | else |
5ba00487 DZ |
514 | for i in `cd $(STAGE3DIR) ; find . -name \*.o -print` ; do \ |
515 | cmp $(STAGE2DIR)/$$i $(STAGE3DIR)/$$i || touch .bad-compare ; \ | |
516 | done | |
517 | endif | |
518 | if [ -f CLEAN_ALL ] ; then \ | |
519 | rm -rf $(STAGE2DIR) $(STAGE3DIR) ; \ | |
dae8a4cf | 520 | else \ |
5ba00487 DZ |
521 | if [ -f CLEAN_STAGES ] ; then \ |
522 | if [ -f .bad-compare ] ; then \ | |
523 | true ; \ | |
524 | else \ | |
525 | rm -rf $(STAGE1DIR) $(STAGE2DIR) ; \ | |
526 | fi ; \ | |
21412832 | 527 | else true ; \ |
5ba00487 | 528 | fi ; \ |
dae8a4cf | 529 | fi |
5ba00487 | 530 | touch $@ |
c12d9b4c RP |
531 | |
532 | .PHONY: clean | |
533 | clean: | |
7bea9148 | 534 | rm -rf $(HOLESDIR) $(INPLACEDIR) $(WORKING_DIR)* $(host)-stamp-* *~ |
c12d9b4c RP |
535 | |
536 | .PHONY: very | |
537 | very: | |
7bea9148 | 538 | rm -rf $(TREE) |
c12d9b4c RP |
539 | |
540 | force: | |
541 | ||
542 | endif # host | |
543 | ||
544 | ### Local Variables: | |
545 | ### fill-column: 131 | |
546 | ### End: |