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