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