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.
7 ### USE OF THIS FILE REQUIRES GNU MAKE!!!
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,
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.
20 @echo You must set the variable
\"host
\" to use this Makefile
; exit
1
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
27 ### START EDITTING HERE!!!
28 ### These things will need to be set differently for each release.
31 ### from which cvs tree are we working?
34 ### binaries should be installed into?
35 ROOTING
:= /usr
/cygnus
37 ### When working from a tagged set of source, this should be the tag. If not,
38 ### then set the macro to be empty.
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.
45 ### Historically, this was identical to CVS_TAG. This is changing.
46 RELEASE_TAG
:= latest-921118
48 ### Historically, binaries were installed here. This is changing.
49 release_root
:= $(ROOTING
)/$(RELEASE_TAG
)
51 ### STOP EDITTING HERE!!!
52 ### With luck, eventually, nothing else will need to be editted.
58 GNU_MAKE
:= /usr
/latest
/bin
/make
-w
62 #override MAKEFLAGS :=
74 prefixes
= -prefix=$(release_root
) -exec_prefix=$(release_root
)/H-
$(host
)
75 relbindir
= $(release_root
)/H-
$(host
)/bin
78 ### general config stuff
79 WORKING_DIR
:= $(host
)-objdir
80 STAGE1DIR
:= $(WORKING_DIR
).1
81 STAGE2DIR
:= $(WORKING_DIR
).2
82 STAGE3DIR
:= $(WORKING_DIR
).3
83 INPLACEDIR
:= $(host
)-in-place
84 HOLESDIR
:= $(host
)-holes
89 ## This is a cross compilation
91 arch
= $(host
)-x-
$(target
)
92 config
= $(host
) -target
=$(target
)
93 NATIVEDIR
:= $(arch
)-native-objdir
94 CYGNUSDIR
:= $(arch
)-cygnus-objdir
95 LATESTDIR
:= $(arch
)-latest-objdir
96 FLAGS_TO_PASS
:= $(FLAGS_TO_PASS
) "target=$(target)"
98 all: do-native do-latest
99 build-all
: build-native build-latest
103 ## This is a native compilation
105 all: $(host
)-stamp-3stage-done
106 #all: in-place do1 do2 do3 comparison
110 #everything: in-place do1 do2 do3 comparison do-cygnus
113 do-native
: $(host
)-stamp-holes
$(arch
)-stamp-native
114 do-native-config
: $(arch
)-stamp-native-configured
115 build-native
: $(host
)-stamp-holes
$(arch
)-stamp-native-checked
116 config-native
: $(host
)-stamp-holes
$(arch
)-stamp-native-configured
118 $(arch
)-stamp-native
:
119 PATH
=`pwd`/$(HOLESDIR
) ; \
121 SHELL
=sh
; export SHELL
; \
122 $(TIME
) $(GNU_MAKE
) -f test-build.mk
$(arch
)-stamp-native-installed
$(FLAGS_TO_PASS
)
123 if
[ -f CLEAN_ALL
] ; then
rm -rf
$(NATIVEDIR
) ; else true
; fi
124 touch
$(arch
)-stamp-native
126 $(arch
)-stamp-native-installed
: $(arch
)-stamp-native-checked
127 cd
$(NATIVEDIR
) ; $(TIME
) $(MAKE
) $(FLAGS_TO_PASS
) install
128 cd
$(NATIVEDIR
) ; $(TIME
) $(MAKE
) $(FLAGS_TO_PASS
) install-info
131 $(arch
)-stamp-native-checked
: $(arch
)-stamp-native-built
132 # cd $(NATIVEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) check
135 $(arch
)-stamp-native-built
: $(arch
)-stamp-native-configured
136 cd
$(NATIVEDIR
) ; $(TIME
) $(MAKE
) $(FLAGS_TO_PASS
) all
137 cd
$(NATIVEDIR
) ; $(TIME
) $(MAKE
) $(FLAGS_TO_PASS
) info
140 $(arch
)-stamp-native-configured
:
141 [ -d
$(NATIVEDIR
) ] || mkdir
$(NATIVEDIR
)
143 $(TIME
) ..
/$(TREE
)/configure
$(config
) -v
-srcdir=..
/$(TREE
) \
149 do-cygnus
: $(host
)-stamp-holes
$(arch
)-stamp-cygnus
150 build-cygnus
: $(host
)-stamp-holes
$(arch
)-stamp-cygnus-checked
151 config-cygnus
: $(host
)-stamp-holes
$(arch
)-stamp-cygnus-configured
153 $(arch
)-stamp-cygnus
:
154 [ -f
$(relbindir
)/gcc
] ||
(echo
"must have gcc available"; exit
1)
155 PATH
=$(relbindir
):`pwd`/$(HOLESDIR
) ; \
157 SHELL
=sh
; export SHELL
; \
158 echo
; gcc
-v
; echo
; \
159 $(TIME
) $(GNU_MAKE
) -f test-build.mk
$(arch
)-stamp-cygnus-installed
$(FLAGS_TO_PASS
)
160 if
[ -f CLEAN_ALL
] ; then
rm -rf
$(CYGNUSDIR
) ; else true
; fi
161 touch
$(arch
)-stamp-cygnus
163 $(arch
)-stamp-cygnus-installed
: $(arch
)-stamp-cygnus-checked
164 cd
$(CYGNUSDIR
) ; $(TIME
) $(MAKE
) $(FLAGS_TO_PASS
) $(GNUC
) install
165 cd
$(CYGNUSDIR
) ; $(TIME
) $(MAKE
) $(FLAGS_TO_PASS
) $(GNUC
) install-info
168 $(arch
)-stamp-cygnus-checked
: $(arch
)-stamp-cygnus-built
169 # cd $(CYGNUSDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) check
172 $(arch
)-stamp-cygnus-built
: $(arch
)-stamp-cygnus-configured
173 cd
$(CYGNUSDIR
) ; $(TIME
) $(MAKE
) $(FLAGS_TO_PASS
) $(GNUC
) all
174 cd
$(CYGNUSDIR
) ; $(TIME
) $(MAKE
) $(FLAGS_TO_PASS
) $(GNUC
) info
177 $(arch
)-stamp-cygnus-configured
:
178 [ -d
$(CYGNUSDIR
) ] || mkdir
$(CYGNUSDIR
)
180 $(TIME
) ..
/$(TREE
)/configure
$(config
) -v
-srcdir=..
/$(TREE
) $(prefixes
)
184 do-latest
: $(host
)-stamp-holes
$(arch
)-stamp-latest
185 build-latest
: $(host
)-stamp-holes
$(arch
)-stamp-latest-checked
187 $(arch
)-stamp-latest
:
188 PATH
=/usr
/latest
/bin
:`pwd`/$(HOLESDIR
) ; \
190 SHELL
=sh
; export SHELL
; \
191 $(TIME
) $(GNU_MAKE
) -f test-build.mk
$(arch
)-stamp-latest-installed
$(FLAGS_TO_PASS
)
192 touch
$(arch
)-stamp-latest
194 $(arch
)-stamp-latest-installed
: $(arch
)-stamp-latest-checked
195 cd
$(LATESTDIR
) ; $(TIME
) $(MAKE
) $(FLAGS_TO_PASS
) $(GNUC
) install
196 cd
$(LATESTDIR
) ; $(TIME
) $(MAKE
) $(FLAGS_TO_PASS
) $(GNUC
) install-info
199 $(arch
)-stamp-latest-checked
: $(arch
)-stamp-latest-built
200 # cd $(LATESTDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) check
203 $(arch
)-stamp-latest-built
: $(arch
)-stamp-latest-configured
204 cd
$(LATESTDIR
) ; $(TIME
) $(MAKE
) $(FLAGS_TO_PASS
) $(GNUC
) all
205 cd
$(LATESTDIR
) ; $(TIME
) $(MAKE
) $(FLAGS_TO_PASS
) $(GNUC
) info
208 $(arch
)-stamp-latest-configured
:
209 [ -d
$(LATESTDIR
) ] || mkdir
$(LATESTDIR
)
211 $(TIME
) ..
/$(TREE
)/configure
$(config
) -v
-srcdir=..
/$(TREE
) $(prefixes
)
216 in-place
: $(host
)-stamp-in-place
218 $(host
)-stamp-in-place
:
219 PATH
=/bin
:/usr
/bin
:/usr
/ucb
; \
221 SHELL
=/bin
/sh
; export SHELL
; \
222 $(TIME
) $(GNU_MAKE
) -f test-build.mk
$(host
)-stamp-in-place-installed host
=$(host
) $(FLAGS_TO_PASS
)
224 if
[ -f CLEAN_ALL
] ; then \
225 rm -rf
$(INPLACEDIR
) ; \
227 mv
$(INPLACEDIR
) $(STAGE1DIR
) ; \
230 $(host
)-stamp-in-place-installed
: $(host
)-stamp-in-place-checked
231 cd
$(INPLACEDIR
) ; $(TIME
) $(MAKE
) $(MF
) "CFLAGS=$(CFLAGS)" install host
=$(host
)
232 cd
$(INPLACEDIR
) ; $(TIME
) $(MAKE
) $(MF
) "CFLAGS=$(CFLAGS)" install-info host
=$(host
)
235 $(host
)-stamp-in-place-checked
: $(host
)-stamp-in-place-built
236 # cd $(INPLACEDIR) ; $(TIME) $(MAKE) $(MF) "CFLAGS=$(CFLAGS)" check host=$(host)
239 $(host
)-stamp-in-place-built
: $(host
)-stamp-in-place-configured
240 cd
$(INPLACEDIR
) ; $(TIME
) $(MAKE
) $(MF
) "CFLAGS=$(CFLAGS)" all host
=$(host
)
241 cd
$(INPLACEDIR
) ; $(TIME
) $(MAKE
) $(MF
) "CFLAGS=$(CFLAGS)" info host
=$(host
)
244 $(host
)-stamp-in-place-configured
: $(host
)-stamp-in-place-cp
245 cd
$(INPLACEDIR
) ; $(TIME
) .
/configure
$(host
) -v
$(prefixes
)
248 $(host
)-stamp-in-place-cp
:
251 (cd
$(TREE
) ; tar cf
- .
) |
(cd
$(INPLACEDIR
) ; tar xf
-)
254 $(host
)-stamp-3stage-done
: do1 do2 do3 comparison
259 do1
: $(host
)-stamp-holes
$(host
)-stamp-stage1
260 do1-config
: $(host
)-stamp-stage1-configured
261 do1-build
: $(host
)-stamp-stage1-checked
263 $(host
)-stamp-stage1
:
264 if
[ -d
$(STAGE1DIR
) ] ; then \
265 mv
$(STAGE1DIR
) $(WORKING_DIR
) ; \
269 PATH
=`pwd`/$(HOLESDIR
) ; \
271 SHELL
=sh
; export SHELL
; \
272 $(TIME
) $(GNU_MAKE
) -f test-build.mk
$(host
)-stamp-stage1-installed host
=$(host
) $(FLAGS_TO_PASS
) $(NATIVEC
)
274 if
[ -f CLEAN_ALL
] ; then \
275 rm -rf
$(WORKING_DIR
) ; \
277 mv
$(WORKING_DIR
) $(STAGE1DIR
) ; \
280 $(host
)-stamp-stage1-installed
: $(host
)-stamp-stage1-checked
281 cd
$(WORKING_DIR
) ; $(TIME
) $(MAKE
) $(MF
) "CFLAGS=$(CFLAGS)" install host
=$(host
)
282 cd
$(WORKING_DIR
) ; $(TIME
) $(MAKE
) $(MF
) "CFLAGS=$(CFLAGS)" install-info host
=$(host
)
285 $(host
)-stamp-stage1-checked
: $(host
)-stamp-stage1-built
286 # cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(MF) "CFLAGS=$(CFLAGS)" check host=$(host)
289 $(host
)-stamp-stage1-built
: $(host
)-stamp-stage1-configured
290 cd
$(WORKING_DIR
) ; $(TIME
) $(MAKE
) $(MF
) "CFLAGS=$(CFLAGS)" all host
=$(host
)
291 cd
$(WORKING_DIR
) ; $(TIME
) $(MAKE
) $(MF
) "CFLAGS=$(CFLAGS)" info host
=$(host
)
294 $(host
)-stamp-stage1-configured
:
295 [ -d
$(WORKING_DIR
) ] || mkdir
$(WORKING_DIR
)
296 cd
$(WORKING_DIR
) ; \
297 $(TIME
) ..
/$(TREE
)/configure
$(host
) -v
-srcdir=..
/$(TREE
) $(prefixes
)
301 do2
: $(HOLESDIR
) $(host
)-stamp-stage2
303 $(host
)-stamp-stage2
:
304 if
[ -d
$(STAGE2DIR
) ] ; then \
305 mv
$(STAGE2DIR
) $(WORKING_DIR
) ; \
309 PATH
=$(relbindir
):`pwd`/$(HOLESDIR
) ; \
311 SHELL
=sh
; export SHELL
; \
312 $(TIME
) $(GNU_MAKE
) $(FLAGS_TO_PASS
) -f test-build.mk
-w
$(host
)-stamp-stage2-installed
313 mv
$(WORKING_DIR
) $(STAGE2DIR
)
317 $(host
)-stamp-stage2-installed
: $(host
)-stamp-stage2-checked
318 cd
$(WORKING_DIR
) ; $(TIME
) $(MAKE
) -w
$(MF
) $(GNUC
) "CFLAGS=$(CFLAGS)" install host
=$(host
)
319 cd
$(WORKING_DIR
) ; $(TIME
) $(MAKE
) -w
$(MF
) $(GNUC
) "CFLAGS=$(CFLAGS)" install-info host
=$(host
)
322 $(host
)-stamp-stage2-checked
: $(host
)-stamp-stage2-built
323 # cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(MF) $(GNUC) "CFLAGS=$(CFLAGS)" check host=$(host)
326 $(host
)-stamp-stage2-built
: $(host
)-stamp-stage2-configured
327 cd
$(WORKING_DIR
) ; $(TIME
) $(MAKE
) -w
$(MF
) $(GNUC
) "CFLAGS=$(CFLAGS)" all host
=$(host
)
328 cd
$(WORKING_DIR
) ; $(TIME
) $(MAKE
) -w
$(MF
) $(GNUC
) "CFLAGS=$(CFLAGS)" info host
=$(host
)
331 $(host
)-stamp-stage2-configured
:
332 [ -d
$(WORKING_DIR
) ] || mkdir
$(WORKING_DIR
)
333 cd
$(WORKING_DIR
) ; \
334 $(TIME
) ..
/$(TREE
)/configure
$(host
) -v
-srcdir=..
/$(TREE
) $(prefixes
)
338 do3
: $(HOLESDIR
) $(host
)-stamp-stage3
340 $(host
)-stamp-stage3
:
341 if
[ -d
$(STAGE3DIR
) ] ; then \
342 mv
$(STAGE3DIR
) $(WORKING_DIR
) ; \
346 PATH
=$(relbindir
):`pwd`/$(HOLESDIR
) ; \
348 SHELL
=sh
; export SHELL
; \
349 $(TIME
) $(GNU_MAKE
) $(FLAGS_TO_PASS
) -f test-build.mk
-w
$(host
)-stamp-stage3-checked
350 mv
$(WORKING_DIR
) $(STAGE3DIR
)
354 $(host
)-stamp-stage3-installed
: $(host
)-stamp-stage3-checked
355 cd
$(WORKING_DIR
) ; $(TIME
) $(MAKE
) -w
$(MF
) $(GNUC
) "CFLAGS=$(CFLAGS)" install host
=$(host
)
356 cd
$(WORKING_DIR
) ; $(TIME
) $(MAKE
) -w
$(MF
) $(GNUC
) "CFLAGS=$(CFLAGS)" install-info host
=$(host
)
359 $(host
)-stamp-stage3-checked
: $(host
)-stamp-stage3-built
360 # cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(MF) $(GNUC) "CFLAGS=$(CFLAGS)" check host=$(host)
363 $(host
)-stamp-stage3-built
: $(host
)-stamp-stage3-configured
364 cd
$(WORKING_DIR
) ; $(TIME
) $(MAKE
) -w
$(MF
) $(GNUC
) "CFLAGS=$(CFLAGS)" all host
=$(host
)
365 cd
$(WORKING_DIR
) ; $(TIME
) $(MAKE
) -w
$(MF
) $(GNUC
) "CFLAGS=$(CFLAGS)" info host
=$(host
)
368 $(host
)-stamp-stage3-configured
:
369 [ -d
$(WORKING_DIR
) ] || mkdir
$(WORKING_DIR
)
370 cd
$(WORKING_DIR
) ; \
371 $(TIME
) ..
/$(TREE
)/configure
$(host
) -v
-srcdir=..
/$(TREE
) $(prefixes
)
374 # These things are needed by a three-stage, but are not included locally.
421 ### so far only sun make supports VPATH
422 ifeq ($(subst sun3
,sun4
,$(host
)),sun4
)
428 ### solaris 2 -- don't use /usr/ucb/cc
429 ifeq (sparc-sun-solaris2
,$(host
))
435 ### rs6000 as is busted. We cache a patched version in unsupported.
436 ifeq ($(host
),rs6000-ibm-aix
)
442 ### These things are also needed by a three-stage, but in this case, the GNU version of the tool is required.
450 ### look in these directories for things missing from a three-stage
458 ### look in these directories for alternate versions of some tools.
459 PARTIAL_HOLE_DIRS
:= \
461 /usr
/progressive
/bin \
466 $(HOLESDIR
): $(host
)-stamp-holes
471 @for i in
$(HOLES
) ; do \
473 for j in
$(HOLE_DIRS
) ; do \
474 if
[ -x
$$j/$$i ] ; then \
475 cp
$$j/$$i $(HOLESDIR
) ; \
476 echo
$$i from
$$j ; \
483 *) echo
$$i is NOT found
;; \
486 @for i in
$(PARTIAL_HOLES
) ; do \
488 for j in
$(PARTIAL_HOLE_DIRS
) ; do \
489 if
[ -x
$$j/$$i ] ; then \
490 rm -f
$(HOLESDIR
)/$$i ; \
491 cp
$$j/$$i $(HOLESDIR
)/$$i || exit
1; \
492 echo
$$i from
$$j ; \
499 *) echo
$$i is NOT found
;; \
505 comparison
: $(host
)-stamp-3stage-compared
507 $(host
)-stamp-3stage-compared
:
509 ifeq ($(subst rs6000-ibm-aix
,mips-sgi-irix4
,$(subst mips-dec-ultrix
,mips-sgi-irix4
,$(host
))),mips-sgi-irix4
)
510 for i in
`cd $(STAGE3DIR) ; find . -name \*.o -print` ; do \
511 tail
+10c
$(STAGE2DIR
)/$$i > foo1
; \
512 tail
+10c
$(STAGE3DIR
)/$$i > foo2
; \
513 if cmp foo1 foo2
; then \
517 touch .bad-compare
; \
522 for i in
`cd $(STAGE3DIR) ; find . -name \*.o -print` ; do \
523 cmp
$(STAGE2DIR
)/$$i $(STAGE3DIR
)/$$i || touch .bad-compare
; \
526 if
[ -f CLEAN_ALL
] ; then \
527 rm -rf
$(STAGE2DIR
) $(STAGE3DIR
) ; \
529 if
[ -f CLEAN_STAGES
] ; then \
530 if
[ -f .bad-compare
] ; then \
533 rm -rf
$(STAGE1DIR
) $(STAGE2DIR
) ; \
541 rm -rf
$(HOLESDIR
) $(INPLACEDIR
) $(WORKING_DIR
)* $(host
)-stamp-
* *~