]>
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 ([email protected]). | |
11 | ### Many subsequent additions (and current maintainance by) david d `zoo' zuhn, | |
12 | ### ([email protected]). | |
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 | ||
35eae2d8 ILT |
18 | ### The variable target may be set for the target of a cross-compilation. |
19 | ||
20 | ### The variable build may be to build a tree on a machine other than the host. | |
21 | ||
c12d9b4c | 22 | ifndef host |
5ba00487 DZ |
23 | error: |
24 | @echo You must set the variable \"host\" to use this Makefile ; exit 1 | |
c12d9b4c RP |
25 | else |
26 | ||
27 | ### from here to very near the end of the file is the real guts of this | |
28 | ### Makefile, and it is not seen if the variable 'host' is not set | |
29 | ||
c12d9b4c | 30 | ### from which cvs tree are we working? |
8b510607 | 31 | TREE := devo |
c12d9b4c | 32 | |
7f0d689a | 33 | include $(TREE)/release-info |
c12d9b4c | 34 | |
c12d9b4c | 35 | |
5ba00487 | 36 | TIME := time |
301c3fef DZ |
37 | GCC := gcc -O |
38 | GNUC := CC="$(GCC)" | |
5ba00487 DZ |
39 | CFLAGS := -g |
40 | GNU_MAKE := /usr/latest/bin/make -w | |
c12d9b4c | 41 | |
5ba00487 DZ |
42 | override MAKE := make |
43 | override MFLAGS := | |
44 | #override MAKEFLAGS := | |
c12d9b4c | 45 | |
5ba00487 | 46 | SHELL := /bin/sh |
c12d9b4c | 47 | |
35eae2d8 ILT |
48 | ifdef build |
49 | ||
50 | # We are building on a machine other than the host. We rely upon | |
51 | # previously built cross-compilers from the build machine to the host | |
52 | # (used to build the executables) and from the build machine to the | |
53 | # target (used to build the libraries). | |
54 | ||
55 | AR := $(host)-ar | |
56 | AR_FOR_TARGET := $(target)-ar | |
57 | AS := $(host)-as | |
58 | AS_FOR_TARGET := $(target)-as | |
59 | CC := $(host)-gcc | |
60 | CC_FOR_BUILD := gcc | |
61 | CC_FOR_TARGET := $(target)-gcc | |
62 | CXX := $(host)-c++ | |
63 | CXX_FOR_TARGET := $(target)-c++ | |
64 | GCC := $(host)-gcc -O | |
65 | GXX := $(host)-g++ | |
66 | GXX_FOR_TARGET := $(target)-g++ | |
67 | HOST_PREFIX := $(build)- | |
68 | HOST_PREFIX_1 := $(build)- | |
69 | MAKEINFO := makeinfo | |
70 | MUNCH_NM := $(host)-nm | |
71 | NM := $(host)-nm | |
72 | NM_FOR_TARGET := $(target)-nm | |
73 | RANLIB := $(host)-ranlib | |
74 | RANLIB_FOR_TARGET := $(target)-ranlib | |
75 | ||
76 | FLAGS_TO_PASS := \ | |
77 | "AR=$(AR)" \ | |
78 | "AR_FOR_TARGET=$(AR_FOR_TARGET)" \ | |
79 | "AS=$(AS)" \ | |
80 | "AS_FOR_TARGET=$(AS_FOR_TARGET)" \ | |
81 | "CC=$(CC)" \ | |
82 | "CC_FOR_BUILD=$(CC_FOR_BUILD)" \ | |
83 | "CC_FOR_TARGET=$(CC_FOR_TARGET)" \ | |
84 | "CXX=$(CXX)" \ | |
85 | "CXX_FOR_TARGET=$(CXX_FOR_TARGET)" \ | |
86 | "CFLAGS=$(CFLAGS)" \ | |
87 | "GCC=$(GCC)" \ | |
88 | "HOST_PREFIX=$(HOST_PREFIX)" \ | |
89 | "HOST_PREFIX_1=$(HOST_PREFIX_1)" \ | |
90 | "MAKEINFO=$(MAKEINFO)" \ | |
91 | "MF=$(MF)" \ | |
92 | "MUNCH_NM=$(MUNCH_NM)" \ | |
93 | "NM=$(NM)" \ | |
94 | "NM_FOR_TARGET=$(NM_FOR_TARGET)" \ | |
95 | "RANLIB=$(RANLIB)" \ | |
96 | "RANLIB_FOR_TARGET=$(RANLIB_FOR_TARGET)" \ | |
97 | "RELEASE_TAG=$(RELEASE_TAG)" \ | |
98 | "TIME=$(TIME)" \ | |
99 | "build=$(build)" \ | |
100 | "host=$(host)" | |
101 | ||
102 | # We must pass the build cross host tools in the environment of | |
103 | # configure, so that autoconf scripts will run the right programs. | |
104 | configenv := AR="$(AR)" CC="$(CC)" RANLIB="$(RANLIB)" | |
105 | ||
106 | else | |
107 | ||
108 | # This is a normal build on the host machine. | |
109 | ||
c12d9b4c RP |
110 | FLAGS_TO_PASS := \ |
111 | "GCC=$(GCC)" \ | |
5ba00487 | 112 | "CFLAGS=$(CFLAGS)" \ |
c12d9b4c | 113 | "TIME=$(TIME)" \ |
5ba00487 | 114 | "MF=$(MF)" \ |
12eda620 ILT |
115 | "host=$(host)" \ |
116 | "RELEASE_TAG=$(RELEASE_TAG)" | |
5ba00487 | 117 | |
301482c7 DZ |
118 | ifneq '$(CC)' 'cc' |
119 | FLAGS_TO_PASS := "CC=$(CC)" $(FLAGS_TO_PASS) | |
120 | endif | |
121 | ||
35eae2d8 ILT |
122 | configenv := |
123 | ||
124 | endif | |
125 | ||
5ba00487 | 126 | |
35eae2d8 | 127 | # These are the prefixes used for Cygnus builds. |
43ba04b1 | 128 | prefixes = --prefix=$(release_root) --exec-prefix=$(release_root)/H-$(host) |
5ba00487 | 129 | |
35eae2d8 | 130 | relbindir = $(release_root)/H-$(host)/bin |
c12d9b4c RP |
131 | |
132 | ### general config stuff | |
5ba00487 DZ |
133 | WORKING_DIR := $(host)-objdir |
134 | STAGE1DIR := $(WORKING_DIR).1 | |
135 | STAGE2DIR := $(WORKING_DIR).2 | |
136 | STAGE3DIR := $(WORKING_DIR).3 | |
137 | INPLACEDIR := $(host)-in-place | |
35eae2d8 ILT |
138 | |
139 | # Arrange to find the needed programs. If we are building on a | |
140 | # machine other than the host, we must find the cross-compilers. | |
141 | ||
142 | ifdef build | |
143 | ||
144 | holesys := $(build) | |
145 | HOLESSTAMP := $(holesys)-stamp-holes $(build)-x-$(host)-stamp-holes $(build)-x-$(target)-stamp-holes | |
146 | HOLESDIR := $(holesys)-holes | |
147 | BUILD_HOST_HOLES_DIR := $(build)-x-$(host)-holes | |
148 | BUILD_TARGET_HOLES_DIR := $(build)-x-$(target)-holes | |
149 | ||
150 | SET_NATIVE_HOLES := SHELL=sh ; PATH=`pwd`/$(HOLESDIR):`pwd`/$(BUILD_HOST_HOLES_DIR):`pwd`/$(BUILD_TARGET_HOLES_DIR) ; export PATH ; export SHELL ; | |
151 | SET_CYGNUS_PATH := SHELL=sh ; PATH=`pwd`/$(HOLESDIR):`pwd`/$(BUILD_HOST_HOLES_DIR):`pwd`/$(BUILD_TARGET_HOLES_DIR) ; export PATH ; export SHELL ; | |
152 | SET_LATEST_PATH := SHELL=sh ; PATH=/usr/latest/bin:`pwd`/$(HOLESDIR):`pwd`/$(BUILD_HOST_HOLES_DIR):`pwd`/$(BUILD_TARGET_HOLES_DIR) ; export PATH ; export SHELL ; | |
153 | ||
154 | else | |
155 | ||
156 | holesys := $(host) | |
157 | HOLESSTAMP := $(holesys)-stamp-holes | |
158 | HOLESDIR := $(holesys)-holes | |
c12d9b4c | 159 | |
301482c7 DZ |
160 | SET_NATIVE_HOLES := SHELL=sh ; PATH=`pwd`/$(HOLESDIR) ; export PATH ; export SHELL ; |
161 | SET_CYGNUS_PATH := SHELL=sh ; PATH=$(relbindir):`pwd`/$(HOLESDIR) ; export PATH ; export SHELL ; | |
162 | SET_LATEST_PATH := SHELL=sh ; PATH=/usr/latest/bin:`pwd`/$(HOLESDIR) ; export PATH ; export SHELL ; | |
41a88234 | 163 | |
35eae2d8 | 164 | endif |
41a88234 | 165 | |
c12d9b4c | 166 | .PHONY: all |
5ba00487 DZ |
167 | ifdef target |
168 | ## | |
169 | ## This is a cross compilation | |
170 | ## | |
171 | arch = $(host)-x-$(target) | |
35eae2d8 | 172 | config = -host=$(host) -target=$(target) |
5ba00487 DZ |
173 | FLAGS_TO_PASS := $(FLAGS_TO_PASS) "target=$(target)" |
174 | ||
35eae2d8 ILT |
175 | ifdef build |
176 | all: do-cygnus do-latest | |
177 | build-all: build-cygnus build-latest | |
178 | else | |
5ba00487 DZ |
179 | all: do-native do-latest |
180 | build-all: build-native build-latest | |
35eae2d8 ILT |
181 | endif |
182 | ||
183 | ifeq ($(target),mips-idt-ecoff) | |
7f0d689a | 184 | configargs := $(configargs) -with-gnu-as |
35eae2d8 | 185 | endif |
5ba00487 DZ |
186 | |
187 | else | |
188 | ## | |
189 | ## This is a native compilation | |
190 | ## | |
301c3fef | 191 | arch = $(host) |
35eae2d8 ILT |
192 | config = -host=$(host) |
193 | ifdef build | |
194 | all: do-cygnus do-latest | |
195 | else | |
5ba00487 | 196 | all: $(host)-stamp-3stage-done |
35eae2d8 | 197 | endif |
5ba00487 | 198 | #all: in-place do1 do2 do3 comparison |
35eae2d8 ILT |
199 | |
200 | ifeq ($(subst mips-sgi-irix4,mips-dec-ultrix,$(host)),mips-dec-ultrix) | |
7f0d689a | 201 | configargs := $(configargs) -with-gnu-as |
35eae2d8 ILT |
202 | endif |
203 | ||
5ba00487 DZ |
204 | endif |
205 | ||
301c3fef DZ |
206 | NATIVEDIR := $(arch)-native-objdir |
207 | CYGNUSDIR := $(arch)-cygnus-objdir | |
208 | LATESTDIR := $(arch)-latest-objdir | |
209 | ||
210 | ||
5ba00487 DZ |
211 | everything: do-cross |
212 | #everything: in-place do1 do2 do3 comparison do-cygnus | |
213 | ||
214 | .PHONY: do-native | |
35eae2d8 | 215 | do-native: $(HOLESSTAMP) $(arch)-stamp-native |
5ba00487 | 216 | do-native-config: $(arch)-stamp-native-configured |
35eae2d8 ILT |
217 | build-native: $(HOLESSTAMP) $(arch)-stamp-native-checked |
218 | config-native: $(HOLESSTAMP) $(arch)-stamp-native-configured | |
5ba00487 | 219 | |
35eae2d8 | 220 | $(arch)-stamp-native: $(HOLESSTAMP) |
301482c7 | 221 | $(SET_NATIVE_HOLES) $(TIME) $(GNU_MAKE) -f test-build.mk $(arch)-stamp-native-installed $(FLAGS_TO_PASS) |
5ba00487 DZ |
222 | if [ -f CLEAN_ALL ] ; then rm -rf $(NATIVEDIR) ; else true ; fi |
223 | touch $(arch)-stamp-native | |
224 | ||
35eae2d8 | 225 | $(arch)-stamp-native-installed: $(HOLESSTAMP) $(arch)-stamp-native-checked |
301482c7 DZ |
226 | $(SET_NATIVE_HOLES) cd $(NATIVEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) install |
227 | $(SET_NATIVE_HOLES) cd $(NATIVEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) install-info | |
5ba00487 DZ |
228 | touch $@ |
229 | ||
230 | $(arch)-stamp-native-checked: $(arch)-stamp-native-built | |
231 | # cd $(NATIVEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) check | |
232 | touch $@ | |
233 | ||
35eae2d8 | 234 | $(arch)-stamp-native-built: $(HOLESSTAMP) $(arch)-stamp-native-configured |
301482c7 DZ |
235 | $(SET_NATIVE_HOLES) cd $(NATIVEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) all |
236 | $(SET_NATIVE_HOLES) cd $(NATIVEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) info | |
5ba00487 DZ |
237 | touch $@ |
238 | ||
35eae2d8 | 239 | $(arch)-stamp-native-configured: $(HOLESSTAMP) |
5ba00487 | 240 | [ -d $(NATIVEDIR) ] || mkdir $(NATIVEDIR) |
35eae2d8 | 241 | $(SET_NATIVE_HOLES) cd $(NATIVEDIR) ; $(configenv) $(TIME) ../$(TREE)/configure $(config) -v --srcdir=../$(TREE) $(prefixes) $(configargs) |
5ba00487 DZ |
242 | touch $@ |
243 | ||
244 | ||
245 | .PHONY: do-cygnus | |
35eae2d8 ILT |
246 | do-cygnus: $(HOLESSTAMP) $(arch)-stamp-cygnus |
247 | build-cygnus: $(HOLESSTAMP) $(arch)-stamp-cygnus-checked | |
248 | config-cygnus: $(HOLESSTAMP) $(arch)-stamp-cygnus-configured | |
5ba00487 DZ |
249 | |
250 | $(arch)-stamp-cygnus: | |
35eae2d8 | 251 | ifndef build |
5ba00487 | 252 | [ -f $(relbindir)/gcc ] || (echo "must have gcc available"; exit 1) |
35eae2d8 | 253 | endif |
41a88234 | 254 | $(SET_CYGNUS_PATH) $(TIME) $(GNU_MAKE) -f test-build.mk $(arch)-stamp-cygnus-installed $(FLAGS_TO_PASS) |
5ba00487 DZ |
255 | if [ -f CLEAN_ALL ] ; then rm -rf $(CYGNUSDIR) ; else true ; fi |
256 | touch $(arch)-stamp-cygnus | |
257 | ||
35eae2d8 | 258 | $(arch)-stamp-cygnus-installed: $(HOLESSTAMP) $(arch)-stamp-cygnus-checked |
41a88234 ILT |
259 | $(SET_CYGNUS_PATH) cd $(CYGNUSDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) install |
260 | $(SET_CYGNUS_PATH) cd $(CYGNUSDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) install-info | |
5ba00487 DZ |
261 | touch $@ |
262 | ||
35eae2d8 | 263 | $(arch)-stamp-cygnus-checked: $(HOLESSTAMP) $(arch)-stamp-cygnus-built |
5ba00487 DZ |
264 | # cd $(CYGNUSDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) check |
265 | touch $@ | |
266 | ||
35eae2d8 | 267 | $(arch)-stamp-cygnus-built: $(HOLESSTAMP) $(arch)-stamp-cygnus-configured |
41a88234 ILT |
268 | $(SET_CYGNUS_PATH) cd $(CYGNUSDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) all |
269 | $(SET_CYGNUS_PATH) cd $(CYGNUSDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) info | |
5ba00487 DZ |
270 | touch $@ |
271 | ||
35eae2d8 | 272 | $(arch)-stamp-cygnus-configured: $(HOLESSTAMP) |
5ba00487 | 273 | [ -d $(CYGNUSDIR) ] || mkdir $(CYGNUSDIR) |
35eae2d8 | 274 | $(SET_CYGNUS_PATH) cd $(CYGNUSDIR) ; $(GNUC) $(configenv) $(TIME) ../$(TREE)/configure $(config) -v --srcdir=../$(TREE) $(prefixes) $(configargs) |
5ba00487 DZ |
275 | touch $@ |
276 | ||
277 | .PHONY: do-latest | |
35eae2d8 ILT |
278 | do-latest: $(HOLESSTAMP) $(arch)-stamp-latest |
279 | build-latest: $(HOLESSTAMP) $(arch)-stamp-latest-checked | |
5ba00487 DZ |
280 | |
281 | $(arch)-stamp-latest: | |
41a88234 | 282 | $(SET_LATEST_PATH) $(TIME) $(GNU_MAKE) -f test-build.mk $(arch)-stamp-latest-installed $(FLAGS_TO_PASS) |
5ba00487 DZ |
283 | touch $(arch)-stamp-latest |
284 | ||
35eae2d8 | 285 | $(arch)-stamp-latest-installed: $(HOLESSTAMP) $(arch)-stamp-latest-checked |
41a88234 ILT |
286 | $(SET_LATEST_PATH) cd $(LATESTDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) install |
287 | $(SET_LATEST_PATH) cd $(LATESTDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) install-info | |
5ba00487 DZ |
288 | touch $@ |
289 | ||
290 | $(arch)-stamp-latest-checked: $(arch)-stamp-latest-built | |
41a88234 | 291 | # $(SET_LATEST_PATH) cd $(LATESTDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) check |
5ba00487 DZ |
292 | touch $@ |
293 | ||
294 | $(arch)-stamp-latest-built: $(arch)-stamp-latest-configured | |
41a88234 ILT |
295 | $(SET_LATEST_PATH) cd $(LATESTDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) all |
296 | $(SET_LATEST_PATH) cd $(LATESTDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) info | |
5ba00487 DZ |
297 | touch $@ |
298 | ||
299 | $(arch)-stamp-latest-configured: | |
300 | [ -d $(LATESTDIR) ] || mkdir $(LATESTDIR) | |
35eae2d8 | 301 | $(SET_LATEST_PATH) cd $(LATESTDIR) ; $(GNUC) $(configenv) $(TIME) ../$(TREE)/configure $(config) -v --srcdir=../$(TREE) $(prefixes) $(configargs) |
5ba00487 DZ |
302 | touch $@ |
303 | ||
7bea9148 RP |
304 | |
305 | .PHONY: in-place | |
306 | in-place: $(host)-stamp-in-place | |
307 | ||
5ba00487 | 308 | $(host)-stamp-in-place: |
7bea9148 | 309 | PATH=/bin:/usr/bin:/usr/ucb ; \ |
5ba00487 DZ |
310 | export PATH ; \ |
311 | SHELL=/bin/sh ; export SHELL ; \ | |
312 | $(TIME) $(GNU_MAKE) -f test-build.mk $(host)-stamp-in-place-installed host=$(host) $(FLAGS_TO_PASS) | |
7bea9148 | 313 | touch $@ |
5ba00487 DZ |
314 | if [ -f CLEAN_ALL ] ; then \ |
315 | rm -rf $(INPLACEDIR) ; \ | |
316 | else \ | |
317 | mv $(INPLACEDIR) $(STAGE1DIR) ; \ | |
318 | fi | |
7bea9148 RP |
319 | |
320 | $(host)-stamp-in-place-installed: $(host)-stamp-in-place-checked | |
41a88234 ILT |
321 | cd $(INPLACEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" install host=$(host) |
322 | cd $(INPLACEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" install-info host=$(host) | |
7bea9148 RP |
323 | touch $@ |
324 | ||
325 | $(host)-stamp-in-place-checked: $(host)-stamp-in-place-built | |
41a88234 | 326 | # cd $(INPLACEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" check host=$(host) |
7bea9148 RP |
327 | touch $@ |
328 | ||
329 | $(host)-stamp-in-place-built: $(host)-stamp-in-place-configured | |
41a88234 ILT |
330 | cd $(INPLACEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" all host=$(host) |
331 | cd $(INPLACEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" info host=$(host) | |
7bea9148 RP |
332 | touch $@ |
333 | ||
334 | $(host)-stamp-in-place-configured: $(host)-stamp-in-place-cp | |
35eae2d8 | 335 | cd $(INPLACEDIR) ; $(configenv) $(TIME) ./configure $(config) -v $(prefixes) $(configargs) |
7bea9148 RP |
336 | touch $@ |
337 | ||
338 | $(host)-stamp-in-place-cp: | |
339 | rm -rf $(INPLACEDIR) | |
340 | mkdir $(INPLACEDIR) | |
341 | (cd $(TREE) ; tar cf - .) | (cd $(INPLACEDIR) ; tar xf -) | |
342 | touch $@ | |
c12d9b4c | 343 | |
5ba00487 DZ |
344 | $(host)-stamp-3stage-done: do1 do2 do3 comparison |
345 | touch $@ | |
346 | ||
347 | ||
c12d9b4c | 348 | .PHONY: do1 |
35eae2d8 ILT |
349 | do1: $(HOLESSTAMP) $(host)-stamp-stage1 |
350 | do1-config: $(HOLESSTAMP) $(host)-stamp-stage1-configured | |
351 | do1-build: $(HOLESSTAMP) $(host)-stamp-stage1-checked | |
c12d9b4c RP |
352 | |
353 | $(host)-stamp-stage1: | |
354 | if [ -d $(STAGE1DIR) ] ; then \ | |
355 | mv $(STAGE1DIR) $(WORKING_DIR) ; \ | |
356 | else \ | |
357 | true ; \ | |
358 | fi | |
301482c7 | 359 | $(SET_NATIVE_HOLES) $(TIME) $(GNU_MAKE) -f test-build.mk $(FLAGS_TO_PASS) host=$(host) $(host)-stamp-stage1-installed |
7bea9148 | 360 | touch $@ |
5ba00487 DZ |
361 | if [ -f CLEAN_ALL ] ; then \ |
362 | rm -rf $(WORKING_DIR) ; \ | |
363 | else \ | |
364 | mv $(WORKING_DIR) $(STAGE1DIR) ; \ | |
365 | fi | |
c12d9b4c RP |
366 | |
367 | $(host)-stamp-stage1-installed: $(host)-stamp-stage1-checked | |
301482c7 DZ |
368 | $(SET_NATIVE_HOLES) cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" install host=$(host) |
369 | $(SET_NATIVE_HOLES) cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" install-info host=$(host) | |
fdfa2371 | 370 | ifeq ($(host),rs6000-ibm-aix) |
35eae2d8 | 371 | -rm $(relbindir)/make |
fdfa2371 | 372 | endif |
c12d9b4c RP |
373 | touch $@ |
374 | ||
375 | $(host)-stamp-stage1-checked: $(host)-stamp-stage1-built | |
301482c7 | 376 | # $(SET_NATIVE_HOLES) cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" check host=$(host) |
c12d9b4c RP |
377 | touch $@ |
378 | ||
379 | $(host)-stamp-stage1-built: $(host)-stamp-stage1-configured | |
301482c7 DZ |
380 | $(SET_NATIVE_HOLES) cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" all host=$(host) |
381 | $(SET_NATIVE_HOLES) cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" info host=$(host) | |
c12d9b4c RP |
382 | touch $@ |
383 | ||
384 | $(host)-stamp-stage1-configured: | |
385 | [ -d $(WORKING_DIR) ] || mkdir $(WORKING_DIR) | |
301482c7 | 386 | $(SET_NATIVE_HOLES) cd $(WORKING_DIR) ; \ |
35eae2d8 | 387 | $(configenv) $(TIME) ../$(TREE)/configure $(config) -v --srcdir=../$(TREE) $(prefixes) $(configargs) |
c12d9b4c RP |
388 | touch $@ |
389 | ||
390 | .PHONY: do2 | |
391 | do2: $(HOLESDIR) $(host)-stamp-stage2 | |
392 | ||
393 | $(host)-stamp-stage2: | |
394 | if [ -d $(STAGE2DIR) ] ; then \ | |
395 | mv $(STAGE2DIR) $(WORKING_DIR) ; \ | |
396 | else \ | |
397 | true ; \ | |
398 | fi | |
41a88234 | 399 | $(SET_CYGNUS_PATH) $(TIME) $(GNU_MAKE) $(FLAGS_TO_PASS) -f test-build.mk -w $(host)-stamp-stage2-installed |
5ba00487 | 400 | mv $(WORKING_DIR) $(STAGE2DIR) |
7bea9148 | 401 | touch $@ |
c12d9b4c | 402 | |
c12d9b4c RP |
403 | |
404 | $(host)-stamp-stage2-installed: $(host)-stamp-stage2-checked | |
41a88234 ILT |
405 | $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" install host=$(host) |
406 | $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" install-info host=$(host) | |
c12d9b4c RP |
407 | touch $@ |
408 | ||
409 | $(host)-stamp-stage2-checked: $(host)-stamp-stage2-built | |
41a88234 | 410 | # $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" check host=$(host) |
c12d9b4c RP |
411 | touch $@ |
412 | ||
413 | $(host)-stamp-stage2-built: $(host)-stamp-stage2-configured | |
41a88234 ILT |
414 | $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" all host=$(host) |
415 | $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" info host=$(host) | |
c12d9b4c RP |
416 | touch $@ |
417 | ||
418 | $(host)-stamp-stage2-configured: | |
419 | [ -d $(WORKING_DIR) ] || mkdir $(WORKING_DIR) | |
41a88234 | 420 | $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; \ |
35eae2d8 | 421 | $(configenv) $(GNUC) $(TIME) ../$(TREE)/configure $(config) -v --srcdir=../$(TREE) $(prefixes) $(configargs) |
c12d9b4c RP |
422 | touch $@ |
423 | ||
424 | .PHONY: do3 | |
425 | do3: $(HOLESDIR) $(host)-stamp-stage3 | |
426 | ||
427 | $(host)-stamp-stage3: | |
5ba00487 DZ |
428 | if [ -d $(STAGE3DIR) ] ; then \ |
429 | mv $(STAGE3DIR) $(WORKING_DIR) ; \ | |
c12d9b4c RP |
430 | else \ |
431 | true ; \ | |
432 | fi | |
41a88234 | 433 | $(SET_CYGNUS_PATH) $(TIME) $(GNU_MAKE) $(FLAGS_TO_PASS) -f test-build.mk -w $(host)-stamp-stage3-checked |
5ba00487 | 434 | mv $(WORKING_DIR) $(STAGE3DIR) |
7bea9148 | 435 | touch $@ |
c12d9b4c | 436 | |
c12d9b4c RP |
437 | |
438 | $(host)-stamp-stage3-installed: $(host)-stamp-stage3-checked | |
41a88234 ILT |
439 | $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" install host=$(host) |
440 | $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" install-info host=$(host) | |
c12d9b4c RP |
441 | touch $@ |
442 | ||
443 | $(host)-stamp-stage3-checked: $(host)-stamp-stage3-built | |
41a88234 | 444 | # $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" check host=$(host) |
c12d9b4c RP |
445 | touch $@ |
446 | ||
447 | $(host)-stamp-stage3-built: $(host)-stamp-stage3-configured | |
41a88234 ILT |
448 | $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" all host=$(host) |
449 | $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" info host=$(host) | |
c12d9b4c RP |
450 | touch $@ |
451 | ||
452 | $(host)-stamp-stage3-configured: | |
453 | [ -d $(WORKING_DIR) ] || mkdir $(WORKING_DIR) | |
41a88234 | 454 | $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; \ |
35eae2d8 | 455 | $(configenv) $(GNUC) $(TIME) ../$(TREE)/configure $(config) -v --srcdir=../$(TREE) $(prefixes) $(configargs) |
c12d9b4c RP |
456 | touch $@ |
457 | ||
458 | # These things are needed by a three-stage, but are not included locally. | |
459 | ||
460 | HOLES := \ | |
461 | [ \ | |
462 | ar \ | |
463 | as \ | |
464 | awk \ | |
465 | basename \ | |
466 | cat \ | |
467 | cc \ | |
468 | chmod \ | |
469 | cmp \ | |
470 | cp \ | |
41a88234 | 471 | cpio \ |
c12d9b4c RP |
472 | date \ |
473 | diff \ | |
474 | echo \ | |
475 | egrep \ | |
476 | ex \ | |
477 | expr \ | |
301482c7 | 478 | false \ |
c12d9b4c RP |
479 | find \ |
480 | grep \ | |
5ba00487 | 481 | head \ |
c12d9b4c RP |
482 | hostname \ |
483 | install \ | |
484 | ld \ | |
485 | lex \ | |
486 | ln \ | |
487 | ls \ | |
488 | make \ | |
489 | mkdir \ | |
490 | mv \ | |
491 | nm \ | |
492 | pwd \ | |
493 | ranlib \ | |
494 | rm \ | |
495 | rmdir \ | |
496 | sed \ | |
497 | sh \ | |
498 | sort \ | |
41a88234 | 499 | tar \ |
c12d9b4c RP |
500 | test \ |
501 | time \ | |
502 | touch \ | |
503 | tr \ | |
504 | true \ | |
35eae2d8 | 505 | uname \ |
41a88234 | 506 | uudecode \ |
40a75cc7 | 507 | wc \ |
c12d9b4c RP |
508 | whoami |
509 | ||
510 | ### so far only sun make supports VPATH | |
35eae2d8 | 511 | ifeq ($(subst sun3,sun4,$(holesys)),sun4) |
c12d9b4c RP |
512 | MAKE_HOLE := |
513 | else | |
514 | MAKE_HOLE := make | |
515 | endif | |
516 | ||
5ba00487 | 517 | ### solaris 2 -- don't use /usr/ucb/cc |
35eae2d8 | 518 | ifeq (sparc-sun-solaris2,$(holesys)) |
301482c7 | 519 | SET_NATIVE_HOLES := SHELL=sh ; PATH=/opt/SUNWspro/bin:`pwd`/$(HOLESDIR) ; export PATH ; export SHELL ; |
af5874bd | 520 | HOLE_DIRS := /usr/ccs/bin |
301c3fef DZ |
521 | CC_HOLE := |
522 | NUKEM := cc | |
5ba00487 DZ |
523 | endif |
524 | ||
c12d9b4c RP |
525 | ### These things are also needed by a three-stage, but in this case, the GNU version of the tool is required. |
526 | PARTIAL_HOLES := \ | |
c12d9b4c | 527 | $(MAKE_HOLE) \ |
5ba00487 | 528 | $(CC_HOLE) \ |
c12d9b4c RP |
529 | flex \ |
530 | m4 | |
531 | ||
532 | ### look in these directories for things missing from a three-stage | |
533 | HOLE_DIRS := \ | |
fdfa2371 | 534 | $(HOLE_DIRS) \ |
c12d9b4c RP |
535 | /bin \ |
536 | /usr/bin \ | |
537 | /usr/ucb \ | |
538 | /usr/unsupported/bin | |
539 | ||
540 | ### look in these directories for alternate versions of some tools. | |
541 | PARTIAL_HOLE_DIRS := \ | |
542 | /usr/latest/bin \ | |
543 | /usr/progressive/bin \ | |
fdfa2371 | 544 | $(PARTIAL_HOLE_DIRS) \ |
c12d9b4c RP |
545 | /usr/vintage/bin \ |
546 | /usr/unsupported/bin | |
547 | ||
35eae2d8 | 548 | $(HOLESDIR): $(holesys)-stamp-holes |
c12d9b4c | 549 | |
35eae2d8 | 550 | $(holesys)-stamp-holes: |
c12d9b4c RP |
551 | -rm -rf $(HOLESDIR) |
552 | -mkdir $(HOLESDIR) | |
5ba00487 | 553 | @for i in $(HOLES) ; do \ |
c12d9b4c RP |
554 | found= ; \ |
555 | for j in $(HOLE_DIRS) ; do \ | |
556 | if [ -x $$j/$$i ] ; then \ | |
21412832 | 557 | ln -s $$j/$$i $(HOLESDIR) || cp $$j/$$i $(HOLESDIR) ; \ |
c12d9b4c RP |
558 | echo $$i from $$j ; \ |
559 | found=t ; \ | |
560 | break ; \ | |
561 | fi ; \ | |
562 | done ; \ | |
563 | case "$$found" in \ | |
564 | t) ;; \ | |
565 | *) echo $$i is NOT found ;; \ | |
566 | esac ; \ | |
567 | done | |
5ba00487 | 568 | @for i in $(PARTIAL_HOLES) ; do \ |
c12d9b4c RP |
569 | found= ; \ |
570 | for j in $(PARTIAL_HOLE_DIRS) ; do \ | |
571 | if [ -x $$j/$$i ] ; then \ | |
572 | rm -f $(HOLESDIR)/$$i ; \ | |
573 | cp $$j/$$i $(HOLESDIR)/$$i || exit 1; \ | |
574 | echo $$i from $$j ; \ | |
575 | found=t ; \ | |
576 | break ; \ | |
577 | fi ; \ | |
578 | done ; \ | |
579 | case "$$found" in \ | |
580 | t) ;; \ | |
581 | *) echo $$i is NOT found ;; \ | |
582 | esac ; \ | |
583 | done | |
301c3fef DZ |
584 | ifdef NUKEM |
585 | cd $(HOLESDIR); rm -f $(NUKEM) | |
586 | endif | |
7bea9148 | 587 | touch $@ |
c12d9b4c | 588 | |
35eae2d8 ILT |
589 | # Get the cross-tools for build cross host when not building on the host. |
590 | ||
591 | BUILD_HOST_HOLES := \ | |
592 | byacc \ | |
593 | gcc \ | |
594 | makeinfo \ | |
595 | $(AR) \ | |
596 | $(AS) \ | |
597 | $(CC) \ | |
598 | $(CXX) \ | |
599 | $(GXX) \ | |
600 | $(NM) \ | |
601 | $(RANLIB) | |
602 | ||
603 | BUILD_HOLES_DIRS := $(PARTIAL_HOLE_DIRS) | |
604 | ||
7f0d689a | 605 | ifdef BUILD_HOST_HOLES_DIR |
35eae2d8 | 606 | $(BUILD_HOST_HOLES_DIR): $(build)-x-$(host)-stamp-holes |
7f0d689a | 607 | endif |
35eae2d8 ILT |
608 | |
609 | $(build)-x-$(host)-stamp-holes: | |
610 | -rm -rf $(BUILD_HOST_HOLES_DIR) | |
611 | -mkdir $(BUILD_HOST_HOLES_DIR) | |
612 | @for i in $(BUILD_HOST_HOLES) ; do \ | |
613 | found= ; \ | |
614 | for j in $(BUILD_HOLES_DIRS) ; do \ | |
615 | if [ -x $$j/$$i ] ; then \ | |
616 | ln -s $$j/$$i $(BUILD_HOST_HOLES_DIR) || cp $$j/$$i $(BUILD_HOST_HOLES_DIR) ; \ | |
617 | echo $$i from $$j ; \ | |
618 | found=t ; \ | |
619 | break ; \ | |
620 | fi ; \ | |
621 | done ; \ | |
622 | case "$$found" in \ | |
623 | t) ;; \ | |
624 | *) echo $$i is NOT found ;; \ | |
625 | esac ; \ | |
626 | done | |
627 | touch $@ | |
628 | ||
629 | # Get the cross tools for build cross target when not building on the host. | |
630 | ||
631 | BUILD_TARGET_HOLES := \ | |
632 | byacc \ | |
633 | gcc \ | |
634 | makeinfo \ | |
635 | $(AR_FOR_TARGET) \ | |
636 | $(AS_FOR_TARGET) \ | |
637 | $(CC_FOR_TARGET) \ | |
638 | $(CXX_FOR_TARGET) \ | |
639 | $(GXX_FOR_TARGET) \ | |
640 | $(NM_FOR_TARGET) \ | |
641 | $(RANLIB_FOR_TARGET) | |
642 | ||
7f0d689a | 643 | ifdef BUILD_TARGET_HOLES_DIR |
35eae2d8 | 644 | $(BUILD_TARGET_HOLES_DIR): $(build)-x-$(target)-stamp-holes |
7f0d689a | 645 | endif |
35eae2d8 ILT |
646 | |
647 | $(build)-x-$(target)-stamp-holes: | |
648 | -rm -rf $(BUILD_TARGET_HOLES_DIR) | |
649 | -mkdir $(BUILD_TARGET_HOLES_DIR) | |
650 | @for i in $(BUILD_TARGET_HOLES) ; do \ | |
651 | found= ; \ | |
652 | for j in $(BUILD_HOLES_DIRS) ; do \ | |
653 | if [ -x $$j/$$i ] ; then \ | |
654 | ln -s $$j/$$i $(BUILD_TARGET_HOLES_DIR) || cp $$j/$$i $(BUILD_TARGET_HOLES_DIR) ; \ | |
655 | echo $$i from $$j ; \ | |
656 | found=t ; \ | |
657 | break ; \ | |
658 | fi ; \ | |
659 | done ; \ | |
660 | case "$$found" in \ | |
661 | t) ;; \ | |
662 | *) echo $$i is NOT found ;; \ | |
663 | esac ; \ | |
664 | done | |
665 | touch $@ | |
666 | ||
c12d9b4c | 667 | .PHONY: comparison |
5ba00487 DZ |
668 | comparison: $(host)-stamp-3stage-compared |
669 | ||
670 | $(host)-stamp-3stage-compared: | |
671 | rm -f .bad-compare | |
21412832 | 672 | 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 |
673 | for i in `cd $(STAGE3DIR) ; find . -name \*.o -print` ; do \ |
674 | tail +10c $(STAGE2DIR)/$$i > foo1 ; \ | |
675 | tail +10c $(STAGE3DIR)/$$i > foo2 ; \ | |
676 | if cmp foo1 foo2 ; then \ | |
677 | true ; \ | |
678 | else \ | |
679 | echo $$i ; \ | |
680 | touch .bad-compare ; \ | |
681 | fi ; \ | |
682 | done | |
683 | rm -f foo1 foo2 | |
c12d9b4c | 684 | else |
5ba00487 DZ |
685 | for i in `cd $(STAGE3DIR) ; find . -name \*.o -print` ; do \ |
686 | cmp $(STAGE2DIR)/$$i $(STAGE3DIR)/$$i || touch .bad-compare ; \ | |
687 | done | |
688 | endif | |
689 | if [ -f CLEAN_ALL ] ; then \ | |
690 | rm -rf $(STAGE2DIR) $(STAGE3DIR) ; \ | |
dae8a4cf | 691 | else \ |
5ba00487 DZ |
692 | if [ -f CLEAN_STAGES ] ; then \ |
693 | if [ -f .bad-compare ] ; then \ | |
694 | true ; \ | |
695 | else \ | |
696 | rm -rf $(STAGE1DIR) $(STAGE2DIR) ; \ | |
697 | fi ; \ | |
21412832 | 698 | else true ; \ |
5ba00487 | 699 | fi ; \ |
dae8a4cf | 700 | fi |
5ba00487 | 701 | touch $@ |
c12d9b4c RP |
702 | |
703 | .PHONY: clean | |
704 | clean: | |
7bea9148 | 705 | rm -rf $(HOLESDIR) $(INPLACEDIR) $(WORKING_DIR)* $(host)-stamp-* *~ |
c12d9b4c RP |
706 | |
707 | .PHONY: very | |
708 | very: | |
7bea9148 | 709 | rm -rf $(TREE) |
c12d9b4c RP |
710 | |
711 | force: | |
712 | ||
713 | endif # host | |
714 | ||
715 | ### Local Variables: | |
716 | ### fill-column: 131 | |
717 | ### End: |