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