| 1 | # |
| 2 | # Copyright (c) 1986 Regents of the University of California. |
| 3 | # All rights reserved. The Berkeley software License Agreement |
| 4 | # specifies the terms and conditions for redistribution. |
| 5 | # |
| 6 | # @(#)Makefile 4.16 (Berkeley) %G% |
| 7 | # |
| 8 | # This makefile is designed to be run in one of three ways: |
| 9 | # |
| 10 | # make build |
| 11 | # make installsrc |
| 12 | # The `make build' will compile and install the libraries and the compiler |
| 13 | # twice before building the rest of the sources. The `make installsrc' will |
| 14 | # then install the remaining binaries. Only `make build' will clean out |
| 15 | # the source tree as well as remake the dependencies. |
| 16 | # |
| 17 | # make libthenall |
| 18 | # make installsrc |
| 19 | # The `make libthenall' will compile and install the libraries, compile |
| 20 | # and install the compiler and then compile everything else. Note, |
| 21 | # however, that the libraries will have been built with the old compiler. |
| 22 | # The `make installsrc' will then install the remaining binaries. |
| 23 | # |
| 24 | # make all |
| 25 | # make install |
| 26 | # The `make all' (the default) will compile everything, and install |
| 27 | # nothing. The `make install' will then install everything. |
| 28 | # |
| 29 | # C library options: passed to libc makefile. |
| 30 | # See lib/libc/Makefile for explanation. |
| 31 | # |
| 32 | # HOSTLOOKUP must be either named or hosttable. |
| 33 | # DFLMON must be either mon.o or gmon.o. |
| 34 | # DEFS may include -DLIBC_SCCS, -DSYSLIBC_SCCS, both, or neither. |
| 35 | # |
| 36 | DEFS= -DLIBC_SCCS |
| 37 | DFLMON= mon.o |
| 38 | HOSTLOOKUP= named |
| 39 | LIBCDEFS= HOSTLOOKUP=${HOSTLOOKUP} DFLMON=${DFLMON} DEFS="${DEFS}" |
| 40 | |
| 41 | # global flags |
| 42 | # SRC_MFLAGS are used on makes in command source directories, |
| 43 | # but not in library or compiler directories that will be installed |
| 44 | # for use in compiling everything else. |
| 45 | # |
| 46 | DESTDIR= |
| 47 | CFLAGS= -O |
| 48 | SRC_MFLAGS= -k |
| 49 | |
| 50 | LIBDIR= lib usr.lib |
| 51 | # order is important, old and man must be #1 and #2 |
| 52 | SRCDIR= old man bin etc games local new ucb usr.bin |
| 53 | |
| 54 | all: ${LIBDIR} ${SRCDIR} |
| 55 | |
| 56 | libthenall: buildlib1 buildlib3 ${SRCDIR} |
| 57 | |
| 58 | build: clean depend buildlib1 buildlib2 buildlib3 ${SRCDIR} |
| 59 | |
| 60 | lib: FRC |
| 61 | cd lib/libc; make ${MFLAGS} ${LIBCDEFS} |
| 62 | cd lib; make ${MFLAGS} pcc cpp c2 |
| 63 | |
| 64 | usr.lib ${SRCDIR}: FRC |
| 65 | cd $@; make ${MFLAGS} ${SRC_MFLAGS} |
| 66 | |
| 67 | buildlib1: FRC |
| 68 | @echo installing /usr/include |
| 69 | cd include; make ${MFLAGS} DESTDIR=${DESTDIR} install |
| 70 | @echo |
| 71 | @echo compiling libc.a |
| 72 | cd lib/libc; make ${MFLAGS} ${LIBCDEFS} |
| 73 | @echo installing /lib/libc.a |
| 74 | cd lib/libc; make ${MFLAGS} DESTDIR=${DESTDIR} install |
| 75 | @echo |
| 76 | @echo compiling C compiler |
| 77 | cd lib; make ${MFLAGS} pcc cpp c2 |
| 78 | @echo installing C compiler |
| 79 | cd lib/pcc; make ${MFLAGS} DESTDIR=${DESTDIR} install |
| 80 | cd lib/cpp; make ${MFLAGS} DESTDIR=${DESTDIR} install |
| 81 | cd lib/c2; make ${MFLAGS} DESTDIR=${DESTDIR} install |
| 82 | @echo |
| 83 | |
| 84 | buildlib2: FRC |
| 85 | cd lib; make ${MFLAGS} clean |
| 86 | @echo re-compiling libc.a |
| 87 | cd lib/libc; make ${MFLAGS} ${LIBCDEFS} |
| 88 | @echo re-installing /lib/libc.a |
| 89 | cd lib/libc; make ${MFLAGS} DESTDIR=${DESTDIR} install |
| 90 | @echo |
| 91 | @echo re-compiling C compiler |
| 92 | cd lib; make ${MFLAGS} pcc cpp c2 |
| 93 | @echo re-installing C compiler |
| 94 | cd lib/pcc; make ${MFLAGS} DESTDIR=${DESTDIR} install |
| 95 | cd lib/cpp; make ${MFLAGS} DESTDIR=${DESTDIR} install |
| 96 | cd lib/c2; make ${MFLAGS} DESTDIR=${DESTDIR} install |
| 97 | @echo |
| 98 | |
| 99 | buildlib3: FRC |
| 100 | @echo compiling usr.lib |
| 101 | cd usr.lib; make ${MFLAGS} ${SRC_MFLAGS} |
| 102 | @echo installing /usr/lib |
| 103 | cd usr.lib; make ${MFLAGS} ${SRC_MFLAGS} DESTDIR=${DESTDIR} install |
| 104 | @echo |
| 105 | |
| 106 | install: FRC |
| 107 | -for i in ${LIBDIR} ${SRCDIR}; do \ |
| 108 | (cd $$i; \ |
| 109 | make ${MFLAGS} ${SRC_MFLAGS} DESTDIR=${DESTDIR} install); \ |
| 110 | done |
| 111 | |
| 112 | installsrc: FRC |
| 113 | -for i in ${SRCDIR}; do \ |
| 114 | (cd $$i; \ |
| 115 | make ${MFLAGS} ${SRC_MFLAGS} DESTDIR=${DESTDIR} install); \ |
| 116 | done |
| 117 | |
| 118 | depend: FRC |
| 119 | for i in ${LIBDIR} ${SRCDIR}; do \ |
| 120 | (cd $$i; make ${MFLAGS} depend); \ |
| 121 | done |
| 122 | |
| 123 | tags: FRC |
| 124 | for i in include lib usr.lib; do \ |
| 125 | (cd $$i; make ${MFLAGS} TAGSFILE=../tags tags); \ |
| 126 | done |
| 127 | sort -u +0 -1 -o tags tags |
| 128 | |
| 129 | clean: FRC |
| 130 | for i in ${LIBDIR} ${SRCDIR}; do \ |
| 131 | (cd $$i; make -k ${MFLAGS} clean); \ |
| 132 | done |
| 133 | |
| 134 | FRC: |